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 NodeConfig api support for node labels and taints #1590

Closed
wants to merge 0 commits into from

Conversation

ndbaker1
Copy link
Member

Issue #, if available:

Description of changes:

extend NodeConfig spec to include label and taint fields that pass through to kubelet --node-labels and --register-with-taints respectively.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Testing Done

add new e2e tests for labels and taints

See this guide for recommended testing for PRs. Some tests may not apply. Completing tests and providing additional validation steps are not required, but it is recommended and may reduce review time and time to merge.

Comment on lines 34 to 35
Labels map[string]string `json:"labels,omitempty"`
Taints []v1.Taint `json:"taints,omitempty"`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are applied by kubelet, but they are "node" configuration so not sure if they feel best here or in a Spec.Kubelet.{Labels,Taints}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it belongs in Kubelet

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 👍

@ndbaker1 ndbaker1 force-pushed the labels+taints branch 2 times, most recently from 8d8c309 to b8864a2 Compare January 23, 2024 21:59
@ndbaker1 ndbaker1 marked this pull request as ready for review January 23, 2024 22:03
for labelKey, label := range cfg.Spec.Kubelet.Labels {
labelStrings = append(labelStrings, fmt.Sprintf("%s=%s", labelKey, label))
}
k.additionalArguments["node-labels"] = strings.Join(labelStrings, ",")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to double confirm these keys are supported for all versions?
node-labels and register-with-taints

Copy link
Member Author

@ndbaker1 ndbaker1 Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked changelogs and only found a couple of relevant details:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

however, does ^ incentivize us to put this in Kubelet.Config.RegisterWithTaints instead to keep on the edge of kubelet config adoption?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's what we do in Karpenter, which has worked out very well: https://github.com/kubernetes-sigs/karpenter/blob/main/pkg/apis/v1beta1/nodeclaim.go#L70

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think this is a good idea, and will treat the config as first class. i.e. write the --register-with-taints argument if necessary based on a version check. similar to sichao's container runtime catch

@@ -30,6 +31,7 @@ type NodeConfigList struct {

type NodeConfigSpec struct {
Cluster ClusterDetails `json:"cluster,omitempty"`
Kubelet KubeletOptions `json:"kubelet,omitempty"`
FeatureGates map[string]bool `json:"featureGates,omitempty"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are feature gates scoped to our API, or is this kubelet feature gates?

Copy link
Member Author

@ndbaker1 ndbaker1 Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep its ours not kubelet's; to opt-in for a particular "preset" of the options (it could use a better name though :P)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an example of how to configure this, or is it something we think well use in the future. If the latter, I'd recommend only introducing it when we need it. Sounds like the kind of thing that's design worthy in its own right.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really documented yet. i took some real actions from the bootstrap.sh which could be provided as feature gate toggles, but it might be wiser to keep it under wraps until someone explicitly asks for it 🤔

@ndbaker1
Copy link
Member Author

some branch shenanigans happened while updating the scope of this PR, so redirecting to #1593

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants