gardener

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package gardener provides utilities related to Gardener specifics.

Index

Constants

View Source
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"

	// 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"
)

Variables

This section is empty.

Functions

func IsShootNamespace

func IsShootNamespace(namespace string) bool

IsShootNamespace determines whether the format of specified name implies that it is a shoot namespace in a seed cluster

func LeaderElectionNameID

func LeaderElectionNameID(name string) string

LeaderElectionNameID returns a leader election ID for the given name.

Types

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
}

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
	// 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 RESTConfig

type RESTConfig struct {
	// Config is the rest.Config.
	Config *rest.Config
}

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 NewRESTOptions

func NewRESTOptions() *RESTOptions

NewRESTOptions creates a new RESTOptions instances

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 WatchBuilder

type WatchBuilder []func(controller.Controller) error

WatchBuilder holds various functions which add watch controls to the passed Controller.

func (*WatchBuilder) AddToController

func (w *WatchBuilder) AddToController(ctrl controller.Controller) error

AddToController adds the registered watches to the passed controller.

func (*WatchBuilder) Register

func (w *WatchBuilder) Register(funcs ...func(controller.Controller) error)

Register adds a function which add watch controls to the passed Controller to the WatchBuilder.

Jump to

Keyboard shortcuts

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