prober

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: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultProbeInterval is the default duration representing the interval for a probe.
	DefaultProbeInterval = 10 * time.Second
	// DefaultProbeInitialDelay is the default duration representing an initial delay to start a probe.
	DefaultProbeInitialDelay = 30 * time.Second
	// DefaultScaleInitialDelay is the default duration representing an initial delay to start to scale up a kubernetes resource.
	DefaultScaleInitialDelay = 0 * time.Second
	// DefaultProbeTimeout is the default duration representing total timeout for a probe to complete.
	DefaultProbeTimeout = 30 * time.Second
	// DefaultBackoffJitterFactor is the default jitter value with which successive probe runs are scheduled.
	DefaultBackoffJitterFactor = 0.2
	// DefaultScaleUpdateTimeout is the default duration representing a timeout for the scale operation to complete.
	DefaultScaleUpdateTimeout = 30 * time.Second
	// DefaultNodeLeaseFailureFraction is used to determine the maximum number of node leases that can be expired for a node lease probe to succeed.
	// Eg:- 1. numberOfOwnedLeases = 10, numberOfExpiredLeases = 6.
	// 		   numberOfExpiredLeases/numberOfOwnedLeases = 0.6, which is >= DefaultNodeLeaseFailureFraction and so the lease probe will fail.
	//		2. numberOfOwnedLeases = 10, numberOfExpiredLeases = 5.
	//	 	   numberOfExpiredLeases/numberOfOwnedLeases = 0.5, which is < DefaultNodeLeaseFailureFraction and so the lease probe will succeed.
	DefaultNodeLeaseFailureFraction = 0.60
	// DefaultKCMNodeMonitorGraceDuration is set to the default value of nodeMonitorGracePeriod in KCM.
	// See https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/#:~:text=%2D%2Dnode%2Dmonitor%2Dgrace%2Dperiod%20duration
	// Note: Make sure to keep this value in sync with default value of nodeMonitorGracePeriod in KCM.
	DefaultKCMNodeMonitorGraceDuration = 40 * time.Second
)

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(file string, scheme *runtime.Scheme) (*papi.Config, error)

LoadConfig reads the prober configuration from a file, unmarshalls it, fills in the default values and validates the unmarshalled configuration If all validations pass it will return papi.Config else it will return an error.

Types

type Manager

type Manager interface {
	// Register registers the given prober with the manager. It should return false if prober is already registered.
	Register(prober Prober) bool
	// Unregister closes the prober and removes it from the manager. It should return false if prober is not registered with the manager.
	Unregister(key string) bool
	// GetProber uses the given key to get a registered prober from the manager. It returns false if prober is not found.
	GetProber(key string) (Prober, bool)
	// GetAllProbers returns a slice of all the probers registered with the manager.
	GetAllProbers() []Prober
}

Manager is the convenience interface to manage lifecycle of probers.

func NewManager

func NewManager() Manager

NewManager creates a new manager to manage probers.

type Prober

type Prober struct {
	// contains filtered or unexported fields
}

Prober represents a probe to the Kube ApiServer of a shoot

func NewProber

func NewProber(parentCtx context.Context, namespace string, config *papi.Config, scaler dwdScaler.Scaler, shootClientCreator ShootClientCreator, logger logr.Logger) *Prober

NewProber creates a new Prober

func (*Prober) Close

func (p *Prober) Close()

Close closes a probe

func (*Prober) GetConfig added in v1.2.0

func (p *Prober) GetConfig() *papi.Config

GetConfig returns the probe config for the prober.

func (*Prober) IsClosed

func (p *Prober) IsClosed() bool

IsClosed checks if the context of the prober is cancelled or not.

func (*Prober) Run

func (p *Prober) Run()

Run starts a probe which will run with a configured interval and jitter.

type ShootClientCreator

type ShootClientCreator interface {
	// CreateClient creates a new clientSet to connect to the Kube ApiServer running in the passed-in shoot control namespace.
	CreateClient(ctx context.Context, logger logr.Logger, namespace string, secretName string, connectionTimeout time.Duration) (kubernetes.Interface, error)
}

ShootClientCreator provides a facade to create kubernetes client targeting a shoot.

func NewShootClientCreator

func NewShootClientCreator(client client.Client) ShootClientCreator

NewShootClientCreator creates an instance of ShootClientCreator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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