criticalcomponents

package
v1.98.5 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const ControllerName = "node-critical-components"

ControllerName is the name of the controller.

Variables

This section is empty.

Functions

func AllCSINodeDriversAreReady

func AllCSINodeDriversAreReady(log logr.Logger, recorder record.EventRecorder, node *corev1.Node, requiredDrivers, existingDrivers sets.Set[string]) bool

AllCSINodeDriversAreReady compares a set of required drivers (i.e. drivers that are specified by csi-driver-node pods) with a set of existing drivers (i.e. drivers for which the CSINode object had information stored in spec). Either set could be empty.

func AllNodeCriticalDaemonPodsAreScheduled

func AllNodeCriticalDaemonPodsAreScheduled(log logr.Logger, recorder record.EventRecorder, node *corev1.Node, daemonSets []appsv1.DaemonSet, nodeCriticalPods []corev1.Pod) bool

AllNodeCriticalDaemonPodsAreScheduled returns true if all node-critical DaemonSets that should be scheduled to the given node have been scheduled. It uses ownerReferences of the given node-critical pods on the node for this check.

func AllNodeCriticalPodsAreReady

func AllNodeCriticalPodsAreReady(log logr.Logger, recorder record.EventRecorder, node *corev1.Node, nodeCriticalPods []corev1.Pod) bool

AllNodeCriticalPodsAreReady returns true if all the given pods are ready by checking their Ready conditions.

func GetExistingDriversFromCSINode

func GetExistingDriversFromCSINode(ctx context.Context, client client.Client, csiNodeName types.NamespacedName) (sets.Set[string], error)

GetExistingDriversFromCSINode returns a set of all driver names that are present in the CSINode object. A non-existent CSINode object is not considered an error, an empty set of existing drivers is returned instead.

func GetRequiredDrivers

func GetRequiredDrivers(pods []corev1.Pod) sets.Set[string]

GetRequiredDrivers searches through the pods annotations, and returns a set of driver names if it finds annotations with the wait-for-csi-node prefix; otherwise it returns an empty set.

func NodeHasCriticalComponentsNotReadyTaint

func NodeHasCriticalComponentsNotReadyTaint(obj client.Object) bool

NodeHasCriticalComponentsNotReadyTaint returns true if the given Node has the taint that this controller manages.

func RemoveTaint

func RemoveTaint(ctx context.Context, w client.Writer, node *corev1.Node) error

RemoveTaint removes the taint managed by this controller from the given node object

Types

type Reconciler

type Reconciler struct {
	TargetClient client.Client
	Config       config.NodeCriticalComponentsControllerConfig
	Recorder     record.EventRecorder
}

Reconciler manages taints on new Node objects to block scheduling of user workload pods until all node critical components are ready.

func (*Reconciler) AddToManager

func (r *Reconciler) AddToManager(mgr manager.Manager, targetCluster cluster.Cluster) error

AddToManager adds Reconciler to the given manager.

func (*Reconciler) NodePredicate

func (r *Reconciler) NodePredicate() predicate.Predicate

NodePredicate returns a predicate that filters for Node objects that are created with the taint.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(reconcileCtx context.Context, req reconcile.Request) (reconcile.Result, error)

Reconcile checks if the critical components not ready taint can be removed from the Node object.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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