client icon indicating copy to clipboard operation
client copied to clipboard

Ability to set toleration, affinity and node selector

Open Shashankft9 opened this issue 2 years ago • 10 comments

Feature request

I should be able to set toleration, affinity and node selector on my ksvc, when enabled through the featuregate mentioned here: https://knative.dev/docs/serving/configuration/feature-flags.

Use case

I have a cluster where two nodes are having a different mtu set on them, so I don't want my ksvc pods to be scheduled there. Would have been helpful if i could set it globally through some configmap in knative-serving, but I dont think thats available.

Shashankft9 avatar Aug 03 '23 08:08 Shashankft9

That's a good idea, and it shouldn't be hard to implement it with some extra options. If you are fancy feel free to add it after we have discussed about the naming. We ❤️ contributions ;-)

rhuss avatar Aug 03 '23 11:08 rhuss

I wonder if the impl should check for feature flags to be enabled though. It might be really trick to provide appropriate feedback to user otherwise.

dsimansk avatar Aug 03 '23 12:08 dsimansk

Good point, but I'm afraid that there is no Knative-only API for querying this information ... maybe just try and returning an error with a descriptive error message as feedback. In the help message we can indicate this (e..g with a footnote like add ing a "*" to the message text and then in the bottom something like "only if enabled in the Knative installation"

rhuss avatar Aug 03 '23 12:08 rhuss

/assign

Shashankft9 avatar Aug 10 '23 15:08 Shashankft9

would the following work?

--tolerations stringArray    Tolerations to be set. Example: --tolerations Key="key1", Operator="Equal", Value="value1", Effect="NoSchedule"
--affinity stringArray       Node Affinity to be set. Examples: --affinity Type="Required", Key="topology.kubernetes.io/zone", Operator="In", Values="antarctica-east1, antarctica-west1"
--node-selector string       Node Selector to be set. Examples: --node-selector Disktype="ssd"

Shashankft9 avatar Aug 11 '23 12:08 Shashankft9

@Shashankft9 yes that looks like a good start. Please make sure key values are case insensitive on user inputs, but correctly represented on .PodSpec.

Do you need any hints wrt/ the implementation? You can check similar flags in the flags package.

Btw I wonder how Serving validation webhook reacts to providing these values with disabled feature flags. Could you check it please?

dsimansk avatar Aug 15 '23 16:08 dsimansk

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Nov 14 '23 01:11 github-actions[bot]

/remove-lifecycle stale

rhuss avatar Dec 14 '23 14:12 rhuss

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Mar 14 '24 02:03 github-actions[bot]

/remove-lifecycle stale

I am working on it now, will put up a wip PR soon.

Shashankft9 avatar Mar 14 '24 07:03 Shashankft9