controller

package
v0.0.3 Latest Latest
Warning

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

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

Documentation

Overview

Package controller contains the core bootstrap logic for the agentbox operator (cmd/sandbox). It sets up the controller-runtime manager, wires all services and controllers, and starts all server processes.

Callers (cmd/sandbox) provide an Options struct to register out-of-tree factories. Extension-specific Args come from the --extension-config YAML file, not from CLI flags, keeping proprietary parameters out of the open-source binary's flag set.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(opts Options)

Run is the single entry point for cmd/sandbox. It parses flags, bootstraps the controller-runtime manager, wires all services, and blocks until a fatal error or signal.

nolint:gocyclo

Types

type Options

type Options struct {
	// ExtraSchemeBuilders are called before ctrl.NewManager so that CRD types
	// owned by out-of-tree packages (e.g. quotav1alpha1) can be watched by the
	// informer cache.
	ExtraSchemeBuilders []func(*runtime.Scheme) error

	// OutOfTreePlugins registers SandboxPool lifecycle plugin factories.
	// Each entry's Factory is registered in the plugin registry; the Args for
	// each plugin are decoded from the --extension-config file at runtime.
	//
	// A plugin listed here is only built when its name also appears in the
	// plugins[] section of the extension config file — registering a factory
	// does not automatically enable the plugin.
	OutOfTreePlugins []PluginFactory

	// QuotaProvider registers an out-of-tree quota provider factory.
	// When nil, the Noop provider is used (quota feature disabled).
	// Args are decoded from the extension config file's quotaProvider.args field.
	//
	// Separating quota from lifecycle plugins reflects the architectural
	// distinction: a Provider is a read-only service dependency injected into
	// HTTP handlers, whereas lifecycle Plugins drive the reconciler's Pre* hooks
	// and own side-effectful operations such as resource reservation.
	QuotaProvider *QuotaProviderFactory
}

Options lets callers extend the core bootstrap without touching app.go. The zero value is valid and produces a minimal OSS build (Noop quota, no lifecycle plugins, no extra CRD types watched).

Args are NOT carried here — they come from the --extension-config YAML file parsed after flag.Parse inside app.Run. This avoids the chicken-and-egg problem where Options must be constructed before flags are parsed.

type PluginFactory

type PluginFactory struct {
	Name    string
	Factory plugins.Factory
	// DecodeArgs converts extconfig map[string]any → concrete framework.Args.
	// Use extconfig.DecodeArgs[MyArgs] as a one-liner implementation.
	DecodeArgs func(map[string]any) (framework.Args, error)
}

PluginFactory registers a lifecycle plugin factory along with a decoder that converts the raw map[string]any from the extension config into the concrete *Args struct the factory expects.

type QuotaProviderFactory

type QuotaProviderFactory struct {
	Name    string
	Factory pluginquota.Factory
	// DecodeArgs converts extconfig map[string]any → concrete framework.Args.
	DecodeArgs func(map[string]any) (framework.Args, error)
}

QuotaProviderFactory registers a quota provider factory along with its args decoder.

Directories

Path Synopsis
Package extconfig defines the schema and loader for the extension configuration file (--extension-config).
Package extconfig defines the schema and loader for the extension configuration file (--extension-config).

Jump to

Keyboard shortcuts

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