-
Notifications
You must be signed in to change notification settings - Fork 979
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
Allow kOps to set labels required for cluster operations #999
Conversation
✔️ Deploy Preview for karpenter-docs-prod canceled. 🔨 Explore the source changes: 5039ef5 🔍 Inspect the deploy log: https://app.netlify.com/sites/karpenter-docs-prod/deploys/61bb96526b500f000882c0a6 |
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.
Does the kubelet allow these labels to be set?
@@ -90,6 +90,9 @@ func (c *Constraints) validateLabels() (errs *apis.FieldError) { | |||
|
|||
func IsRestrictedLabelDomain(key string) bool { | |||
labelDomain := getLabelDomain(key) | |||
if labelDomain == "kops.k8s.io" { |
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 implement something similar to RestrictedLabelDomains (e.g. AllowedLabelDomains) and generalize this bit of code?
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.
That I can.
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.
Take a look if this is better now.
No. As far as I know, the entire k8s.io domain is banned, including subdomains. But these labels make no sense to set on kubelet, and kOps does not support setting labels as kubelet arguments. So for these we should be fine. |
2a718bd
to
cfcf6e5
Compare
Currently we pass all labels to the kubelet. This is to avoid an issue where if karpenter crashes right after launching the instance, but doesn't get a chance to create the node, the labels will still be applied. I can potentially see moving away from applying all labels in the kubelet args and instead moving towards a model where
Currently, karpenter only does this with a create call, but during periods of high congestion (e.g. fast node boot and kubeclient throttling), we could support this with a mechanism like CreateOrPatch. |
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.
Change LGTM other than the LT generation bit I pointed out.
cfcf6e5
to
e555a17
Compare
As mentioned on Slack, restricted labels should never be set by components other than those who own the respective keys. That is why they are restricted. For now, I suggest filtering out allowed labels in the launch template. It is a very curious edge case where EKS users would set flags that are owned by kOps, so I think the risk here is very low. |
e555a17
to
e0cff03
Compare
} | ||
nodeLabelArgs.WriteString(strings.Join(labelStrings, ",")) |
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.
Thoughts on simplifying to:
fmt.Sprintf("--node-labels=%s", strings.Join(labelStrings, ","))
e0cff03
to
5039ef5
Compare
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.
Nice work!
Wrong. It moved to another domain, as I checked the thing and it took me somewhere else. Try going into it and you should be redirected to another domain. |
@Tyler887 I suspect you are not talking about label domains/prefixes here |
1. Issue, if available:
*2. Description of changes:
kOps require two labels set on Nodes:
kops.k8s.io/instancegroup
andkops.k8s.io/gpu
.The latter is especially important as any pod using the
nvidia
runtimeclass will get that label as nodeSelector.To make this more future proof, I allowed the entire
kops.k8s.io
domain as there will not be a case where these labels are restricted from Karpenters point of view.3. Does this change impact docs?
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.