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

Add EC2 Instance LifeCycle label #9121

Merged
merged 1 commit into from
May 15, 2020
Merged

Add EC2 Instance LifeCycle label #9121

merged 1 commit into from
May 15, 2020

Conversation

atmosx
Copy link
Contributor

@atmosx atmosx commented May 12, 2020

When using a "mixed instance policy"1 instance group spot and onDemand nodes are part of the same ASG. The ASG handles the percentage of spot vs onDemand
instances. There are no annotations, EC2 tags or labels to identify which
instances are onDemand vs spot.

This PR introduces a new label to be attached on all AWS instances.

The label is:

node-role.kubernetes.io/spot-worker: <value>

Possible values are:

  • onDemand (default)
  • spot

@k8s-ci-robot k8s-ci-robot added do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 12, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @atmosx!

It looks like this is your first PR to kubernetes/kops 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kops has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @atmosx. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 12, 2020
@rifelpet
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 12, 2020
@atmosx
Copy link
Contributor Author

atmosx commented May 12, 2020

Some tests fail from what I see. I'll fix them ASAP. Unfortunately I didn't came across the links shared by the bot while reading the contributing guide.

@johngmyers
Copy link
Member

The presence of the node-role.kubernetes.io/spot-worker annotation indicates the node is spot. The annotation should not be placed on onDemand instances.

@johngmyers
Copy link
Member

@atmosx You need to edit the message on the first commit to remove the issue reference.

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label May 13, 2020
@atmosx
Copy link
Contributor Author

atmosx commented May 13, 2020

The PR is fairly small, I squashed the commits for easier review.

@atmosx
Copy link
Contributor Author

atmosx commented May 13, 2020

/retest

@hakman
Copy link
Member

hakman commented May 13, 2020

@atmosx this is unexpectedly small. Very nice! :)

@atmosx
Copy link
Contributor Author

atmosx commented May 13, 2020

We’re adding a new field called InstanceSpot to the Info struct. The field is bool, hence defaults to false. We don't define the InstanceSpot field in do and gce packages.

I wonder if that's a problem or not. 😕

@hakman
Copy link
Member

hakman commented May 13, 2020

@atmosx I think doing this for AWS is a good start. Not sure if the label is even appropriate for GCE and DO.

When using a "mixed instance policy"[1] instance group spot and onDemand nodes are part of the same
ASG. The ASG handles the percentage of spot vs onDemand instances. There are no annotations, EC2 tags or labels to identify which
instances are onDemand vs spot. There is a field called `InstanceLifecycle` accessible through `EC2.DescribeInstances`.

The field `InstanceLifecycle` is available only in `spot` and
`scheduled` AWS EC2 instance types.

This PR introduces a new label to be attached on AWS EC2 spot nodes.

The label is:

```
node-role.kubernetes.io/spot-worker: "true"
```

or

```
node-role.kubernetes.io/scheduled-worker: "true"
```

[^1]: https://github.com/kubernetes/kops/blob/master/docs/instance_groups.md#mixedinstancepolicy-aws-only
@johngmyers
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 15, 2020
@hakman
Copy link
Member

hakman commented May 15, 2020

I think this may be good also for 1.17 as it's a fairly small change.
/lgtm

@rifelpet
Copy link
Member

We don't have any e2e tests that use spot instances so we wont be able to test this change in our periodic jobs beyond checking the node objects do not contain the new label since they are all on-demand instances.

That said, this looks good to me. thanks!

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: atmosx, rifelpet

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 15, 2020
@k8s-ci-robot k8s-ci-robot merged commit 50a1a8e into kubernetes:master May 15, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.18 milestone May 15, 2020
@atmosx
Copy link
Contributor Author

atmosx commented May 16, 2020

I think this may be good also for 1.17 as it's a fairly small change.
/lgtm

I would like that. We're planning to install v1.17 and we can use this feature. I notice that the bot tagged the feature for v1.17. Anything I can do to push the feature to v1.17?

@atmosx
Copy link
Contributor Author

atmosx commented May 20, 2020

resolves #8923

k8s-ci-robot added a commit that referenced this pull request May 20, 2020
…-origin-release-1.17

Automated cherry pick of #9121: Add EC2 instance lifecycle label to nodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants