Documentation ¶
Index ¶
- Constants
- Variables
- func CheckForExpiredNodeLeases(nodeList *corev1.NodeList, leaseList *coordinationv1.LeaseList, ...) error
- func CheckIfDependencyWatchdogProberScaledDownControllers(ctx context.Context, seedClient client.Client, shootNamespace string) ([]string, error)
- func CheckNodeAgentLeases(nodeList *corev1.NodeList, leaseList *coordinationv1.LeaseList, ...) error
- func CheckNodesScalingDown(machineList *machinev1alpha1.MachineList, nodeList *corev1.NodeList, ...) error
- func CheckNodesScalingUp(machineList *machinev1alpha1.MachineList, readyNodes, desiredMachines int) error
- func ComputeRequiredControlPlaneDeployments(shoot *gardencorev1beta1.Shoot) (sets.Set[string], error)
- func ComputeRequiredMonitoringSeedDeployments(shoot *gardencorev1beta1.Shoot) sets.Set[string]
- func ComputeRequiredMonitoringStatefulSets() sets.Set[string]
- func IsProblematicWebhook(failurePolicy *admissionregistrationv1.FailurePolicyType, ...) bool
- func PardonConditions(clock clock.Clock, conditions []gardencorev1beta1.Condition, ...) []gardencorev1beta1.Condition
- type Constraint
- func (c *Constraint) Check(ctx context.Context, constraints ShootConstraints) []gardencorev1beta1.Condition
- func (c *Constraint) CheckForProblematicWebhooks(ctx context.Context) (gardencorev1beta1.ConditionStatus, string, string, ...)
- func (c *Constraint) CheckIfCACertificateValiditiesAcceptable(ctx context.Context) (gardencorev1beta1.ConditionStatus, string, string, ...)
- type ConstraintCheck
- type GarbageCollection
- type GarbageCollector
- type Health
- type HealthCheck
- type NewConstraintCheckFunc
- type NewGarbageCollectorFunc
- type NewHealthCheckFunc
- type NewOperationFunc
- type NewWebhookRemediatorFunc
- type Reconciler
- func (r *Reconciler) AddToManager(mgr manager.Manager, gardenCluster cluster.Cluster) error
- func (r *Reconciler) EventHandler() handler.EventHandler
- func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)
- func (r *Reconciler) ShootPredicate() predicate.Predicate
- type ShootClientInit
- type ShootConditions
- type ShootConstraints
- type WebhookRemediation
- type WebhookRemediator
Constants ¶
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 )
const ControllerName = "shoot-care"
ControllerName is the name of this controller.
const GardenerDeletionGracePeriod = 5 * time.Minute
GardenerDeletionGracePeriod is the default grace period for Gardener's force deletion methods.
Variables ¶
var ( // NewOperation is used to create a new `operation.Operation` instance. NewOperation = defaultNewOperationFunc // NewHealthCheck is used to create a new Health check instance. NewHealthCheck = defaultNewHealthCheck // NewConstraintCheck is used to create a new Constraint check instance. NewConstraintCheck = defaultNewConstraintCheck // NewGarbageCollector is used to create a new garbage collection instance. NewGarbageCollector = defaultNewGarbageCollector // NewWebhookRemediator is used to create a new webhook remediation instance. NewWebhookRemediator = defaultNewWebhookRemediator )
var RandomDurationWithMetaDuration = utils.RandomDurationWithMetaDuration
RandomDurationWithMetaDuration is an alias for utils.RandomDurationWithMetaDuration.
Functions ¶
func CheckForExpiredNodeLeases ¶ added in v1.91.0
func CheckForExpiredNodeLeases(nodeList *corev1.NodeList, leaseList *coordinationv1.LeaseList, clock clock.Clock) error
CheckForExpiredNodeLeases checks if the number of expired node Leases surpasses 20% of all existing Leases. If yes, an error will be returned. The motivation is that dependency-watchdog is starting to scale down controllers when 60% of the Leases are expired.
func CheckIfDependencyWatchdogProberScaledDownControllers ¶ added in v1.91.0
func CheckIfDependencyWatchdogProberScaledDownControllers(ctx context.Context, seedClient client.Client, shootNamespace string) ([]string, error)
CheckIfDependencyWatchdogProberScaledDownControllers checks if controllers have been scaled down by dependency-watchdog-prober.
func CheckNodeAgentLeases ¶ added in v1.88.0
func CheckNodeAgentLeases(nodeList *corev1.NodeList, leaseList *coordinationv1.LeaseList, clock clock.Clock) error
CheckNodeAgentLeases checks if all nodes in the shoot cluster have a corresponding Lease object maintained by gardener-node-agent
func CheckNodesScalingDown ¶ added in v1.79.0
func CheckNodesScalingDown(machineList *machinev1alpha1.MachineList, nodeList *corev1.NodeList, registeredNodes, desiredMachines int) error
CheckNodesScalingDown returns an error if nodes are being scaled down.
func CheckNodesScalingUp ¶ added in v1.79.0
func CheckNodesScalingUp(machineList *machinev1alpha1.MachineList, readyNodes, desiredMachines int) error
CheckNodesScalingUp returns an error if nodes are being scaled up.
func ComputeRequiredControlPlaneDeployments ¶ added in v1.79.0
func ComputeRequiredControlPlaneDeployments(shoot *gardencorev1beta1.Shoot) (sets.Set[string], error)
ComputeRequiredControlPlaneDeployments returns names of required deployments based on the given shoot.
func ComputeRequiredMonitoringSeedDeployments ¶ added in v1.79.0
func ComputeRequiredMonitoringSeedDeployments(shoot *gardencorev1beta1.Shoot) sets.Set[string]
ComputeRequiredMonitoringSeedDeployments returns names of monitoring deployments based on the given shoot.
func ComputeRequiredMonitoringStatefulSets ¶ added in v1.79.0
ComputeRequiredMonitoringStatefulSets returns names of monitoring statefulsets based on the given shoot.
func IsProblematicWebhook ¶ added in v1.79.0
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 PardonConditions ¶ added in v1.79.0
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 ¶ added in v1.79.0
type Constraint struct {
// contains filtered or unexported fields
}
Constraint contains required information for shoot constraint checks.
func NewConstraint ¶ added in v1.79.0
func NewConstraint( log logr.Logger, shoot *shoot.Shoot, seedClient client.Client, shootClientInit ShootClientInit, clock clock.Clock, ) *Constraint
NewConstraint returns a new constraint instance.
func (*Constraint) Check ¶ added in v1.79.0
func (c *Constraint) Check( ctx context.Context, constraints ShootConstraints, ) []gardencorev1beta1.Condition
Check checks all given constraints.
func (*Constraint) CheckForProblematicWebhooks ¶ added in v1.79.0
func (c *Constraint) CheckForProblematicWebhooks(ctx context.Context) (gardencorev1beta1.ConditionStatus, string, string, []gardencorev1beta1.ErrorCode, error)
CheckForProblematicWebhooks checks the Shoot for problematic webhooks which could prevent shoot worker nodes from joining the cluster.
func (*Constraint) CheckIfCACertificateValiditiesAcceptable ¶ added in v1.79.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 ConstraintCheck ¶
type ConstraintCheck interface {
Check(context.Context, ShootConstraints) []gardencorev1beta1.Condition
}
ConstraintCheck is an interface used to perform constraint checks.
type GarbageCollection ¶ added in v1.79.0
type GarbageCollection struct {
// contains filtered or unexported fields
}
GarbageCollection contains required information for shoot and seed garbage collection.
func NewGarbageCollection ¶ added in v1.79.0
func NewGarbageCollection(op *operation.Operation, shootClientInit ShootClientInit) *GarbageCollection
NewGarbageCollection creates a new garbage collection instance.
func (*GarbageCollection) Collect ¶ added in v1.79.0
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 GarbageCollector ¶
GarbageCollector is an interface used to perform garbage collection.
type Health ¶ added in v1.79.0
type Health struct {
// contains filtered or unexported fields
}
Health contains information needed to execute shoot health checks.
func NewHealth ¶ added in v1.79.0
func NewHealth( log logr.Logger, shoot *shoot.Shoot, seed *seed.Seed, seedClientSet kubernetes.Interface, gardenClient client.Client, shootClientInit ShootClientInit, clock clock.Clock, gardenletConfig *gardenletconfig.GardenletConfiguration, conditionThresholds map[gardencorev1beta1.ConditionType]time.Duration, ) *Health
NewHealth creates a new Health instance with the given parameters.
func (*Health) Check ¶ added in v1.79.0
func (h *Health) Check( ctx context.Context, healthCheckOutdatedThreshold *metav1.Duration, conditions ShootConditions, ) []gardencorev1beta1.Condition
Check conducts the health checks on all the given conditions.
func (*Health) CheckClusterNodes ¶ added in v1.79.0
func (h *Health) CheckClusterNodes( ctx context.Context, shootClient kubernetes.Interface, condition gardencorev1beta1.Condition, ) ( *gardencorev1beta1.Condition, error, )
CheckClusterNodes checks whether cluster nodes are healthy and within the desired range. Additional checks are executed in the provider extension.
type HealthCheck ¶
type HealthCheck interface {
Check(ctx context.Context, threshold *metav1.Duration, conditions ShootConditions) []gardencorev1beta1.Condition
}
HealthCheck is an interface used to perform health checks.
type NewConstraintCheckFunc ¶
type NewConstraintCheckFunc func( log logr.Logger, shoot *shoot.Shoot, seedClient client.Client, shootClientInit ShootClientInit, clock clock.Clock, ) ConstraintCheck
NewConstraintCheckFunc is a function used to create a new instance for performing constraint checks.
type NewGarbageCollectorFunc ¶
type NewGarbageCollectorFunc func(op *operation.Operation, init ShootClientInit) GarbageCollector
NewGarbageCollectorFunc is a function used to create a new instance to perform garbage collection.
type NewHealthCheckFunc ¶
type NewHealthCheckFunc func( logger logr.Logger, shoot *shoot.Shoot, seed *seed.Seed, seedClient kubernetes.Interface, gardenClient client.Client, shootClientInit ShootClientInit, clock clock.Clock, gardenletConfig *gardenletconfig.GardenletConfiguration, conditionThresholds map[gardencorev1beta1.ConditionType]time.Duration, ) HealthCheck
NewHealthCheckFunc is a function used to create a new instance for performing health checks.
type NewOperationFunc ¶
type NewOperationFunc func( ctx context.Context, log logr.Logger, gardenClient client.Client, seedClientSet kubernetes.Interface, shootClientMap clientmap.ClientMap, config *gardenletconfig.GardenletConfiguration, gardenerInfo *gardencorev1beta1.Gardener, gardenClusterIdentity string, secrets map[string]*corev1.Secret, shoot *gardencorev1beta1.Shoot, ) ( *operation.Operation, error, )
NewOperationFunc is a function used to create a new `operation.Operation` instance.
type NewWebhookRemediatorFunc ¶
type NewWebhookRemediatorFunc func(op *operation.Operation, init ShootClientInit) WebhookRemediator
NewWebhookRemediatorFunc is a function used to create a new instance to perform webhook remediation.
type Reconciler ¶
type Reconciler struct { GardenClient client.Client SeedClientSet kubernetes.Interface ShootClientMap clientmap.ClientMap Config config.GardenletConfiguration Clock clock.Clock Identity *gardencorev1beta1.Gardener GardenClusterIdentity string SeedName string // contains filtered or unexported fields }
Reconciler reconciles Shoot resources and executes care operations, e.g. health checks or garbage collection.
func (*Reconciler) AddToManager ¶
AddToManager adds Reconciler to the given manager.
func (*Reconciler) EventHandler ¶
func (r *Reconciler) EventHandler() handler.EventHandler
EventHandler returns a handler for Shoot events.
func (*Reconciler) Reconcile ¶
func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)
Reconcile executes care operations, e.g. health checks or garbage collection.
func (*Reconciler) ShootPredicate ¶
func (r *Reconciler) ShootPredicate() predicate.Predicate
ShootPredicate is a predicate which returns 'true' for create events, and for update events in case the shoot was successfully reconciled.
type ShootClientInit ¶ added in v1.79.0
type ShootClientInit func() (kubernetes.Interface, bool, error)
ShootClientInit is a function that initializes a kubernetes client for a Shoot.
type ShootConditions ¶ added in v1.79.0
type ShootConditions struct {
// contains filtered or unexported fields
}
ShootConditions contains all shoot related conditions of the shoot status subresource.
func NewShootConditions ¶ added in v1.79.0
func NewShootConditions(clock clock.Clock, shoot *gardencorev1beta1.Shoot) ShootConditions
NewShootConditions returns a new instance of ShootConditions. All conditions are retrieved from the given 'shoot' or newly initialized.
func (ShootConditions) ConditionTypes ¶ added in v1.79.0
func (s ShootConditions) ConditionTypes() []gardencorev1beta1.ConditionType
ConditionTypes returns all shoot condition types.
func (ShootConditions) ConvertToSlice ¶ added in v1.79.0
func (s ShootConditions) ConvertToSlice() []gardencorev1beta1.Condition
ConvertToSlice returns the shoot conditions as a slice.
type ShootConstraints ¶ added in v1.79.0
type ShootConstraints struct {
// contains filtered or unexported fields
}
ShootConstraints contains all constraints of the shoot status subresource.
func NewShootConstraints ¶ added in v1.79.0
func NewShootConstraints(clock clock.Clock, shoot *gardencorev1beta1.Shoot) ShootConstraints
NewShootConstraints returns a new instance of ShootConstraints. All constraints are retrieved from the given 'shoot' or newly initialized.
func (ShootConstraints) ConstraintTypes ¶ added in v1.79.0
func (g ShootConstraints) ConstraintTypes() []gardencorev1beta1.ConditionType
ConstraintTypes returns all shoot constraint types.
func (ShootConstraints) ConvertToSlice ¶ added in v1.79.0
func (g ShootConstraints) ConvertToSlice() []gardencorev1beta1.Condition
ConvertToSlice returns the shoot constraints as a slice.
type WebhookRemediation ¶ added in v1.79.0
type WebhookRemediation struct {
// contains filtered or unexported fields
}
WebhookRemediation contains required information for shoot webhook remediation.
func NewWebhookRemediation ¶ added in v1.79.0
func NewWebhookRemediation(log logr.Logger, shoot *gardencorev1beta1.Shoot, shootClientInit ShootClientInit) *WebhookRemediation
NewWebhookRemediation creates a new instance for webhook remediation.
type WebhookRemediator ¶
WebhookRemediator is an interface used to perform webhook remediation.