Documentation ¶
Index ¶
- Constants
- Variables
- func LeaderElectionNameID(name string) string
- type Completer
- type ControllerConfig
- type ControllerOptions
- type Flagger
- type GeneralConfig
- type GeneralOptions
- type ManagerConfig
- type ManagerOptions
- type NameToAddToManagerFunc
- type Option
- type OptionAggregator
- type RESTConfig
- type RESTOptions
- type ReconcilerConfig
- type ReconcilerOptions
- type SwitchConfig
- type SwitchOptions
Constants ¶
const ( // LeaderElectionFlag is the name of the command line flag to specify whether to do leader election or not. LeaderElectionFlag = "leader-election" // LeaderElectionResourceLockFlag is the name of the command line flag to specify the resource type used for leader // election. LeaderElectionResourceLockFlag = "leader-election-resource-lock" // LeaderElectionIDFlag is the name of the command line flag to specify the leader election ID. LeaderElectionIDFlag = "leader-election-id" // LeaderElectionNamespaceFlag is the name of the command line flag to specify the leader election namespace. LeaderElectionNamespaceFlag = "leader-election-namespace" // WebhookServerHostFlag is the name of the command line flag to specify the webhook config host for 'url' mode. WebhookServerHostFlag = "webhook-config-server-host" // WebhookServerPortFlag is the name of the command line flag to specify the webhook server port. WebhookServerPortFlag = "webhook-config-server-port" // WebhookCertDirFlag is the name of the command line flag to specify the webhook certificate directory. WebhookCertDirFlag = "webhook-config-cert-dir" // MetricsBindAddressFlag is the name of the command line flag to specify the TCP address that the controller // should bind to for serving prometheus metrics. // It can be set to "0" to disable the metrics serving. MetricsBindAddressFlag = "metrics-bind-address" // HealthBindAddressFlag is the name of the command line flag to specify the TCP address that the controller // should bind to for serving health probes HealthBindAddressFlag = "health-bind-address" // MaxConcurrentReconcilesFlag is the name of the command line flag to specify the maximum number of // concurrent reconciliations a controller can do. MaxConcurrentReconcilesFlag = "max-concurrent-reconciles" // KubeconfigFlag is the name of the command line flag to specify a kubeconfig used to retrieve // a rest.Config for a manager.Manager. KubeconfigFlag = clientcmd.RecommendedConfigPathFlag // MasterURLFlag is the name of the command line flag to specify the master URL override for // a rest.Config of a manager.Manager. MasterURLFlag = "master" // DisableFlag is the name of the command line flag to disable individual controllers. DisableFlag = "disable-controllers" // GardenerVersionFlag is the name of the command line flag containing the Gardener version. GardenerVersionFlag = "gardener-version" // GardenletManagesMCMFlag is the name of the command line flag containing the Gardener version. // TODO(rfranzke): Remove this flag when all provider extensions support the feature, see https://github.com/gardener/gardener/issues/7594. GardenletManagesMCMFlag = "gardenlet-manages-mcm" // LogLevelFlag is the name of the command line flag containing the log level. LogLevelFlag = "log-level" // LogFormatFlag is the name of the command line flag containing the log format. LogFormatFlag = "log-format" )
const ( // IgnoreOperationAnnotationFlag is the name of the command line flag to specify whether the operation annotation // is ignored or not. IgnoreOperationAnnotationFlag = "ignore-operation-annotation" )
Variables ¶
var ( // BuildConfigFromFlags creates a build configuration from the given flags. Exposed for testing. BuildConfigFromFlags = clientcmd.BuildConfigFromFlags // InClusterConfig obtains the current in-cluster config. Exposed for testing. InClusterConfig = rest.InClusterConfig // Getenv obtains the environment variable with the given name. Exposed for testing. Getenv = os.Getenv // RecommendedHomeFile is the recommended location of the kubeconfig. Exposed for testing. RecommendedHomeFile = clientcmd.RecommendedHomeFile )
Functions ¶
func LeaderElectionNameID ¶
LeaderElectionNameID returns a leader election ID for the given name.
Types ¶
type Completer ¶
type Completer interface { // Complete completes the work, optionally returning an error. Complete() error }
Completer completes some work.
type ControllerConfig ¶
type ControllerConfig struct { // MaxConcurrentReconciles is the maximum number of concurrent reconciles. MaxConcurrentReconciles int }
ControllerConfig is a completed controller configuration.
func (*ControllerConfig) Apply ¶
func (c *ControllerConfig) Apply(opts *controller.Options)
Apply sets the values of this ControllerConfig in the given controller.Options.
func (*ControllerConfig) Options ¶
func (c *ControllerConfig) Options() controller.Options
Options initializes empty controller.Options, applies the set values and returns it.
type ControllerOptions ¶
type ControllerOptions struct { // MaxConcurrentReconciles are the maximum concurrent reconciles. MaxConcurrentReconciles int // contains filtered or unexported fields }
ControllerOptions are command line options that can be set for controller.Options.
func (*ControllerOptions) AddFlags ¶
func (c *ControllerOptions) AddFlags(fs *pflag.FlagSet)
AddFlags implements Flagger.AddFlags.
func (*ControllerOptions) Complete ¶
func (c *ControllerOptions) Complete() error
Complete implements Completer.Complete.
func (*ControllerOptions) Completed ¶
func (c *ControllerOptions) Completed() *ControllerConfig
Completed returns the completed ControllerConfig. Only call this if `Complete` was successful.
type Flagger ¶
type Flagger interface { // AddFlags adds the flags of this Flagger to the given FlagSet. AddFlags(*pflag.FlagSet) }
Flagger adds flags to a given FlagSet.
func PrefixFlagger ¶
PrefixFlagger creates a flagger that prefixes all its flags with the given prefix.
type GeneralConfig ¶ added in v1.39.0
type GeneralConfig struct { // GardenerVersion is the version of the Gardener. GardenerVersion string // GardenletManagesMCM specifies whether gardenlet manages the machine-controller-manager. GardenletManagesMCM bool }
GeneralConfig is a completed general configuration.
type GeneralOptions ¶ added in v1.39.0
type GeneralOptions struct { // GardenerVersion is the version of the Gardener. GardenerVersion string // GardenletManagesMCM specifies whether gardenlet manages the machine-controller-manager. GardenletManagesMCM bool // contains filtered or unexported fields }
GeneralOptions are command line options that can be set for general configuration.
func (*GeneralOptions) AddFlags ¶ added in v1.39.0
func (r *GeneralOptions) AddFlags(fs *pflag.FlagSet)
AddFlags implements Flagger.AddFlags.
func (*GeneralOptions) Complete ¶ added in v1.39.0
func (r *GeneralOptions) Complete() error
Complete implements Complete.
func (*GeneralOptions) Completed ¶ added in v1.39.0
func (r *GeneralOptions) Completed() *GeneralConfig
Completed returns the completed GeneralConfig. Only call this if `Complete` was successful.
type ManagerConfig ¶
type ManagerConfig struct { // LeaderElection is whether leader election is turned on or not. LeaderElection bool // LeaderElectionResourceLock is the resource type used for leader election. LeaderElectionResourceLock string // LeaderElectionID is the id to do leader election with. LeaderElectionID string // LeaderElectionNamespace is the namespace to do leader election in. LeaderElectionNamespace string // WebhookServerHost is the host for the webhook server. WebhookServerHost string // WebhookServerPort is the port for the webhook server. WebhookServerPort int // WebhookCertDir is the directory that contains the webhook server key and certificate. WebhookCertDir string // MetricsBindAddress is the TCP address that the controller should bind to for serving prometheus metrics. MetricsBindAddress string // HealthBindAddress is the TCP address that the controller should bind to for serving health probes. HealthBindAddress string // Logger is a logr.Logger compliant logger Logger logr.Logger }
ManagerConfig is a completed manager configuration.
func (*ManagerConfig) Apply ¶
func (c *ManagerConfig) Apply(opts *manager.Options)
Apply sets the values of this ManagerConfig in the given manager.Options.
func (*ManagerConfig) Options ¶
func (c *ManagerConfig) Options() manager.Options
Options initializes empty manager.Options, applies the set values and returns it.
type ManagerOptions ¶
type ManagerOptions struct { // LeaderElection is whether leader election is turned on or not. LeaderElection bool // LeaderElectionResourceLock is the resource type used for leader election (defaults to `leases`). // // When changing the default resource lock, please make sure to migrate via multilocks to // avoid situations where multiple running instances of your controller have each acquired leadership // through different resource locks (e.g. during upgrades) and thus act on the same resources concurrently. // For example, if you want to migrate to the "leases" resource lock, you might do so by migrating // to the respective multilock first ("configmapsleases" or "endpointsleases"), which will acquire // a leader lock on both resources. After one release with the multilock as a default, you can // go ahead and migrate to "leases". Please also keep in mind, that users might skip versions // of your controller, so at least add a flashy release note when changing the default lock. // // Note: before controller-runtime version v0.7, the resource lock was set to "configmaps". // Please keep this in mind, when planning a proper migration path for your controller. LeaderElectionResourceLock string // LeaderElectionID is the id to do leader election with. LeaderElectionID string // LeaderElectionNamespace is the namespace to do leader election in. LeaderElectionNamespace string // WebhookServerHost is the host for the webhook server. WebhookServerHost string // WebhookServerPort is the port for the webhook server. WebhookServerPort int // WebhookCertDir is the directory that contains the webhook server key and certificate. WebhookCertDir string // MetricsBindAddress is the TCP address that the controller should bind to for serving prometheus metrics. MetricsBindAddress string // HealthBindAddress is the TCP address that the controller should bind to for serving health probes. HealthBindAddress string // LogLevel defines the level/severity for the logs. Must be one of [info,debug,error] LogLevel string // LogFormat defines the format for the logs. Must be one of [json,text] LogFormat string // contains filtered or unexported fields }
ManagerOptions are command line options that can be set for manager.Options.
func (*ManagerOptions) AddFlags ¶
func (m *ManagerOptions) AddFlags(fs *pflag.FlagSet)
AddFlags implements Flagger.AddFlags.
func (*ManagerOptions) Complete ¶
func (m *ManagerOptions) Complete() error
Complete implements Completer.Complete.
func (*ManagerOptions) Completed ¶
func (m *ManagerOptions) Completed() *ManagerConfig
Completed returns the completed ManagerConfig. Only call this if `Complete` was successful.
type NameToAddToManagerFunc ¶
NameToAddToManagerFunc binds a specific name to a controller's AddToManager function.
type Option ¶
Option is a Flagger and Completer. It sets command line flags and does some work when the flags have been parsed, optionally producing an error.
func PrefixOption ¶
PrefixOption creates an option that prefixes all its flags with the given prefix.
type OptionAggregator ¶
type OptionAggregator []Option
OptionAggregator is a builder that aggregates multiple options.
func NewOptionAggregator ¶
func NewOptionAggregator(options ...Option) OptionAggregator
NewOptionAggregator instantiates a new OptionAggregator and registers all given options.
func (*OptionAggregator) AddFlags ¶
func (b *OptionAggregator) AddFlags(fs *pflag.FlagSet)
AddFlags implements Flagger.AddFlags.
func (*OptionAggregator) Complete ¶
func (b *OptionAggregator) Complete() error
Complete implements Completer.Complete.
func (*OptionAggregator) Register ¶
func (b *OptionAggregator) Register(options ...Option)
Register registers the given options in this OptionAggregator.
type RESTConfig ¶
RESTConfig is a completed REST configuration.
type RESTOptions ¶
type RESTOptions struct { // Kubeconfig is the path to a kubeconfig. Kubeconfig string // MasterURL is an override for the URL in a kubeconfig. Only used if out-of-cluster. MasterURL string // contains filtered or unexported fields }
RESTOptions are command line options that can be set for rest.Config.
func (*RESTOptions) AddFlags ¶
func (r *RESTOptions) AddFlags(fs *pflag.FlagSet)
AddFlags implements Flagger.AddFlags.
func (*RESTOptions) Complete ¶
func (r *RESTOptions) Complete() error
Complete implements RESTCompleter.Complete.
func (*RESTOptions) Completed ¶
func (r *RESTOptions) Completed() *RESTConfig
Completed returns the completed RESTConfig. Only call this if `Complete` was successful.
type ReconcilerConfig ¶
type ReconcilerConfig struct { // IgnoreOperationAnnotation defines whether to ignore the operation annotation or not. IgnoreOperationAnnotation bool }
ReconcilerConfig is a completed controller configuration.
func (*ReconcilerConfig) Apply ¶
func (c *ReconcilerConfig) Apply(ignore *bool)
Apply sets the values of this ReconcilerConfig in the given controller.Options.
type ReconcilerOptions ¶
type ReconcilerOptions struct { // IgnoreOperationAnnotation defines whether to ignore the operation annotation or not. IgnoreOperationAnnotation bool // contains filtered or unexported fields }
ReconcilerOptions are command line options that can be set for controller.Options.
func (*ReconcilerOptions) AddFlags ¶
func (c *ReconcilerOptions) AddFlags(fs *pflag.FlagSet)
AddFlags implements Flagger.AddFlags.
func (*ReconcilerOptions) Complete ¶
func (c *ReconcilerOptions) Complete() error
Complete implements Completer.Complete.
func (*ReconcilerOptions) Completed ¶
func (c *ReconcilerOptions) Completed() *ReconcilerConfig
Completed returns the completed ReconcilerConfig. Only call this if `Complete` was successful.
type SwitchConfig ¶
SwitchConfig is the completed configuration of SwitchOptions.
type SwitchOptions ¶
type SwitchOptions struct { Disabled []string // contains filtered or unexported fields }
SwitchOptions are options to build an AddToManager function that filters the disabled controllers.
func NewSwitchOptions ¶
func NewSwitchOptions(pairs ...NameToAddToManagerFunc) *SwitchOptions
NewSwitchOptions creates new SwitchOptions with the given initial pairs.
func (*SwitchOptions) AddFlags ¶
func (d *SwitchOptions) AddFlags(fs *pflag.FlagSet)
AddFlags implements Option.
func (*SwitchOptions) Complete ¶
func (d *SwitchOptions) Complete() error
Complete implements Option.
func (*SwitchOptions) Completed ¶
func (d *SwitchOptions) Completed() *SwitchConfig
Completed returns the completed SwitchConfig. Call this only after successfully calling `Completed`.
func (*SwitchOptions) Register ¶
func (d *SwitchOptions) Register(pairs ...NameToAddToManagerFunc)
Register registers the given NameToControllerFuncs in the options.