k8sOperator.SourceGenerators 1.0.0-alpha0010

This is a prerelease version of k8sOperator.SourceGenerators.
dotnet add package k8sOperator.SourceGenerators --version 1.0.0-alpha0010
                    
NuGet\Install-Package k8sOperator.SourceGenerators -Version 1.0.0-alpha0010
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="k8sOperator.SourceGenerators" Version="1.0.0-alpha0010" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="k8sOperator.SourceGenerators" Version="1.0.0-alpha0010" />
                    
Directory.Packages.props
<PackageReference Include="k8sOperator.SourceGenerators" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add k8sOperator.SourceGenerators --version 1.0.0-alpha0010
                    
#r "nuget: k8sOperator.SourceGenerators, 1.0.0-alpha0010"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package k8sOperator.SourceGenerators@1.0.0-alpha0010
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=k8sOperator.SourceGenerators&version=1.0.0-alpha0010&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=k8sOperator.SourceGenerators&version=1.0.0-alpha0010&prerelease
                    
Install as a Cake Tool

k8sOperator

A modern Kubernetes Operator framework for .NET that makes it easy to build custom controllers and operators.

Features

  • 🎯 Simple API - Fluent builder pattern for Kubernetes resources
  • 🔄 Reconciliation - Built-in controller pattern with informers and caching
  • 📦 Custom Resources - Full CRD support with type-safe definitions
  • 🗳️ Leader Election - High availability out of the box
  • 🚀 AOT Ready - Optimized for trimmed, single-file deployments
  • 🛠️ CLI Included - Built-in commands for install, create, and version
  • 📊 Source Generators - Automatic builder extensions for your resources

Installation

dotnet add package k8sOperator

Quick Start

1. Define Your Custom Resource

[KubernetesEntity(Group = "demo.k8s.io", ApiVersion = "v1", Kind = "MyApp")]
public class MyApp : CustomResource<MyAppSpec, MyAppStatus>
{
}

public class MyAppSpec
{
    public string Image { get; set; }
    public int Replicas { get; set; }
}

public class MyAppStatus
{
    public string Phase { get; set; }
}

2. Create a Reconciler

public class MyAppReconciler : Reconciler<MyApp>
{
    public override async Task<ReconcileResult> ReconcileAsync(
        ReconcileContext<MyApp> context,
        CancellationToken cancellationToken)
    {
        var app = context.Resource;

        // Your reconciliation logic
        // Create/update deployments, services, etc.

        context.Update(x => {
            x.WithStatus(x =>
            {
                x.State = "completed";
                x.CompletedAt = DateTime.UtcNow;
                x.Message = "Todo item has been completed.";
                x.ReconciliationCount++;
            });
        });
    }
}

3. Register and Run

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddOperator(options =>
{
    options.Name = "my-operator";
    options.Namespace = "default";
});

var app = builder.Build();

appapp.AddReconciler<MyApp>(MyOperator.ReconcileAsync);

await app.RunOperatorAsync(args);

Building Resources

Use the fluent builder API:

var deployment = ObjectBuilder.Create<V1Deployment>()
    .WithName("my-app")
    .WithNamespace("default")
    .WithLabel("app", "my-app")
    .WithSpec(spec => spec
        .WithReplicas(3)
        .WithTemplate(template => template
            .WithSpec(podSpec => podSpec
                .WithContainer(c => c
                    .WithImage("nginx:latest")
                    .WithPort(80)))))
    .Build();

CLI Commands

# Show version
myoperator version

# Install CRDs
myoperator install

# Create resource
myoperator create myapp --name demo

# Show help
myoperator help

Configuration

Configure via appsettings.json or attributes:

{
  "Operator": {
    "Name": "my-operator",
    "Namespace": "default",
  }
}

Requirements

  • .NET 10.0 or later
  • Kubernetes 1.25+

License

MIT License


Built with ❤️ by Patrick Evers

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha0010 51 2/17/2026
1.0.0-alpha0008 51 2/13/2026