controller

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 56 Imported by: 0

Documentation

Overview

Package controller implements the Kubernetes controllers for agent-orca CRDs.

Index

Constants

View Source
const (
	// LabelManagedByMCPServer marks Tools generated by the MCPServer controller.
	LabelManagedByMCPServer = "mcpserver"
	// LabelManagedBy identifies who manages a resource.
	LabelManagedBy = "agentorca.io/managed-by"
	// LabelMCPServer identifies which MCPServer owns a Tool.
	LabelMCPServer = "agentorca.io/mcpserver"
)
View Source
const (
	// ControllerPrincipal is the reserved name in MCPServer.allowedAgents that
	// grants the KnowledgeBase controller access to the MCP server.
	ControllerPrincipal = "_controller"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentDeploymentReconciler

type AgentDeploymentReconciler struct {
	client.Client
	Scheme           *runtime.Scheme
	Recorder         record.EventRecorder
	K8s              kubernetes.Interface
	ModelRouterImage string
	StateConfig      state.Config
	CloudProvider    security.CloudProvider
	// TokenReviewerClusterRole is the ClusterRole that grants "create tokenreviews".
	TokenReviewerClusterRole string
	// OperatorAPIURL is the base URL of the operator's internal API server.
	// Injected into the router config so the model-router can call RAG, handoff, etc.
	OperatorAPIURL string
	// LLMRequestTimeout is the per-LLM-request timeout written into every router
	// config (default 1h). Injected from the LLM_REQUEST_TIMEOUT env var.
	LLMRequestTimeout time.Duration
	// ContextCompactionThreshold is the fraction of a provider's window at
	// which the router compacts the conversation (default 0.8, #47). Injected
	// from the CONTEXT_COMPACTION_THRESHOLD env var.
	ContextCompactionThreshold float64
	// ContextCompactionMode is "summary" (default) or "truncate", the rollback
	// switch (#47). Injected from the CONTEXT_COMPACTION_MODE env var.
	ContextCompactionMode string
	// ContextCompactionRatio is the fraction of the window drop-oldest
	// truncation cuts down to ("truncate" mode and the summary fallback).
	// Injected from the deprecated CONTEXT_COMPACTION_RATIO env var.
	ContextCompactionRatio float64

	// HindsightURL is the configured hindsight API endpoint (e.g. http://hindsight.local).
	// Injected from the HINDSIGHT_URL env var. Used to generate ipBlock egress rules
	// in the per-run NetworkPolicies when the cluster has a default-deny egress policy.
	HindsightURL string
}

AgentDeploymentReconciler reconciles an AgentDeployment object.

func (*AgentDeploymentReconciler) Reconcile

Reconcile implements the reconciliation loop for AgentDeployment.

func (*AgentDeploymentReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type AgentReconciler

type AgentReconciler struct {
	client.Client
	Scheme        *runtime.Scheme
	CloudProvider security.CloudProvider
}

AgentReconciler reconciles a Agent object.

func (*AgentReconciler) Reconcile

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

func (*AgentReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type AgentRunReconciler

type AgentRunReconciler struct {
	client.Client
	Scheme           *runtime.Scheme
	Recorder         record.EventRecorder
	K8s              kubernetes.Interface
	Dynamic          dynamic.Interface
	ModelRouterImage string
	StateConfig      state.Config
	StateStore       state.Store
	CloudProvider    security.CloudProvider
	// PostgresStore is the optional PostgreSQL archival store. When non-nil,
	// terminal-phase AgentRuns are snapshotted here for long-term retention
	// and historical querying by the UI.
	PostgresStore *postgresql.Store
	// TokenReviewerClusterRole is the name of the ClusterRole that grants
	// "create tokenreviews" — injected at startup from the Helm release name.
	// The agentrun controller binds each agent SA to this role so the
	// model-router sidecar can call the TokenReview API.
	TokenReviewerClusterRole string
	// OperatorAPIURL is the base URL of the operator's internal API server,
	// injected from the OPERATOR_API_URL env var. Written into every router
	// ConfigMap so sidecars can call /agentrun endpoints for handoff and child runs.
	// Example: "http://agent-orca-internal-api.agent-orca-system.svc.cluster.local:8082"
	OperatorAPIURL string
	// LLMRequestTimeout is the per-LLM-request timeout written into every router
	// config (default 1h). Injected from the LLM_REQUEST_TIMEOUT env var.
	LLMRequestTimeout time.Duration
	// ContextCompactionThreshold is the fraction of a provider's window at
	// which the router compacts the conversation (default 0.8, #47). Injected
	// from the CONTEXT_COMPACTION_THRESHOLD env var.
	ContextCompactionThreshold float64
	// ContextCompactionMode is "summary" (default) or "truncate", the rollback
	// switch (#47). Injected from the CONTEXT_COMPACTION_MODE env var.
	ContextCompactionMode string
	// ContextCompactionRatio is the fraction of the window drop-oldest
	// truncation cuts down to ("truncate" mode and the summary fallback).
	// Injected from the deprecated CONTEXT_COMPACTION_RATIO env var.
	ContextCompactionRatio float64

	// HindsightURL is the configured hindsight API endpoint (e.g. http://hindsight.local).
	// Injected from the HINDSIGHT_URL env var. Used to generate ipBlock egress rules
	// in the per-run NetworkPolicies when the cluster has a default-deny egress policy.
	HindsightURL string
}

AgentRunReconciler reconciles a AgentRun object.

func (*AgentRunReconciler) Reconcile

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

func (*AgentRunReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type AgentWorkflowReconciler

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

AgentWorkflowReconciler reconciles AgentWorkflow objects.

func (*AgentWorkflowReconciler) Reconcile

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

func (*AgentWorkflowReconciler) SetupWithManager

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

SetupWithManager registers the controller with the Manager.

type KnowledgeBaseReconciler

type KnowledgeBaseReconciler struct {
	client.Client
	Scheme           *runtime.Scheme
	MCPIngesterImage string
	QdrantImage      string
}

KnowledgeBaseReconciler reconciles KnowledgeBase objects.

func (*KnowledgeBaseReconciler) Reconcile

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

func (*KnowledgeBaseReconciler) SetupWithManager

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

SetupWithManager registers the controller with the Manager.

type MCPServerReconciler

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

MCPServerReconciler reconciles an MCPServer object. It generates one child Tool CR per declared tool in the MCPServer spec, and — for OAuth-only remote MCP servers — performs the OAuth token exchange itself (no sidecar) so the flow lives entirely in the MCPServer CR.

func (*MCPServerReconciler) Reconcile

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

func (*MCPServerReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type ModelProviderReconciler

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

ModelProviderReconciler reconciles a ModelProvider object.

func (*ModelProviderReconciler) Reconcile

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

func (*ModelProviderReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type ModelSelectorReconciler

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

ModelSelectorReconciler reconciles a ModelSelector object

func (*ModelSelectorReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the ModelSelector object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.23.1/pkg/reconcile

func (*ModelSelectorReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type TenantConfigReconciler

type TenantConfigReconciler struct {
	client.Client
	Scheme    *runtime.Scheme
	Refresher TenantRefresher
}

TenantConfigReconciler reconciles TenantConfig objects and keeps the external auth middleware's tenant cache up to date.

func (*TenantConfigReconciler) Reconcile

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

func (*TenantConfigReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type TenantRefresher

type TenantRefresher interface {
	RefreshTenants(ctx context.Context) error
}

TenantRefresher is implemented by ExternalAuth to refresh the tenant cache.

type ToolReconciler

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

ToolReconciler reconciles a Tool object.

func (*ToolReconciler) Reconcile

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

func (*ToolReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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