-
Notifications
You must be signed in to change notification settings - Fork 88
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
Proposal feature: Adding label to node after applying the job #129
base: master
Are you sure you want to change the base?
Conversation
@Suse-KevinKlinger thank you for starting this conversation with your contribution! I think that SUC already satisfies this example use-case: My working assumption for the example use-case that you described is that the "patch level" would be codified in the plan's resolved version. So, something like Happy to entertain this further if I am missing the importance of the change for you! |
@dweomer thank you for explanations. But after thinking a while, I'd say labeling nodes after they've been patched may still be helpfull in terms of viewing the state quite easily. Users then could see the "patch-level" of their nodes by checking their labels. I'd be happy to have your opinion on this :) |
For your specific use-case I think you would want to rely on what the kubelet is reporting, no? e.g.
(with similar detail exposed in the rancher ui) That said, I can imagine value in an ad-hoc label applied to a node after an upgrade has completed successfully. I haven't given much thought of implementing this because one can always choose to label a node as part of an upgrade job (assuming a k8s client is shipped in the container) although such would be applied right before successful completion as opposed to after. Hmm, I want to think about this some more. |
|
||
// label the node after the update | ||
if plan.Spec.Label != nil { | ||
node.ObjectMeta.Labels[plan.Spec.Label.Key] = plan.Spec.Label.Value |
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.
node.ObjectMeta.Labels[plan.Spec.Label.Key] = plan.Spec.Label.Value | |
node.Labels[plan.Spec.Label.Key] = plan.Spec.Label.Value |
Also, you should want to move this twiddle (with the conditional guard against nil) up to line 91, immediately prior to the following block:
if node, err = nodes.Update(node); err != nil {
return obj, err
}
This would augment (and piggyback your change as part of) the "this job has completed so lets label the node and mark it as schedulable once again (if cordon or drain were specified)" operation. The extra call to Update()
the node becomes superfluous.
This is supposed to be an proposal for a new feature.
It will allow you to add a label to a node you update via your Plans.
Idea:
By this you could label nodes with something like a patch level to distinguish between already updated nodes.
Why would one need this? Imagine you want to add nodes to your cluster and keep all nodes on the same patch level.
You could then setup Plans which exclude already patched nodes via the nodeSelector and apply the updates only to the newly joined nodes.