cmd

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Commands is a list of possible commands that could be run
	Commands = []*Command{
		ProberCmd,
		WeederCmd,
	}
)
View Source
var (
	// ProberCmd stores info about using the prober command
	ProberCmd = &Command{
		Name:      "prober",
		UsageLine: "",
		ShortDesc: "Probes Kubernetes API and Scales Up/Down dependent resources based on its reachability",
		LongDesc: `For each shoot cluster it will start a probe which periodically probes the API server via an internal and an external endpoint. 
If the API server continues to be un-reachable beyond a threshold then it scales down the dependent controllers. Once the API 
server is again reachable then it will restore by scaling up the dependent controllers.

Flags:
	--config-file
		Path of the configuration file containing probe configuration and scaling controller-reference information
	--kubeconfig
		Path to the kubeconfig file. If not specified, then it will default to the service account token to connect to the kube-api-server
	--concurrent-reconciles
		Maximum number of concurrent reconciles which can be run. <optional>
	--leader-election-namespace
		Namespace in which leader election namespace will be created. This is typically the same namespace where DWD controllers are deployed.
	--enable-leader-election
		Determines if the leader election needs to be enabled.
	--leader-elect-renew-deadline
		Interval between attempts by the acting master to renew a leadership slot
	--leader-elect-retry-period
		The duration the clients should wait between attempting acquisition and renewal
	--kube-api-qps
		Maximum QPS to the API server from this client.
	--kube-api-burst
		Maximum burst over the QPS
	--metrics-bind-address
		TCP address that the controller should bind to for serving prometheus metrics
	--health-bind-address
		TCP address that the controller should bind to for serving health probes
`,
		AddFlags: addProbeFlags,
		Run:      startClusterControllerMgr,
	}
)
View Source
var (
	// WeederCmd stores info about the weeder command
	WeederCmd = &Command{
		Name:      "weeder",
		UsageLine: "",
		ShortDesc: "Restarts CrashLooping pods which are dependant on a service , for quick recovery ensuring maximum availability",
		LongDesc: `Watches for Kubernetes endpoints for a service. If the endpoints transition from being
unavailable to now being available, it checks all dependent pods for CrashLoopBackOff condition. It attempts to
restore these dependent pods by deleting them so that they are started again by respective controller. In essence
it weeds out the bad pods.

Flags:
	--kubeconfig
		Path to the kubeconfig file. If not specified, then it will default to the service account token to connect to the kube-api-server	
	--config-file
		Path of the configuration file containing probe configuration and scaling controller-reference information
	--concurrent-reconciles
		Maximum number of concurrent reconciles which can be run. <optional>
	--leader-election-namespace
		Namespace in which leader election namespace will be created. This is typically the same namespace where DWD controllers are deployed.
	--enable-leader-election
		Determines if the leader election needs to be enabled.
	--leader-elect-renew-deadline
		Interval between attempts by the acting master to renew a leadership slot
	--leader-elect-retry-period
		The duration the clients should wait between attempting acquisition and renewal
	--kube-api-qps
		Maximum QPS to the API server from this client.
	--kube-api-burst
		Maximum burst over the QPS
	--metrics-bind-address
		TCP address that the controller should bind to for serving prometheus metrics
	--health-bind-address
		TCP address that the controller should bind to for serving health probes
`,
		AddFlags: addWeederFlags,
		Run:      startEndpointsControllerMgr,
	}
)

Functions

func PrintCliUsage added in v1.0.0

func PrintCliUsage(w io.Writer)

PrintCliUsage prints the CLI usage text to the passed io.Writer

func PrintHelp added in v1.0.0

func PrintHelp(cmdName string, w io.Writer)

PrintHelp prints out the help text for the passed in command

func SetSharedOpts added in v1.0.0

func SetSharedOpts(fs *flag.FlagSet, opts *SharedOpts)

SetSharedOpts helps in defining the location where the command flag values would be stored, it also defines default values for the flags.

Types

type Command added in v1.0.0

type Command struct {
	Name      string
	UsageLine string
	ShortDesc string
	LongDesc  string
	AddFlags  func(fs *flag.FlagSet)
	Run       func(logger logr.Logger) (manager.Manager, error)
}

Command defines a command with all its required properties

type LeaderElectionOpts added in v1.0.0

type LeaderElectionOpts struct {
	// Enable enables a leader election client to gain leadership
	// before executing the main loop. Enable this when running replicated
	// components for high availability. By default, it is false
	Enable bool
	// Namespace is the namespace in which leader election resource will be created
	Namespace string
	// LeaseDuration is the duration that non-leader candidates will wait
	// after observing a leadership renewal until attempting to acquire
	// leadership of a leader but un-renewed leader slot. This is effectively the
	// maximum duration that a leader can be stopped before it is replaced
	// by another candidate. This is only applicable if leader election is
	// enabled.
	LeaseDuration time.Duration
	// RenewDeadline is the interval between attempts by the acting leader to
	// renew a leadership slot before it stops leading. This must be less
	// than or equal to the lease duration. This is only applicable if leader
	// election is enabled.
	RenewDeadline time.Duration
	// RetryPeriod is the duration the clients should wait between attempting
	// acquisition and renewal of a leadership. This is only applicable if
	// leader election is enabled.
	RetryPeriod time.Duration
}

LeaderElectionOpts defines the configuration of leader election clients for components that can run with leader election enabled.

type SharedOpts added in v1.0.0

type SharedOpts struct {
	// ConfigFile is the command specific configuration file path which is typically a mounted config-map YAML file
	ConfigFile string
	// ConcurrentReconciles is the maximum number of concurrent reconciles which can be run
	ConcurrentReconciles int
	// leaderElection defines the configuration of leader election client.
	LeaderElection LeaderElectionOpts
	// KubeApiBurst is the maximum burst over the QPS
	KubeApiBurst int
	// KubeApiQps indicates the maximum QPS to the API server from this client
	KubeApiQps float64
	// 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
}

SharedOpts are the flags which bother prober and weeder have in common

Jump to

Keyboard shortcuts

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