manager

package
v1.6.1-0...-486f9dc Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: Apache-2.0 Imports: 67 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMetricsAddr is the default bind address for the metrics server.
	DefaultMetricsAddr = ":8080"
	// DefaultProbeAddr is the default bind address for the health probe server.
	DefaultProbeAddr = ":8081"
	// DefaultControlPlaneConfigurationDumpAddr is the default bind address for the server to dump ControlPlane configuration.
	DefaultControlPlaneConfigurationDumpAddr = ":10256"
)

Variables

This section is empty.

Functions

func KeyTypeToX509PublicKeyAlgorithm

func KeyTypeToX509PublicKeyAlgorithm(keyType mgrconfig.KeyType) (x509.PublicKeyAlgorithm, error)

KeyTypeToX509PublicKeyAlgorithm converts a KeyType to an x509.PublicKeyAlgorithm.

func NewWatchNamespaces

func NewWatchNamespaces(watchNamespaces string) ([]string, error)

NewWatchNamespaces parses the watchNamespaces string and returns a slice of trimmed namespace names.

func Run

func Run(
	cfg Config,
	scheme *runtime.Scheme,
	setupControllers SetupControllersFunc,
	startedChan chan<- struct{},
	metadata metadata.Info,
) error

Run runs the manager. Parameter cfg represents the configuration for the manager that for normal operation is derived from command-line flags. The function setupControllers is expected to return a list of configured ControllerDef that will be added to the manager. The function admissionRequestHandler is used to construct the admission webhook handler for the validating webhook that is added to the manager too. Argument startedChan can be used as a signal to notify the caller when the manager has been started. Specifically, this channel gets closed when manager.Start() is called. Pass nil if you don't need this signal.

func SetupCacheIndexes

func SetupCacheIndexes(ctx context.Context, mgr manager.Manager, cfg Config) error

SetupCacheIndexes sets up all the cache indexes required by the controllers.

Types

type AutoHandler

type AutoHandler func(client.Client) (bool, error)

AutoHandler decides whether the specific controller shall be enabled (true) or disabled (false).

type Config

type Config struct {
	MetricsAddr             string
	MetricsAccessFilter     MetricsAccessFilter
	ProbeAddr               string
	LeaderElection          bool
	LeaderElectionNamespace string

	AnonymousReports bool
	LoggingMode      logging.Mode
	ValidateImages   bool

	Out                      *os.File
	ControllerName           string
	ControllerNamespace      string
	APIServerHost            string
	APIServerQPS             int
	APIServerBurst           int
	KubeconfigPath           string
	CacheSyncPeriod          time.Duration
	CacheSyncTimeout         time.Duration
	ClusterCASecretName      string
	ClusterCASecretNamespace string
	ClusterCAKeyType         mgrconfig.KeyType
	ClusterCAKeySize         int
	LoggerOpts               *zap.Options
	EnforceConfig            bool
	ClusterDomain            string
	EmitKubernetesEvents     bool
	// SecretLabelSelector specifies the label which will be used to limit the ingestion of secrets. Only those that have this label set to "true" will be ingested.
	SecretLabelSelector string
	// ConfigMapLabelSelector specifies the label which will be used to limit the ingestion of configmaps. Only those that have this label set to "true" will be ingested.
	ConfigMapLabelSelector string
	// WatchNamespaces is a list of namespaces to watch. If empty (default), all namespaces are watched.
	WatchNamespaces []string

	// ServiceAccountToImpersonate is the name of the service account to impersonate,
	// by the controller manager, when making requests to the API server.
	// Use for testing purposes only.
	ServiceAccountToImpersonate string

	// controllers for standard APIs and features
	GatewayControllerEnabled            bool
	ControlPlaneControllerEnabled       bool
	DataPlaneControllerEnabled          bool
	DataPlaneBlueGreenControllerEnabled bool

	// Options for controlling features related to ControlPlanes.
	ControlPlaneConfigurationDumpEnabled bool
	ControlPlaneConfigurationDumpAddr    string

	// Controllers for specialty APIs and experimental features.
	AIGatewayControllerEnabled              bool
	KongPluginInstallationControllerEnabled bool
	KonnectSyncPeriod                       time.Duration
	KonnectMaxConcurrentReconciles          uint
	GatewayAPIExperimentalEnabled           bool
	ControlPlaneExtensionsControllerEnabled bool

	// Controllers for Konnect APIs.
	KonnectControllersEnabled bool

	// Webhook options.
	ConversionWebhookEnabled bool
	ValidatingWebhookEnabled bool
}

Config represents the configuration for the manager.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a default configuration for the manager.

type Controller

type Controller interface {
	SetupWithManager(context.Context, ctrl.Manager) error
}

Controller is a Kubernetes controller that can be plugged into Manager.

type ControllerDef

type ControllerDef struct {
	Enabled    bool
	Controller Controller
}

ControllerDef is a specification of a Controller that can be conditionally registered with Manager.

func SetupControllers

func SetupControllers(mgr manager.Manager, c *Config, cpsMgr *multiinstance.Manager) ([]ControllerDef, error)

SetupControllers returns a list of ControllerDefs based on config.

func (*ControllerDef) MaybeSetupWithManager

func (c *ControllerDef) MaybeSetupWithManager(ctx context.Context, mgr ctrl.Manager) error

MaybeSetupWithManager runs SetupWithManager on the controller if it is enabled and its AutoHandler (if any) indicates that it can load.

func (*ControllerDef) Name

func (c *ControllerDef) Name() string

Name returns a human-readable name of the controller.

type MetricsAccessFilter

type MetricsAccessFilter string

MetricsAccessFilter defines the access filter function for the metrics endpoint.

const (
	// MetricsAccessFilterOff disabled the access filter on metrics endpoint.
	MetricsAccessFilterOff MetricsAccessFilter = "off"
	// MetricsAccessFilterRBAC enables the access filter on metrics endpoint.
	// For more information consult:
	// https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/metrics/filters#WithAuthenticationAndAuthorization
	MetricsAccessFilterRBAC MetricsAccessFilter = "rbac"
)

func (*MetricsAccessFilter) Set

func (mf *MetricsAccessFilter) Set(v string) error

Set implements flag.Value.

func (MetricsAccessFilter) String

func (mf MetricsAccessFilter) String() string

String returns the string representation of the MetricsFilter.

type SetupControllersFunc

type SetupControllersFunc func(manager.Manager, *Config, *multiinstance.Manager) ([]ControllerDef, error)

SetupControllersFunc represents function to setup controllers, which is called in Run function.

Directories

Path Synopsis
Package metadata includes metadata variables for logging and reporting.
Package metadata includes metadata variables for logging and reporting.

Jump to

Keyboard shortcuts

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