Skip to content

De-couple drain and uncordoning #1114

Description

@thiyyakat

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.

Metadata

Metadata

Assignees

Labels

area/auto-scalingAuto-scaling (CA/HPA/VPA/HVPA, predominantly control plane, but also otherwise) relatedkind/enhancementEnhancement, improvement, extensionpriority/3Priority (lower number equals higher priority)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions