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
Support pods with a non-empty .pod.nodeName by replacing with node affinity #28
Support pods with a non-empty .pod.nodeName by replacing with node affinity #28
Conversation
Signed-off-by: Itamar Holder <iholder@redhat.com>
Thanks a lot for your PR! 😊 I'm really grateful for your help. I'd prefer not to add kubevirt/kubevirt as a requirement if possible. It could mean doing some extra steps, like asking for changes in kubevirt's code, making a new version of kubevirt, and then updating our project here. Let's try to keep things simple and make sure we can use the new stuff easily. Thanks again for your work! |
Signed-off-by: Itamar Holder <iholder@redhat.com>
Since it's not allowed to create a pod with both scheduling gates and a nodeName being set, the nodeName would be replaced with node affinity. Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
e3d7c28
to
e142ed4
Compare
Thanks for reviewing :) |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Barakmor1 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Why were you setting a nodeName in the first place? Setting a nodeName complete bypasses the scheduler, which could lead to over commitment of nodes. There is no point in supporting nodeName and scheduling gates, as the whole point of scheduling gates is to prevent scheduling. Whereas setting a nodeName is the equivalent of scheduling. |
Hey @alculquicondor! Thanks for your reply! Firstly, I agree that setting Secondly, it wasn't me who set the nodeName. This operator is being installed on various environments, some of them are running pods with a nodeName set. While you're right that it's probably a bad idea to set this field, I still want AAQ to be able to run on such environments. I think you'd agree that if such a pod is being created, then being mutated by our hook, then the creation fails, is not a great behavior from our end. Lastly, I fail to understand why it is restricted to set a nodeName alongside scheduling gates in the first place. This basically means that dynamic quota management (which is the only use-case specified in the scheduling gates KEP) is not possible for pods that set a nodeName. It seems to me that it could have been solved easily by saying "if there's a scheduling gate - the pod is not ready for scheduling - whether it has or doesn't have a nodeNamde set". WDYT? |
/lgtm |
/cherry-pick release-v1.1 |
@Barakmor1: new pull request created: #31 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it:
Creating pods with both scheduling gates and a non-empty
.spec.nodeName
is forbidden in Kubernetes. This causes an issue since AAQ's webhook adds scheduling gates for certain pods, which might have a non-empty nodeName set.With this PR's changes, the pod's
.spec.nodeName
would be dropped and instead a node affinity targeting the same node would be added.For example, a pod with the following spec:
would be changed to:
This trick allows AAQ to support pods with a target node set.
Note to reviewer:
In the first commit, I've imported kubevirt's patch package to ensure the patching code remains elegant.
Release note: