controller

package
v0.0.63 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ConditionReady indicates the instance is fully reconciled and running.
	ConditionReady = "Ready"

	// ConditionConfigReady indicates the ConfigMap has been created/updated.
	ConditionConfigReady = "ConfigReady"

	// ConditionDeploymentReady indicates the Deployment has been created/updated.
	ConditionDeploymentReady = "DeploymentReady"

	// ConditionMCPServerReady indicates the MCPServer CRD has been created in muster.
	ConditionMCPServerReady = "MCPServerReady"
)

Condition types for KlausInstance.

View Source
const (
	// MCPServerConditionReady indicates the MCP server config is valid and usable.
	MCPServerConditionReady = "Ready"

	// MCPServerConditionSecretsValid indicates all referenced Secrets exist.
	MCPServerConditionSecretsValid = "SecretsValid"
)

Condition types for KlausMCPServer.

View Source
const MCPServerRefIndexField = "spec.mcpServers.name"

MCPServerRefIndexField is the field path used by the field indexer to look up KlausInstance resources by referenced KlausMCPServer name.

Variables

This section is empty.

Functions

func EnqueueReferencingMCPServerInstances

func EnqueueReferencingMCPServerInstances(c client.Client, operatorNamespace string) handler.MapFunc

EnqueueReferencingMCPServerInstances returns reconcile requests for all KlausInstance resources that reference the given MCP server. Uses the MCPServerRefIndexField field indexer for efficient lookups.

func IndexMCPServerRefs

func IndexMCPServerRefs(obj client.Object) []string

IndexMCPServerRefs extracts KlausMCPServer names from a KlausInstance for the field indexer. This enables efficient lookups of instances by MCP server name without requiring full list scans.

Types

type KlausInstanceReconciler

type KlausInstanceReconciler struct {
	client.Client
	Scheme             *runtime.Scheme
	Recorder           record.EventRecorder
	KlausImage         string
	GitCloneImage      string
	AnthropicKeySecret string
	AnthropicKeyNs     string
	OperatorNamespace  string
	OCIClient          OCIResolver
}

KlausInstanceReconciler reconciles a KlausInstance object.

func (*KlausInstanceReconciler) Reconcile

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

Reconcile handles a KlausInstance event.

func (*KlausInstanceReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager. We use label-based watches with Watches() instead of Owns() because child resources live in different namespaces (user namespaces) from the parent KlausInstance (operator namespace). Owns() relies on owner references which cannot cross namespace boundaries.

type KlausMCPServerReconciler

type KlausMCPServerReconciler struct {
	client.Client
	Scheme            *runtime.Scheme
	Recorder          record.EventRecorder
	OperatorNamespace string
}

KlausMCPServerReconciler reconciles a KlausMCPServer object.

func (*KlausMCPServerReconciler) Reconcile

Reconcile handles a KlausMCPServer event.

func (*KlausMCPServerReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager. Watches KlausInstance changes to update instance counts and Secret changes to re-validate secret references (e.g., when a missing Secret is created).

type OCIResolver

type OCIResolver interface {
	ResolvePersonalityRef(ctx context.Context, ref string) (string, error)
	ResolveToolchainRef(ctx context.Context, ref string) (string, error)
	ResolvePluginRef(ctx context.Context, ref string) (string, error)
}

OCIResolver resolves short names and :latest tags to concrete OCI references.

Jump to

Keyboard shortcuts

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