-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
kind/designCategorizes issue or PR as related to design.Categorizes issue or PR as related to design.kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.
Milestone
Description
User Story
As a user, I would like to have a "cluster.x-k8s.io/interruptible"
label on Nodes that run on interruptible instances(see https://github.com/kubernetes-sigs/cluster-api/blob/master/docs/proposals/20200330-spot-instances.md).
Detailed Description
Having "cluster.x-k8s.io/interruptible"
label on Nodes that run on interruptible instances should help us with implementing a termination handler(see #3528). We'll be able to create a DaemonSet that runs a termination handler on each node.
Based on the discussion here #3668. @ncdc's suggestion(1, 2) is:
- User creates InfraMachine with whatever spec field(s) are required for that provider to indicate it's interruptible
- Infra provider sets InfraMachine.status.interruptible=true
- Machine looks at the infra machine's status (for interruptible) and adds a label to the node.
- Machine controller ensures the interruptible label is always present on the Node if Machine.status.interruptible is true
The following snippet should work:
// Get and set the failure domain from the infrastructure provider.
var interruptible bool
err = util.UnstructuredUnmarshalField(infraConfig, &interruptible, "status", "interruptible")
switch {
case err == util.ErrUnstructuredFieldNotFound: // no-op
case err != nil:
return errors.Wrapf(err, "failed to get interruptible status from infrastructure provider for Machine %q in namespace %q", m.Name, m.Namespace)
}
if !interruptible {
return nil
}
// Here goes logic for assigning a label to node
/kind feature
Metadata
Metadata
Assignees
Labels
kind/designCategorizes issue or PR as related to design.Categorizes issue or PR as related to design.kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.