Migration Guide
KubeOps releases follow semantic versioning: breaking changes only happen in
major versions, and every breaking change is flagged in the
release notes (commits follow
Conventional Commits, so breaking PRs are marked with !
or a BREAKING CHANGE footer). This page summarizes the changes that require action when
upgrading, starting with v11.
Upgrading from v10 to v11
Selector namespace renamed
The LabelSelectors namespace was renamed to Selectors (it now also hosts the field selector
types).
// before (v10)
using KubeOps.KubernetesClient.LabelSelectors;
// after (v11)
using KubeOps.KubernetesClient.Selectors;
Migration: rename the namespace in your using directives.
DefaultEntityLabelSelector<TEntity> is sealed
Subclassing the default label selector is no longer possible.
Migration: implement IEntityLabelSelector<TEntity> directly (the intended extension point)
and register it via
AddControllerWithLabelSelector:
public class MySelector : IEntityLabelSelector<V1DemoEntity>
{
public ValueTask<string?> GetLabelSelectorAsync(CancellationToken cancellationToken) =>
ValueTask.FromResult<string?>("app=my-operator");
}
New in v11 (non-breaking)
- Field selectors: watches can now be filtered server-side by resource fields via
IEntityFieldSelector<TEntity>andAddControllerWithFieldSelector— see Filtering Watched Resources. - YamlDotNet 18: the CLI/transpiler dependency was upgraded across v11 releases. If your project serializes YAML itself and pins an older YamlDotNet, align the versions.
Upgrading from v11 to v12
Leader-loss-aware queue and reconciliation
With LeaderElectionType.Single, the reconciliation queue is now gated on leadership: on
leadership loss the queue's intake is suspended, in-flight reconciliations are cancelled, and
pending entries are cleared (see
Behavior on Leadership Loss).
Action required if you use custom queue components:
- The
EntityQueue<TEntity>delegate (formerly fire-and-forget) now returnsTask<bool>—truewhen the entry was scheduled,falsewhen it was dropped (for example while intake is suspended).awaitthe delegate and handle afalseresult where it matters. - Custom
ITimedEntityQueue<TEntity>implementations must return the correct scheduled/dropped result fromEnqueueand should implementISuspendableEntityQueuewhen combined withLeaderElectionType.Single— see Queue Strategy. - Reconcilers must honor their
CancellationToken, since leadership loss now cancels in-flight reconciliations.
Upgrading from v12 to v13
Kubernetes client list methods accept field selectors
IKubernetesClient.List and ListAsync now accept an optional fieldSelector after the existing
labelSelector, matching the parameter order of the upstream Kubernetes client:
client.ListAsync<TEntity>(
@namespace,
labelSelector,
fieldSelector,
cancellationToken);
This changes the positional asynchronous overload. Calls that previously passed the cancellation token as the third positional argument must name it explicitly:
// before (v12)
client.ListAsync<TEntity>(@namespace, labelSelector, cancellationToken);
// after (v13)
client.ListAsync<TEntity>(@namespace, labelSelector, cancellationToken: cancellationToken);
The typed params LabelSelector[] overloads of List, ListAsync, and Watch now accept
params KubernetesSelector[], and the parameter was renamed from labelSelectors to selectors.
Positional label-selector calls remain source-compatible, while label and field selectors can now
be combined in one call:
client.List<TEntity>(
@namespace,
new EqualsLabelSelector("app", "demo"),
new EqualsFieldSelector("metadata.name", "demo"));
Callers that passed the selectors by name must rename the argument, because the parameter is no
longer called labelSelectors:
// before (v12)
client.List<TEntity>(@namespace, labelSelectors: new EqualsLabelSelector("app", "demo"));
// after (v13)
client.List<TEntity>(@namespace, selectors: new EqualsLabelSelector("app", "demo"));
The synchronous string-based Watch overload likewise accepts fieldSelector immediately after
labelSelector, matching List, ListAsync, and WatchAsync.
Generator multi-assembly composition
The source generator now supports multi-assembly composition: controllers, finalizers and
entities may live in referenced class libraries that also reference KubeOps.Generator.
- Assemblies containing controllers or finalizers are marked with an assembly-level
KubeOpsGeneratedRegistrationsAttribute. The generatedRegisterComponentsof the consuming compilation discovers these markers on all transitively referenced assemblies and registers every assembly's components exactly once — components in referenced class libraries are now registered automatically. ControllerRegistrations,FinalizerRegistrations,EntityDefinitionsandEntityInitializerare only generated when the compilation contains matching components.EntityDefinitionsonly lists entities declared in the compilation itself; entities from referenced assemblies are listed by their declaring assembly.RegisterComponentsis generated whenever the compilation referencesKubeOps.Operatoror contains/references components, and only invokes the parts that exist.- The shared generated classes remain in the global namespace by default. When multiple
projects of one solution use the generator, set the new
KubeOpsGeneratorNamespaceMSBuild property (e.g. to$(RootNamespace)) in the participating projects so the generated class names do not conflict. The generator reports the warning KOG002 and skips the conflicting registration when it detects such a clash. Note that with the property set, top-levelProgram.csfiles need a using directive for the configured namespace so thatRegisterComponents()resolves. OperatorBuilderExtensions.RegisterComponentsand theEntityInitializer.Initialize()extensions are now generated asinternal. They are only meaningful for the compilation they are generated into; keeping them invisible across assembly boundaries rules out ambiguous extension method calls when multiple assemblies use the generator. This only affects the exotic case of calling these generated extensions from a different assembly — such setups were already broken by ambiguous calls as soon as two projects referenced the generator. If another assembly relied on calling them, reference the generator in that assembly instead — it generates its own.
v13 makes it possible to register multiple controllers for the same entity type, each with its
own label or field selector (see
Multiple Controllers per Entity).
Delivering this required reworking the internal dispatch pipeline: every controller registration now
owns a dedicated ControllerPipeline<TEntity> (watcher + queue + consumer). Most operators need no
code changes — the breaking changes below only affect projects that implement custom queue,
watcher, or reconciler components, or that resolve those internals from DI.
IEntityQueueFactory / EntityQueueFactory removed
The queue-factory abstraction is gone. Requeues are now routed through the active pipeline by the
EntityQueue<TEntity> delegate, which resolves the queue of the pipeline currently reconciling the
entity.
Migration: remove references to IEntityQueueFactory / EntityQueueFactory. To schedule a
requeue from a controller, return
ReconciliationResult<TEntity>.Success(entity, requeueAfter)
instead of touching the queue directly. If you injected EntityQueue<TEntity> to enqueue manually,
keep using the delegate — but note the resolution change below.
EntityQueue<TEntity> no longer resolvable from a singleton with multiple pipelines
Because each pipeline owns its own queue, there is no single "the queue" for an entity type when more
than one controller is registered for it. Resolving EntityQueue<TEntity> from a singleton now
throws an InvalidOperationException instead of silently handing out a shared queue.
Migration: resolve and invoke EntityQueue<TEntity> from within a reconciliation scope (where
the active pipeline is known), or from a scoped/transient service. Operators with a single controller
per entity are unaffected.
Custom watcher constructors gained a cachePartition parameter
ResourceWatcher<TEntity> and LeaderAwareResourceWatcher<TEntity> take an additional optional
cachePartition argument. It partitions the generation-dedup cache per pipeline so that overlapping
selectors no longer let one pipeline's cache write suppress another pipeline's event.
Migration: if you subclass or construct these watchers directly, thread the new parameter through (it defaults to a shared partition, preserving single-pipeline behavior). Pass a distinct token per pipeline when running several watchers for the same entity type.
EntityQueueBackgroundService<TEntity> constructor gained a coordinator parameter
The queue consumer's constructor takes an additional IEntityReconcileCoordinator<TEntity>. The
coordinator is a per-entity-type singleton that owns the global parallelism budget and the per-UID
exclusive lock, so multiple controllers for the same entity no longer multiply the parallelism limit
and never reconcile (or finalize) the same object concurrently.
Migration: if you derive a custom consumer from EntityQueueBackgroundService<TEntity> (or
LeaderAwareEntityQueueBackgroundService<TEntity>), forward the new IEntityReconcileCoordinator<TEntity>
to the base constructor — exactly as you already forward IReconciler<TEntity>. It is registered
automatically per entity type, so constructor injection resolves it.
IReconciler<TEntity> / ITimedEntityQueue<TEntity> not registered for the in-memory strategy
With the default in-memory queue strategy these services are now owned by the pipeline and are no
longer registered in the DI container. Registration is unchanged for LeaderElectionType.Custom
and QueueStrategy.Custom, where you still wire up the queue and consumer yourself (the SDK keeps
registering IReconciler<TEntity> for these paths, so your consumer can resolve it).
Migration: stop resolving IReconciler<TEntity> / ITimedEntityQueue<TEntity> from DI in the
default configuration. If you need custom queue behavior, opt into
QueueStrategy.Custom and register your implementation there.
Reconciler<TEntity> now carries a controllerType
The internal Reconciler<TEntity> receives a Type controllerType so it can resolve the correct
controller for its pipeline by concrete type. This is an internal type; only projects that
constructed it directly are affected.
Migration: pass the concrete controller type when constructing Reconciler<TEntity> yourself, or
rely on the SDK's registration.
Entity logging scopes are created through a factory
ResourceWatcher<TEntity>, EntityQueueBackgroundService<TEntity> and their leader-/scope-aware
derivations take an additional IEntityLoggingScopeFactory<TEntity> argument. The factory applies all
registered enrichers while creating the scope (see
Logging).
Migration: resolve IEntityLoggingScopeFactory<TEntity> through dependency injection. Use its
CreateFor(...) methods to create an enriched scope, and pass the factory when directly constructing or
subclassing the watcher and queue types. EntityLoggingScope.CreateFor(...) remains available for standalone,
unenriched scopes. The default factory is registered automatically per entity type and is a no-op beyond the
built-in fields when no enrichers are configured.
New in v13 (non-breaking)
- Scoped leader election:
LeaderElectionType.Scopedpartitions responsibility across instances (e.g. by namespace) via a user-registeredILeadershipScope, while keeping the full default pipeline — see Scoped Leader Election. - Multiple controllers per entity: register several
IEntityController<TEntity>for the same entity with different selectors — both fire for objects matching both selectors. Supported on the default in-memory queue with non-custom leader election; underQueueStrategy.Custom/LeaderElectionType.Customonly one controller per entity is allowed (a second registration throws). See Multiple Controllers per Entity. - Watch strategy: choose how watch streams are provisioned via
OperatorSettings.WatchStrategy/WithWatchStrategy(...).WatchStrategy.PerController(default) gives every controller its own server-side–filtered watch;WatchStrategy.SharedPerEntity(opt-in) shares a single watch stream per entity type and matches events client-side. - Selector attributes: declare a controller's selector with
[LabelSelector(typeof(...))]/[FieldSelector(typeof(...))]; the source generator emits the matching registration. Declaring both on one controller is now a compile-time error (KOG001) instead of silently registering only the label selector — split it into two controllers. IClientSideEntitySelector<TEntity>: implement it on a selector to control client-side matching underSharedPerEntity(otherwise standard Kubernetes selector syntax is used).
Every breaking change is also listed in the release notes. Check the notes for the version you are upgrading to when something does not match this guide.
Upgrading from v13 to v14
v14 follows the .NET release cycle: it adds .NET 11 and drops the .NET versions that went out of
support. It also replaces the LocalTunnel-based development tunnel, registers webhooks derived through
base classes of your own, and removes JsonPatch.Net together with the synchronous client API.
.NET 8 and .NET 9 no longer supported
KubeOps no longer ships net8.0 and net9.0 assets, because .NET 8 and .NET 9 went out of support on
November 10, 2026. The runtime libraries and KubeOps.Cli target net10.0 (LTS) and net11.0 (STS);
see Supported Target Frameworks.
Migration: set the TargetFramework of your operator to net10.0 or net11.0 and build it with the
.NET 10 SDK or later. If your project references Microsoft.Extensions.* or ASP.NET Core packages
directly, raise them to at least the version KubeOps references for your target framework; a lower
version fails the restore with NU1605. Projects that have to stay on .NET 8 or .NET 9 need to remain on
KubeOps v13.
AddDevelopmentTunnel removed
AddDevelopmentTunnel and the transitive Localtunnel dependency are gone, because LocalTunnel was
unstable and deprecated. A locally running operator now registers its webhooks against the HTTPS URL of a
tunnel that you start yourself, for example a Microsoft Dev Tunnel, a Cloudflare Tunnel or ngrok.
Migration: start a tunnel that forwards to the HTTP port of the operator and replace
AddDevelopmentTunnel(port) with UseExternalWebhookEndpoint(...):
// v13
builder.Services
.AddKubernetesOperator()
.AddDevelopmentTunnel(5000)
.RegisterComponents();
// v14
builder.Services
.AddKubernetesOperator()
.UseExternalWebhookEndpoint(new Uri("https://my-tunnel-5000.euw.devtunnels.ms"))
.RegisterComponents();
UseExternalWebhookEndpoint() without arguments reads the URL from KubeOps:Webhooks:ExternalUrl. In an
Aspire AppHost, WithWebhookDevTunnel() starts a Dev Tunnel and passes its URL to the operator. See
Tunnel and Aspire for
the setup.
Webhooks derived through a base class of your own are registered
Webhooks that derive from ValidationWebhook<T>, MutationWebhook<T> or ConversionWebhook<T> through an
intermediate class of your own are now registered at runtime and included in the manifests the CLI
generates. Before, they were skipped without notice. Abstract classes are still not registered.
Migration: check such webhook classes before upgrading, because they become active with the update. A second validation or mutation webhook for the same entity kind, group and version now fails the start of the operator and names the duplicate webhook; see Webhook classes.
JsonPatch.Net removed
KubeOps no longer references JsonPatch.Net, because its releases since 5.0.0 ship under the
Open Source Maintenance Fee EULA. The
JSON Patch API is now part of KubeOps.Abstractions and no longer requires preview features.
JsonPatch,PatchOperationandOperationTypemoved fromJson.PatchtoKubeOps.Abstractions.Entities. Generated patches are unchanged.PatchOperation.Pathis astring(JSON Pointer) instead of aJsonPointer.OperationTypeonly hasAdd,RemoveandReplace, andPatchOperation.Fromis gone. Formove,copyortestoperations, pass the JSON text toPatchAsyncas aV1Patch.JsonPatch.Net,JsonPointer.NetandJson.More.Netare no longer transitive dependencies. Reference them yourself if your code uses them. Importing bothJson.PatchandKubeOps.Abstractions.Entitiesin one file makes the shared type names ambiguous.- Removed without replacement: applying a patch (
JsonPatch.Apply),CreatePatchfor arbitrary objects, andSystem.Text.Jsonserialization of the patch types. Useentity.CreateJsonPatch(other)ornode.CreatePatch(otherNode)to create a patch andpatch.ToJsonString()to serialize it.
Synchronous IKubernetesClient methods removed
Get, List, Save, Create, Update, UpdateStatus, Patch and Delete are gone. They blocked a
thread on the API call. Use the ...Async variants, which also accept a CancellationToken.
GetCurrentNamespace stays, because it does not call the API, and so does Watch.
New in v14 (non-breaking)
- Explicit field manager: every write of the operator carries a
fieldManager, which defaults to the operator name and is set withWithFieldManager(...). Writes are recorded inmetadata.managedFieldsunder that name instead ofkubernetes-csharp; existing entries keep their old manager until their fields are written again. If you register an ownIKubernetes, add theFieldManagerHandleryourself. An operator name that is not a valid field manager (over 128 bytes or with non-printable characters) needs an explicitWithFieldManager(...). The KubeOps CLI writes askubeops-cli. See Field Manager.
Upgrading from v14 to v15
v15 moves KubeOps.Aspire.Hosting to Aspire 17. Aspire 17 deprecates AddProject<TProject> and the
Aspire.AppHost.Sdk in favour of path-based projects, so AddKubeOps now takes the path of the operator
project. KubeOps.KubernetesClient drops the force parameter of the JSON patch overloads of PatchAsync,
where the API server never accepted it. The other packages have no breaking changes.
KubeOps.Aspire.Hosting requires Aspire 17
KubeOps.Aspire.Hosting references Aspire.Hosting, Aspire.Hosting.Dotnet, Aspire.Hosting.DevTunnels
and the now stable Aspire.Hosting.Kubernetes in version 17.
Migration: update the AppHost to Aspire 17; see
Aspire 17 breaking changes. The AppHost becomes
a plain Microsoft.NET.Sdk project with a package reference to Aspire.Hosting.AppHost instead of the
obsolete Aspire.AppHost.Sdk, and no longer needs a project reference to the operator; see
AppHost project.
AddKubeOps<TProject> replaced by AddKubeOps(name, projectPath)
AddKubeOps<TProject>(name) and AddKubeOps<TProject>(name, configureManifests) are gone, because they
were built on the deprecated AddProject<TProject>. AddKubeOps(name, projectPath) and
AddKubeOps(name, projectPath, configureManifests) build on AddDotnetProject and take the operator's
.csproj file or its directory, relative to the AppHost directory.
They return IResourceBuilder<DotnetProjectResource> instead of IResourceBuilder<ProjectResource>, and
PublishAsKubernetesOperator, RunWithKubernetes and WithWebhookDevTunnel extend
IResourceBuilder<DotnetProjectResource>. DotnetProjectResource does not derive from ProjectResource.
Migration: pass the project path instead of the generated Projects type, and change variables or
own extension methods that are typed to IResourceBuilder<ProjectResource>:
// v14
builder.AddKubeOps<Projects.MyOperator>("operator")
.RunWithKubernetes(k8s)
.PublishAsKubernetesOperator(k8s);
// v15
builder.AddKubeOps("operator", "../MyOperator")
.RunWithKubernetes(k8s)
.PublishAsKubernetesOperator(k8s);
force removed from the JSON patch overloads of PatchAsync
PatchAsync(entity, operationsFilter, ...), PatchAsync(from, to, operationsFilter, ...) and
PatchAsync(entity, JsonPatch, ...) send a JSON patch and no longer take force. The API server only accepts
force for a server-side apply patch and rejected every other patch with 422 Unprocessable Entity, even with
force: false.
Migration: remove force from these calls. To take over fields of other field managers, send a server-side
apply patch with PatchAsync<TEntity>(new V1Patch(..., V1Patch.PatchType.ApplyPatch), name, namespace, fieldManager, force: true).