-
Notifications
You must be signed in to change notification settings - Fork 39.6k
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
Always check if default labels on node need to be updated in kubelet #47044
Always check if default labels on node need to be updated in kubelet #47044
Conversation
Hi @mrIncompetent. 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 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. I understand the commands that are listed here. |
@mrIncompetent is this targeted for v1.7? |
@feiskyer Yes! |
@k8s-bot ok to test |
@@ -43,6 +43,7 @@ import ( | |||
core "k8s.io/client-go/testing" | |||
"k8s.io/kubernetes/pkg/api/v1" | |||
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset/fake" | |||
kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BUILD file also needs some update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done with 5a1587f
pkg/kubelet/kubelet_node_status.go
Outdated
@@ -158,6 +159,38 @@ func (kl *Kubelet) tryRegisterWithApiServer(node *v1.Node) bool { | |||
return false | |||
} | |||
|
|||
//updateDefaultLabels will set the default labels on the node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// updateDefaultLabels
Add a blank space after //
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done with 5a1587f
pkg/kubelet/kubelet_node_status.go
Outdated
kubeletapis.LabelArch, | ||
} | ||
|
||
if existingNode.Labels == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add some comments when this will happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out this only happened during unit tests where other tests had node objects without labels.
I updated the tests and removed this block in 5a1587f
cc/ @kubernetes/sig-node-pr-reviews |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm thanks @mrIncompetent for the update
@feiskyer @derekwaynecarr could you review? |
@k8s-bot pull-kubernetes-kubemark-e2e-gce test this |
@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this |
LGTM. Seems this is not a blocker for v1.7, target it to 1.8? |
@feiskyer Yep, 1.8 is fine! |
/lgtm Need @derekwaynecarr for approval. |
/assign @derekwaynecarr |
5a1587f
to
4fd7f8c
Compare
/test pull-kubernetes-e2e-gce-etcd3 |
thanks, this is /lgtm |
/approve |
/approve no-issue |
4fd7f8c
to
f08a87c
Compare
f08a87c
to
8015647
Compare
@k8s-bot retest |
@gyliu513 Please check again. Lost lgtm after rebase+squash |
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: derekwaynecarr, feiskyer, gyliu513, mrIncompetent Associated issue requirement bypassed by: derekwaynecarr 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 |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue |
What this PR does / why we need it:
Nodes join again but maybe OS/Arch/Instance-Type has changed in the meantime.
In this case the kubelet needs to check if the default labels are still correct and if not it needs to update them.