controller

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NatsBoxReconciler

type NatsBoxReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

NatsBoxReconciler reconciles a NatsBox object.

func (*NatsBoxReconciler) Reconcile

func (r *NatsBoxReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile fetches the NatsBox, applies controller-side defaults, builds the rendered contexts Secret + Deployment, and server-side-applies them. Status is patched from the live Deployment's replica counts.

func (*NatsBoxReconciler) SetupWithManager

func (r *NatsBoxReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager wires the controller and declares Owns on the Deployment and the contexts Secret so changes trigger reconcile.

type NatsClusterReconciler

type NatsClusterReconciler struct {
	client.Client
	Scheme *runtime.Scheme

	// EnableNackIntegration controls whether the reconciler creates NACK
	// `jetstream.nats.io/v1beta2` Account CRs for auth.jwt.accounts[]
	// entries with userCreds set, and whether SetupWithManager registers
	// an Owns watch on NACK Account. When false, the integration is fully
	// skipped — the condition is not stamped, the watch is not registered,
	// and the operator does not touch the NACK API group at all. Resolved
	// from the --nack-integration flag in main.go (auto / enabled / disabled).
	EnableNackIntegration bool
}

NatsClusterReconciler reconciles a NatsCluster object.

func (*NatsClusterReconciler) Reconcile

func (r *NatsClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is the main reconcile loop. It fetches the NatsCluster, applies controller-side defaults, builds every owned resource from the defaulted spec, and server-side-applies them. Status is then patched from the live StatefulSet's replica counts.

func (*NatsClusterReconciler) SetupWithManager

func (r *NatsClusterReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager wires the controller to the manager and declares the owned resource types so changes to them trigger reconciles for the parent NatsCluster. PodMonitor is intentionally not in the Owns list — the operator owns it via SSA but doesn't need to react to its events.

The NACK Account ownership is only registered when EnableNackIntegration is true. controller-runtime's informer does NOT tolerate missing CRDs gracefully: a missing kind floods the operator logs with "no matches for kind" errors on every polling interval. The --nack-integration flag in main.go auto-detects the CRD at startup (or lets the user force the mode), and the reconciler only calls Owns() here when the integration is actually supposed to run.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL