@@ -22,13 +22,13 @@ import (
2222
2323const (
2424 // PodDrainLabel is the label that can be set on Pods in workload clusters to ensure a Pod is not drained.
25- // The only valid value is "skip".
25+ // The only valid values are "skip" and "wait-completed ".
2626 // This label takes precedence over MachineDrainRules defined in the management cluster.
2727 PodDrainLabel = "cluster.x-k8s.io/drain"
2828)
2929
30- // MachineDrainRuleDrainBehavior defines the drain behavior. Can be either "Drain" or "Skip ".
31- // +kubebuilder:validation:Enum=Drain;Skip
30+ // MachineDrainRuleDrainBehavior defines the drain behavior. Can be either "Drain", "Skip", or "WaitCompleted ".
31+ // +kubebuilder:validation:Enum=Drain;Skip;WaitCompleted
3232type MachineDrainRuleDrainBehavior string
3333
3434const (
@@ -37,6 +37,10 @@ const (
3737
3838 // MachineDrainRuleDrainBehaviorSkip means the drain for a Pod should be skipped.
3939 MachineDrainRuleDrainBehaviorSkip MachineDrainRuleDrainBehavior = "Skip"
40+
41+ // MachineDrainRuleDrainBehaviorWaitCompleted means the Pod should not be evicted,
42+ // but overall drain should wait until the Pod completes.
43+ MachineDrainRuleDrainBehaviorWaitCompleted MachineDrainRuleDrainBehavior = "WaitCompleted"
4044)
4145
4246// MachineDrainRuleSpec defines the spec of a MachineDrainRule.
@@ -112,14 +116,16 @@ type MachineDrainRuleSpec struct {
112116// MachineDrainRuleDrainConfig configures if and how Pods are drained.
113117type MachineDrainRuleDrainConfig struct {
114118 // behavior defines the drain behavior.
115- // Can be either "Drain" or "Skip ".
119+ // Can be either "Drain", "Skip", or "WaitCompleted ".
116120 // "Drain" means that the Pods to which this MachineDrainRule applies will be drained.
117121 // If behavior is set to "Drain" the order in which Pods are drained can be configured
118122 // with the order field. When draining Pods of a Node the Pods will be grouped by order
119123 // and one group after another will be drained (by increasing order). Cluster API will
120124 // wait until all Pods of a group are terminated / removed from the Node before starting
121125 // with the next group.
122126 // "Skip" means that the Pods to which this MachineDrainRule applies will be skipped during drain.
127+ // "WaitCompleted" means that the pods to which this MachineDrainRule applies will never be evicted
128+ // and we wait for them to be completed, it is enforced that pods marked with this behavior always have Order=0.
123129 // +required
124130 Behavior MachineDrainRuleDrainBehavior `json:"behavior"`
125131
0 commit comments