controller

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModuleReleaseReconciler

type ModuleReleaseReconciler struct {
	client.Client
	// APIReader is an uncached reader (manager.GetAPIReader()) used for one-off
	// reads that must not provision a cache informer.
	APIReader       client.Reader
	Scheme          *runtime.Scheme
	RestConfig      *rest.Config
	ResourceManager *fluxssa.ResourceManager
	EventRecorder   events.EventRecorder
	Renderer        render.ModuleRenderer
	// DefaultServiceAccount is the fallback SA name used when a
	// ModuleRelease has an empty spec.serviceAccountName. Resolved in the
	// release's own namespace. Empty disables the default.
	DefaultServiceAccount string
	// Kernel is the shared, long-lived library Kernel constructed once at
	// manager startup. It is the injection seam later enhancement-0001 slices
	// consume to drive the render path; this slice wires it but does not read
	// it on any reconcile path.
	Kernel *kernel.Kernel
}

ModuleReleaseReconciler reconciles a ModuleRelease object. Dependencies are injected via struct fields at manager setup time.

func (*ModuleReleaseReconciler) Reconcile

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

Reconcile runs the full ModuleRelease reconcile loop: CUE module synthesis and resolution from OCI registry, rendering, SSA apply, optional prune, and status commit.

func (*ModuleReleaseReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

Watches:

  • ModuleRelease CRs (primary, generation-change predicate)
  • Platform (cluster singleton) — every change re-enqueues all ModuleReleases via mapPlatformToModuleReleases so releases blocked on PlatformNotReady recover promptly when the platform materializes. The generation predicate lives on For() (not as a global event filter) so it does not suppress the Platform watch, whose trigger (materialization) is a status update that does not bump generation.

type PlatformReconciler added in v0.7.0

type PlatformReconciler struct {
	client.Client
	Scheme        *runtime.Scheme
	EventRecorder events.EventRecorder

	// Kernel is the shared, long-lived library Kernel constructed once at
	// manager startup. SynthesizePlatform and Materialize run on it.
	Kernel *kernel.Kernel

	// Store holds the current materialized platform. Written here, read by
	// the render path in a later slice.
	Store *platformstore.Store
}

PlatformReconciler reconciles the singleton Platform CR into a materialized platform held in a process-local, generation-keyed store. On reconcile it maps the spec to a synth.PlatformInput, runs SynthesizePlatform then Materialize, holds the result, and surfaces the outcome on the CR's Ready condition. Nothing yet reads the store; the CR's status is the observable contract this slice delivers.

func (*PlatformReconciler) Reconcile added in v0.7.0

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

Reconcile materializes the cluster-singleton Platform and records the outcome on its status. It reconciles only the object named "cluster"; any other name is ignored without error. On delete it clears the store slot (workloads are untouched — §8.4 freeze-don't-teardown).

func (*PlatformReconciler) SetupWithManager added in v0.7.0

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

SetupWithManager wires the controller into mgr, watching the Platform singleton with a generation-change predicate.

type ReleaseReconciler

type ReleaseReconciler struct {
	client.Client
	// APIReader is an uncached reader (manager.GetAPIReader()) used for one-off
	// reads that must not provision a cache informer.
	APIReader       client.Reader
	Scheme          *runtime.Scheme
	RestConfig      *rest.Config
	ResourceManager *fluxssa.ResourceManager
	EventRecorder   events.EventRecorder

	// Fetcher downloads Flux source artifacts. Injected for testability.
	Fetcher opmsource.Fetcher

	// Renderer loads and renders the CUE release package from the extracted
	// artifact directory. Injected for testability.
	Renderer render.ReleaseRenderer

	// DefaultServiceAccount is the fallback SA name used when a Release has
	// an empty spec.serviceAccountName. Resolved in the release's own
	// namespace. Empty disables the default.
	DefaultServiceAccount string

	// Kernel is the shared, long-lived library Kernel constructed once at
	// manager startup. It is the injection seam later enhancement-0001 slices
	// consume to drive the render path; this slice wires it but does not read
	// it on any reconcile path.
	Kernel *kernel.Kernel
}

ReleaseReconciler reconciles a Release object.

func (*ReleaseReconciler) Reconcile

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

Reconcile runs the full Release reconcile loop: source resolution, artifact fetch, path navigation, CUE load, kind detection, render, apply, prune, and status commit.

func (*ReleaseReconciler) SetupWithManager

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

SetupWithManager wires the controller into mgr. Watches:

  • Release CRs (primary, generation-change predicate)
  • OCIRepository, GitRepository, Bucket (artifact-change predicate, mapped to referencing Releases)
  • Platform (cluster singleton) — every change re-enqueues all Releases via mapPlatformToReleases so releases blocked on PlatformNotReady recover promptly when the platform materializes. The generation predicate lives on For() (not as a global filter) so it does not suppress the Platform watch, whose trigger (materialization) is a status update that does not bump generation.

Jump to

Keyboard shortcuts

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