Skip to main content

Advanced Configuration

KubeOps works out of the box with sensible defaults. This section covers everything you can tune when the defaults no longer fit: reconciliation behavior, queuing, leader election, validation, and customization of generated resources.

Configuring the Operator

Pass a configuration callback to AddKubernetesOperator to customise the operator before it starts. Every option has a sensible default, so you only need to configure what you want to change:

builder.Services
.AddKubernetesOperator(settings => settings
.WithNamespace("my-namespace")
.WithLeaderElection(LeaderElectionType.Single));

Each With* method corresponds to one of the options described on the pages of this section:

PageWhat it controls
Reconcile StrategyWhich watch events trigger a reconciliation (ByGeneration vs. ByResourceVersion)
Watch StrategyHow watch connections to the API server are created (PerController vs. SharedPerEntity)
Queue StrategyHow reconciliation work is scheduled and dispatched (InMemory vs. Custom)
Parallel ReconciliationConcurrency limits and conflict handling for simultaneous reconciliations
Leader ElectionHow multiple operator instances coordinate (None, Single, Custom)
Finalizer LifecycleAutomatic attachment and detachment of finalizers
External Reconciliation TriggersRequesting reconciliation from outside the watch stream (HTTP, message bus)
CachingThe watcher's event deduplication cache (FusionCache)
Registration ValidationStartup validation of the operator's DI registrations
Customizing Resource GenerationReplacing or extending the CRD, webhook, and event factories
CRD InstallerInstalling CRDs from the operator during development