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 a default NodeLabel with the InstanceGroup name #3783

Merged

Conversation

georgebuckerfield
Copy link
Contributor

As requested in #2999, this change just auto-populates new InstanceGroup specs with a default node label containing the name of the instance group. It would be really useful for those of us managing environments with multiple instance groups.

It allows an admin to easily view the instance groups using kubectl:

kubectl get nodes --label-columns kops.k8s.io/instancegroup
NAME                                           STATUS         AGE       VERSION   INSTANCEGROUP
ip-172-20-108-120.eu-west-1.compute.internal   Ready,node     3m        v1.7.4    xtra-large
ip-172-20-117-133.eu-west-1.compute.internal   Ready,master   14m       v1.7.4    master-eu-west-1c
ip-172-20-32-139.eu-west-1.compute.internal    Ready,master   14m       v1.7.4    master-eu-west-1a
ip-172-20-32-92.eu-west-1.compute.internal     Ready,node     12m       v1.7.4    nodes
ip-172-20-67-184.eu-west-1.compute.internal    Ready,master   13m       v1.7.4    master-eu-west-1b

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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 Nov 6, 2017
@georgebuckerfield
Copy link
Contributor Author

/retest

@k8s-ci-robot
Copy link
Contributor

@georgebuckerfield: you can't request testing unless you are a kubernetes member.

In response to this:

/retest

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.

@justinsb
Copy link
Member

justinsb commented Nov 7, 2017

/retest

@justinsb
Copy link
Member

justinsb commented Nov 7, 2017

So I think you need to update the tests. I think the approach looks good.

If we do this using this PR, this label will effectively be mandatory. Another option is to make it so that when you create an instancegroup, we auto-populate the nodeLabels in the spec. Then it would be explicit, and easily changed / removed.

I do think it's a nice feature though, and labels should be additive, so I'm OK with having them always there. My bigger concern is that instance groups might well map to something in the machine API, and then we would want a different label.

cc @pipejakob any thoughts on this wrt the Machines API?

@georgebuckerfield
Copy link
Contributor Author

Thanks @justinsb! Yes, I'd missed that PopulateInstanceGroupSpec gets called by kops edit ig etc. I've re-written so that the logic is moved into pkg/apis/kops/instancegroup.go (let me know if this isn't the best place for it) and called by cmd/kops/create_cluster.go and cmd/kops/create_ig.go. This means a user can remove the labels by editing the IG if they wish. Also working on fixing the tests.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 7, 2017
@justinsb
Copy link
Member

/ok-to-test

/lgtm

Looks great - thanks @georgebuckerfield

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 10, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 10, 2017
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue.

@k8s-github-robot k8s-github-robot merged commit e5ea6ba into kubernetes:master Nov 10, 2017
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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants