-
Notifications
You must be signed in to change notification settings - Fork 262
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
Allow mutating queue name in Deployment Webhook. #3528
base: main
Are you sure you want to change the base?
Allow mutating queue name in Deployment Webhook. #3528
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mbobrovskyi The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
e5b7db3
to
40d8aa6
Compare
df84a3e
to
db1a636
Compare
db1a636
to
bad767d
Compare
092a995
to
9ab4a5a
Compare
e86c136
to
24006dd
Compare
/unhold |
@mbobrovskyi is it still WIP or ready for review - the tests don't pass so I'm not sure |
Yes, because we need to merge #3315 first to allow deletion on Default(). |
Can we restict this PR to mutating only, but don't support dropping yet? It would provide the functionality in easier to dijest PRs. I'm also not sure we want to merge that one since we will have a fix in controller-runtime. |
It will not work if user want to remove queue-name label. |
I can't see some problems to merge it. We will still need to delete our defaulter. |
I know, but mutating is probably a more common use-case than deleting, and would let us handle these two scenarios independently |
fcf3de6
to
69e036e
Compare
podSpecQueueNameLabelPath, | ||
)...) | ||
allErrs := field.ErrorList{} | ||
allErrs = append(allErrs, jobframework.ValidateQueueName(newDeployment.Object())...) |
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.
Add assert to check that queue-name cannot be removed, because this remains broken in the PR, and add unit test to check that.
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.
Done
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.
which test case shows that the queue-name cannot be removed?
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.
Integration test
kueue/test/integration/webhook/jobs/deployment_webhook_test.go
Lines 113 to 128 in bb5e82f
ginkgo.It("shouldn't allow to remove the queue label with status zero", func() { | |
createdDeployment := &appsv1.Deployment{} | |
ginkgo.By("Remove queue label", func() { | |
gomega.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(deployment), createdDeployment)).Should(gomega.Succeed()) | |
delete(createdDeployment.Labels, constants.QueueLabel) | |
gomega.Expect(k8sClient.Update(ctx, createdDeployment)).To(gomega.Succeed()) | |
}) | |
ginkgo.By("Check that queue label not deleted from pod template spec", func() { | |
gomega.Eventually(func(g gomega.Gomega) { | |
g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(deployment), createdDeployment)).Should(gomega.Succeed()) | |
g.Expect(&createdDeployment.Spec.Template.Labels).Should(gomega.HaveKey(constants.QueueLabel)) | |
}, util.Timeout, util.Interval).Should(gomega.Succeed()) | |
}) | |
}) |
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.
Unit test
kueue/pkg/controller/jobs/deployment/deployment_webhook_test.go
Lines 61 to 64 in bb5e82f
"deployment without queue with pod template spec queue": { | |
deployment: testingdeployment.MakeDeployment("test-pod", "").PodTemplateSpecQueue("test-queue").Obj(), | |
want: testingdeployment.MakeDeployment("test-pod", "").PodTemplateSpecQueue("test-queue").Obj(), | |
}, |
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 also have e2e test for that? When renaming from non-existing to existing queue-name
69e036e
to
bb5e82f
Compare
Oh, I found another problem. When Pods have Scheduling Gates and we update them through the Deployment, both the Pods and the Workloads get stuck. I will try to fix it, but I’ll need a reconciler for that. /hold to fix this issue. |
bb5e82f
to
ec3c11b
Compare
@mbobrovskyi: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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-sigs/prow repository. I understand the commands that are listed here. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Allow mutating queue name in Deployment Webhook.
Which issue(s) this PR fixes:
Fixes #3552
Special notes for your reviewer:
Does this PR introduce a user-facing change?