app

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEnv

func LoadEnv(ctx context.Context, s *Settings) error

LoadEnv fills the environment-backed fields; call before flag parsing so explicit flags win.

func New

func New(components Components, settings Settings) (ctrl.Manager, error)

New builds the controller manager with all operator components wired according to the settings. The caller owns starting it.

func NewScheme

func NewScheme() *runtime.Scheme

NewScheme returns the runtime scheme with all types the operator works with.

Types

type Components

type Components struct {
	RestConfig *rest.Config
	Logger     controllerutil.Logger
	Dialer     controllerutil.DialContextFunc
	Fetcher    upgrade.Fetcher
}

Components holds the runtime objects the operator is built from, replaceable in tests.

type Settings

type Settings struct {
	// Reconciliation behavior.
	EnableWebhooks             bool          `env:"ENABLE_WEBHOOKS, default=true"`
	EnablePDB                  bool          `env:"ENABLE_PDB, default=true"`
	EnableNetworkPolicy        bool          `env:"ENABLE_NETWORK_POLICY, default=true"`
	WatchNamespace             []string      `env:"WATCH_NAMESPACE"`
	ResyncPeriod               time.Duration `env:"RESYNC_PERIOD, default=30s"`
	MaxConcurrentReconciles    int           `env:"MAX_CONCURRENT_RECONCILES, default=4"`
	VersionUpdateInterval      time.Duration `env:"VERSION_UPDATE_INTERVAL, default=24h"`
	DisableVersionUpdateChecks bool          `env:"DISABLE_VERSION_UPDATE_CHECKS, default=false"`

	// Manager process wiring, command-line flags only.
	MetricsAddr          string
	ProbeAddr            string
	EnableLeaderElection bool
	SecureMetrics        bool
	EnableHTTP2          bool
	MetricsCertPath      string
	MetricsCertName      string
	MetricsCertKey       string
	WebhookCertPath      string
	WebhookCertName      string
	WebhookCertKey       string
}

Settings holds the operator configuration from command-line flags and environment variables. Behavior knobs are environment-sourced so OLM subscription config and helm envOverrides can inject them; process wiring stays on kubebuilder-scaffold command-line flags. Flags take precedence over environment.

func Defaults

func Defaults() Settings

Defaults returns Settings pre-filled with the defaults of the flag-only fields.

func (*Settings) BindFlags

func (s *Settings) BindFlags(fs *flag.FlagSet)

BindFlags registers the command-line flags on the given FlagSet, using the current values as defaults.

func (*Settings) Validate

func (s *Settings) Validate() error

Validate checks the configuration invariants across all sources.

Jump to

Keyboard shortcuts

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