-
-
Notifications
You must be signed in to change notification settings - Fork 454
Add Agent-level Tolerations setting #5266
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 Agent-level Tolerations setting #5266
Conversation
Hello and sorry that it took a long for us to answer. |
Ahh okay, so don't change the |
With proper rules applied, this might be a solution to #3070. |
@pat-s If you need/want an example or two I can try to help you out. |
@qwerty287 |
This looks good to me, but could you add the backend options parameter to the schema? https://github.com/woodpecker-ci/woodpecker/blob/main/pipeline/frontend/yaml/linter/schema/schema.json And I'd like to have a review from someone else, I don't have much knowledge of k8s. @woodpecker-ci/maintainers |
@qwerty287 |
No, that's not the scope of the linked issue at all. |
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.
As this is a quite dynamic change, especially to the option to deny/allow override on the user-level, this needs tests. @scottshotgg can you add some that test (ideally all) behaviors of this PR?
docs/docs/30-administration/10-configuration/11-backends/20-kubernetes.md
Show resolved
Hide resolved
docs/docs/30-administration/10-configuration/11-backends/20-kubernetes.md
Outdated
Show resolved
Hide resolved
@pat-s |
…/woodpecker into feat/agent-level-tolerations
I guess this test is the one you're looking for:
|
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.
LGTM after tests were added.
@scottshotgg do you plan to add the tests? |
I will try to work on the tests at some point |
I'm interested in getting this merged. Here's a patch to add tests for tolerations (as well as fixing a failing existing test) https://gist.github.com/marcusramberg/c18a22a191efba8810151c1d2d7fbb34 |
…/woodpecker into feat/agent-level-tolerations
for more information, see https://pre-commit.ci
Thank you @marcusramberg for implementing those tests - I've been pretty busy as of late. @xoxys @qwerty287 |
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.
Thank you both.
Surge PR preview deployment was removed |
@scottshotgg @marcusramberg Tests failed, can you take a look? |
This PR adds the ability to specify tolerations at the agent level similar to annotations, labels, node selector, etc. I know this ability is available from within a pipeline but as an administrator I should be able to set this at a global level as well as prevent any pipeline from overriding this.
In similar vein to how annotations are done, I have introduced two new env variables and updated the documentation to match:
WOODPECKER_BACKEND_K8S_POD_TOLERATIONS
WOODPECKER_BACKEND_K8S_POD_TOLERATIONS_ALLOW_FROM_STEP
I initially started this feature because I have a "runner" node in my k8s cluster specifically for jobs like this (crons, ci/cd, etc) so that the core compute on the worker nodes isn't effected by random variadic scaling patterns. I felt that the ability to define these tolerations and node selectors at the individual step level was really nice and could come in handy, but the inability to define them at a global level was necessary; I needed a simple way to say that every pipeline should be scheduled to a particular node, which
WOODPECKER_BACKEND_K8S_POD_NODE_SELECTOR
was good for - however it is a bit underwhelming because you are then left with a pod that has been told to schedule onto a node for which it has no toleration for the nodes taint unless you include this in every pipeline, every step, etc.I think this could be a useful feature that others could benefit from. Overall I found it simple to implement - thanks for the easy code to work in, and thanks for Woodpecker!