controller

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModuleReconciler

type ModuleReconciler struct {
	client.Client
	Scheme   *runtime.Scheme
	Version  string
	Recorder events.EventRecorder
}

ModuleReconciler reconciles a Module object. It ensures that the FluxCD HelmRelease or Kustomization matches the desired state derived from the referenced ModuleTemplate.

The controller is intentionally kept thin: it orchestrates the reconciliation flow, while the actual resource synchronization logic resides in internal/core/module/.

func (*ModuleReconciler) Reconcile

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

Reconcile is the main loop for the Module controller. It implements the level-triggered reconciliation logic: Fetch -> Finalizer -> Fetch Template -> Check Upgrade -> Sync FluxCD Resource -> Status Update.

When a ModuleTemplate changes, the controller evaluates an upgrade decision. If the Module has an explicit ApprovedTemplateGeneration, template changes are gated until the user approves the new generation. Otherwise, changes are auto-applied.

Deletion is handled via Finalizer to ensure FluxCD resources are properly cleaned up (allowing Flux to run its uninstall logic) before the Module is removed.

func (*ModuleReconciler) SetupWithManager

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

SetupWithManager registers the controller with the Manager and defines watches.

Watch configuration:

  • Module: with GenerationChangedPredicate to skip status-only updates
  • ModuleTemplate: when changed, all Modules referencing it are re-enqueued
  • FluxCD HelmRelease/Kustomization: status changes trigger Module re-reconciliation via label-based mapping (the operator labels all managed FluxCD resources)

Jump to

Keyboard shortcuts

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