Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set interruptible label to nodes #3504

Closed
alexander-demicev opened this issue Aug 19, 2020 · 2 comments · Fixed by #3668
Closed

Set interruptible label to nodes #3504

alexander-demicev opened this issue Aug 19, 2020 · 2 comments · Fixed by #3668
Labels
kind/design Categorizes issue or PR as related to design. kind/feature Categorizes issue or PR as related to a new feature.
Milestone

Comments

@alexander-demicev
Copy link
Contributor

alexander-demicev commented Aug 19, 2020

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:

  1. User creates InfraMachine with whatever spec field(s) are required for that provider to indicate it's interruptible
  2. Infra provider sets InfraMachine.status.interruptible=true
  3. Machine looks at the infra machine's status (for interruptible) and adds a label to the node.
  4. 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

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 19, 2020
@alexander-demicev
Copy link
Contributor Author

@vincepri
Copy link
Member

/kind design
/milestone v0.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/design Categorizes issue or PR as related to design. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants