care

package
v1.72.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 63 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WebhookMaximumTimeoutSecondsNotProblematic is the maximum timeout in seconds a webhooks on critical resources can
	// have in order to not be considered as a problematic webhook by the constraints checks. Any webhook on critical
	// resources with a larger timeout is considered to be problematic.
	WebhookMaximumTimeoutSecondsNotProblematic = 15
	// WebhookMaximumTimeoutSecondsNotProblematicForLeases is the maximum timeout in seconds a webhooks on lease resources in
	// kube-system namespace can have in order to not be considered as a problematic webhook by the constraints checks.
	// Any webhook on lease resources in kube-system namespace with a larger timeout can break leader election of essential
	// control plane controllers.
	WebhookMaximumTimeoutSecondsNotProblematicForLeases = 3
)
View Source
const GardenerDeletionGracePeriod = 5 * time.Minute

GardenerDeletionGracePeriod is the default grace period for Gardener's force deletion methods.

Variables

This section is empty.

Functions

func IsProblematicWebhook

func IsProblematicWebhook(
	failurePolicy *admissionregistrationv1.FailurePolicyType,
	objSelector *metav1.LabelSelector,
	nsSelector *metav1.LabelSelector,
	rules []admissionregistrationv1.RuleWithOperations,
	timeoutSeconds *int32,
) bool

IsProblematicWebhook checks if a single webhook of the Shoot Cluster is problematic. Problematic webhooks are webhooks with rules for CREATE/UPDATE/* pods or nodes and failurePolicy=Fail/nil. If the Shoot contains such a webhook, we can never wake up this shoot cluster again as new nodes cannot get created/ready, or our system component pods cannot get created/ready (because the webhook's backing pod is not yet running).

func NewConditionOrError

func NewConditionOrError(clock clock.Clock, oldCondition gardencorev1beta1.Condition, newCondition *gardencorev1beta1.Condition, err error) gardencorev1beta1.Condition

NewConditionOrError returns the given new condition or returns an unknown error condition if an error occurred or `newCondition` is nil.

func PardonConditions

func PardonConditions(clock clock.Clock, conditions []gardencorev1beta1.Condition, lastOp *gardencorev1beta1.LastOperation, lastErrors []gardencorev1beta1.LastError) []gardencorev1beta1.Condition

PardonConditions pardons the given condition if the Shoot is either in create (except successful create) or delete state.

Types

type Constraint

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

Constraint contains required information for shoot constraint checks.

func NewConstraint

func NewConstraint(clock clock.Clock, op *operation.Operation, shootClientInit ShootClientInit) *Constraint

NewConstraint returns a new constraint instance.

func (*Constraint) Check

Check checks all given constraints.

func (*Constraint) CheckForProblematicWebhooks

CheckForProblematicWebhooks checks the Shoot for problematic webhooks which could prevent shoot worker nodes from joining the cluster.

func (*Constraint) CheckIfCACertificateValiditiesAcceptable added in v1.50.0

func (c *Constraint) CheckIfCACertificateValiditiesAcceptable(ctx context.Context) (gardencorev1beta1.ConditionStatus, string, string, []gardencorev1beta1.ErrorCode, error)

CheckIfCACertificateValiditiesAcceptable checks whether there are CA certificates which are expiring in less than a year.

type ExtensionCondition

type ExtensionCondition struct {
	Condition          gardencorev1beta1.Condition
	ExtensionType      string
	ExtensionName      string
	ExtensionNamespace string
	LastHeartbeatTime  *metav1.MicroTime
}

ExtensionCondition contains information about the extension type, name, namespace and the respective condition object.

type GarbageCollection

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

GarbageCollection contains required information for shoot and seed garbage collection.

func NewGarbageCollection

func NewGarbageCollection(op *operation.Operation, shootClientInit ShootClientInit) *GarbageCollection

NewGarbageCollection creates a new garbage collection instance.

func (*GarbageCollection) Collect

func (g *GarbageCollection) Collect(ctx context.Context)

Collect cleans the Seed and the Shoot cluster from no longer required objects. It receives a botanist object <botanist> which stores the Shoot object.

type Health

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

Health contains information needed to execute shoot health checks.

func NewHealth

func NewHealth(op *operation.Operation, shootClientInit ShootClientInit, clock clock.Clock) *Health

NewHealth creates a new Health instance with the given parameters.

func (*Health) Check

func (h *Health) Check(
	ctx context.Context,
	thresholdMappings map[gardencorev1beta1.ConditionType]time.Duration,
	healthCheckOutdatedThreshold *metav1.Duration,
	conditions []gardencorev1beta1.Condition,
) []gardencorev1beta1.Condition

Check conducts the health checks on all the given conditions.

type HealthChecker

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

HealthChecker contains the condition thresholds.

func NewHealthChecker

func NewHealthChecker(
	reader client.Reader,
	clock clock.Clock,
	conditionThresholds map[gardencorev1beta1.ConditionType]time.Duration,
	healthCheckOutdatedThreshold *metav1.Duration,
	managedResourceProgressingThreshold *metav1.Duration,
	lastOperation *gardencorev1beta1.LastOperation,
	kubernetesVersion *semver.Version,
	gardenerVersion *semver.Version,
) *HealthChecker

NewHealthChecker creates a new health checker.

func (*HealthChecker) CheckClusterNodes

func (b *HealthChecker) CheckClusterNodes(
	ctx context.Context,
	shootClient client.Client,
	workers []gardencorev1beta1.Worker,
	condition gardencorev1beta1.Condition,
) (
	*gardencorev1beta1.Condition,
	error,
)

CheckClusterNodes checks whether cluster nodes in the given listers are healthy and within the desired range. Additional checks are executed in the provider extension

func (*HealthChecker) CheckControlPlane

func (b *HealthChecker) CheckControlPlane(
	ctx context.Context,
	shoot *gardencorev1beta1.Shoot,
	namespace string,
	condition gardencorev1beta1.Condition,
) (
	*gardencorev1beta1.Condition,
	error,
)

CheckControlPlane checks whether the control plane components in the given listers are complete and healthy.

func (*HealthChecker) CheckExtensionCondition

func (b *HealthChecker) CheckExtensionCondition(condition gardencorev1beta1.Condition, extensionsConditions []ExtensionCondition) *gardencorev1beta1.Condition

CheckExtensionCondition checks whether the conditions provided by extensions are healthy.

func (*HealthChecker) CheckLoggingControlPlane

func (b *HealthChecker) CheckLoggingControlPlane(
	ctx context.Context,
	namespace string,
	isTestingShoot bool,
	eventLoggingEnabled bool,
	valiEnabled bool,
	condition gardencorev1beta1.Condition,
) (
	*gardencorev1beta1.Condition,
	error,
)

CheckLoggingControlPlane checks whether the logging components in the given listers are complete and healthy.

func (*HealthChecker) CheckManagedResource

CheckManagedResource checks the conditions of the given managed resource and reflects the state in the returned condition.

func (*HealthChecker) CheckMonitoringControlPlane

func (b *HealthChecker) CheckMonitoringControlPlane(
	ctx context.Context,
	shoot *gardencorev1beta1.Shoot,
	namespace string,
	shootMonitoringEnabled bool,
	wantsAlertmanager bool,
	condition gardencorev1beta1.Condition,
) (
	*gardencorev1beta1.Condition,
	error,
)

CheckMonitoringControlPlane checks whether the monitoring in the given listers are complete and healthy.

func (*HealthChecker) FailedCondition

func (b *HealthChecker) FailedCondition(condition gardencorev1beta1.Condition, reason, message string, codes ...gardencorev1beta1.ErrorCode) gardencorev1beta1.Condition

FailedCondition returns a progressing or false condition depending on the progressing threshold.

type SeedHealth added in v1.47.0

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

SeedHealth contains information needed to execute health checks for seed.

func NewHealthForSeed added in v1.47.0

func NewHealthForSeed(seed *gardencorev1beta1.Seed, seedClient client.Client, clock clock.Clock, namespace *string, seedIsGarden bool, loggingEnabled bool) *SeedHealth

NewHealthForSeed creates a new Health instance with the given parameters.

func (*SeedHealth) CheckSeed added in v1.47.0

func (h *SeedHealth) CheckSeed(
	ctx context.Context,
	conditions []gardencorev1beta1.Condition,
	thresholdMappings map[gardencorev1beta1.ConditionType]time.Duration,
) []gardencorev1beta1.Condition

CheckSeed conducts the health checks on all the given conditions.

type ShootClientInit

type ShootClientInit func() (kubernetes.Interface, bool, error)

ShootClientInit is a function that initializes a kubernetes client for a Shoot.

type WebhookRemediation added in v1.50.0

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

WebhookRemediation contains required information for shoot webhook remediation.

func NewWebhookRemediation added in v1.50.0

func NewWebhookRemediation(op *operation.Operation, shootClientInit ShootClientInit) *WebhookRemediation

NewWebhookRemediation creates a new instance for webhook remediation.

func (*WebhookRemediation) Remediate added in v1.50.0

func (r *WebhookRemediation) Remediate(ctx context.Context) error

Remediate mutates shoot webhooks not following the best practices documented by Kubernetes.

Jump to

Keyboard shortcuts

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