How to categorize this issue?
/area auto-scaling
/kind enhancement
/priority 3
What would you like to be added:
Currently, the machine controller performs cordoning and drain together in a single RunDrain():
|
func (o *Options) RunDrain(ctx context.Context) error { |
|
o.drainStartedOn = time.Now() |
|
drainContext, cancelFn := context.WithDeadline(ctx, o.drainStartedOn.Add(o.Timeout)) |
|
klog.V(4).Infof( |
|
"Machine drain started on %s for %q", |
|
o.drainStartedOn, |
|
o.nodeName, |
|
) |
|
|
|
defer func() { |
|
o.drainEndedOn = time.Now() |
|
cancelFn() |
|
klog.Infof( |
|
"Machine drain ended on %s and took %s for %q", |
|
o.drainEndedOn, |
|
o.drainEndedOn.Sub(o.drainStartedOn), |
|
o.nodeName, |
|
) |
|
}() |
|
|
|
if err := o.RunCordonOrUncordon(drainContext, true); err != nil { |
Instead, the proposal is to de-couple such that cordoning can be performed before drain, and outside of RunDrain.
Why is this needed:
Drain and Cordoning are semantically different operations and must not be coupled together. Moreover, separating them out also allows cordoning to be done via taints, if required, as in the machine preservation case.
In preservation, we uncordon the backing nodes of preserved machines when the machine transitions from Failed-->Running. We need a way to ensure a manual cordon of the node is not inadvertently undone by the preservation flow. Applying a unique taint before draining preserved machines lets this uncordoning happen safely, without overriding a user's explicit cordon.
How to categorize this issue?
/area auto-scaling
/kind enhancement
/priority 3
What would you like to be added:
Currently, the machine controller performs cordoning and drain together in a single
RunDrain():machine-controller-manager/pkg/util/provider/drain/drain.go
Lines 218 to 238 in bd15a01
Instead, the proposal is to de-couple such that cordoning can be performed before drain, and outside of
RunDrain.Why is this needed:
Drain and Cordoning are semantically different operations and must not be coupled together. Moreover, separating them out also allows cordoning to be done via taints, if required, as in the machine preservation case.
In preservation, we uncordon the backing nodes of preserved machines when the machine transitions from Failed-->Running. We need a way to ensure a manual cordon of the node is not inadvertently undone by the preservation flow. Applying a unique taint before draining preserved machines lets this uncordoning happen safely, without overriding a user's explicit cordon.