-
Notifications
You must be signed in to change notification settings - Fork 520
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
settings: adds new node-labels
, node-taints
settings
#390
Conversation
What would be the level of effort to do this in a map type in the userdata? E.g.
That's a little awkward for taints since they have a more complex structure. The more structured types buy us some free validation - we don't have to watch out for input like "foo=bar=baz" - and we can add logic that checks for legal characters in keys, values, effects if we need to. |
1bed052
to
00d1bcb
Compare
Addresses issue with environment file not being generated if |
00d1bcb
to
b1065d9
Compare
Replaces |
Would need to model |
Maybe we could do something clever with the Accept headers of requests to the API server to serialize in different ways; we could make But for now, yeah, to do a map I think you'd take the same approach as host-containers in #386. The formatting example isn't quite right, though, it'd be more like this:
I do agree that having each of those be a map would be better in a way because we wouldn't have to track/allow every possible label/taint, while allowing a more consistent input format for users. I don't feel strongly, though, because anyone using k8s labels/taints is already familiar with the I guess I'd lean very slightly toward the current syntax for that reason. It would also mean several fewer components - you can see how simple this PR is now. Thoughts? |
The "canonical" form is a map per Labels and Selectors. The comma separated variant is just for |
b1065d9
to
7f6d3f6
Compare
node-labels
, node-taints
settingsnode-labels
and node-taints
for kubelet
Modelled |
Can you look into what's needed to do this with That's not necessarily a hard blocker here but we do need that functionality. One helper for a handful of settings isn't going to scale for us, and will be hard for downstream projects to extend. |
I think we'd need something like what I mentioned above, Accept headers on the server side, and helpers able to specify a desired format, along with multiple "Serialize" implementations for types in the API. It's not trivial. |
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 look into what's needed to do this with thar-be-settings, using handlebars to render the map to a template?
I think we'd need something like what I mentioned above, Accept headers on the server side, and helpers able to specify a desired format, along with multiple "Serialize" implementations for types in the API. It's not trivial.
bcressey had a simplifying idea - what if a template helper could accept a collection type instead of a scalar? Then we could have it format the labels/taints instead of needing another program. We'd only used helpers for scalars before and I didn't think of this. I'm going to test it.
#408 adds the helper, which works on its own, but there's a higher level problem. thar-be-settings looks for keys referenced in templates, then queries the API for just those keys, for efficiency. This doesn't work if the "key" you're querying is really a prefix like |
Updated #408 to do this; seems to work OK. Hoping this PR will become quite simple with that improvement. |
13bea61
to
0e9f07e
Compare
node-labels
and node-taints
for kubelet
node-labels
, node-taints
settings
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.
Awesome, nice work!
--node-labels "${NODE_LABELS}" \ | ||
--register-with-taints "${NODE_TAINTS}" \ |
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.
Are the quotes needed? The curly-brace form of the variable should ensure that it's passed as a single argument.
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 we use quotes anyway, even if it's the same, to clarify purpose? systemd's behavior is confusing; quotes aren't.
Adds `node-labels` and `node-taints` settings for kubelet. Allows users to label and taint the node through userdata Updates README with descriptions of the new settings
0e9f07e
to
d2e60fe
Compare
Updated |
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.
🏷
Issue #, if available: Fixes #366
Description of changes:
Adds
node-labels
andnode-taints
settings forkubelet.service
, both are modelled asHashMap<SingleLineString, SingleLineString>
.Allows users to label and taint the node through said settings in
userdata.toml
Testing:
Launch Thar nodes with
node-labels
andnode-taints
set as follows in user data:Confirmed that
kubelet
starts successfully:And the nodes are labelled and tainted accordingly:
Without
node-lables
andnode-taints
specified.kubelet
still successfully runs and registers the node:By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.