Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mbobrovskyi
Copy link
Contributor

@mbobrovskyi mbobrovskyi commented Nov 13, 2024

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?

Allow mutating queue name in Deployment Webhook.

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 13, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mbobrovskyi
Once this PR has been reviewed and has the lgtm label, please assign tenzen-y for approval. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 13, 2024
Copy link

netlify bot commented Nov 13, 2024

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit ec3c11b
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/673f397a16b20c00088d31ad

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. release-note-none Denotes a PR that doesn't merit a release note. labels Nov 13, 2024
@mbobrovskyi mbobrovskyi force-pushed the fix/manageJobsWithoutQueueName-deployment branch from e5b7db3 to 40d8aa6 Compare November 13, 2024 21:58
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 13, 2024
@mbobrovskyi mbobrovskyi force-pushed the fix/manageJobsWithoutQueueName-deployment branch 5 times, most recently from df84a3e to db1a636 Compare November 14, 2024 05:49
@mbobrovskyi mbobrovskyi marked this pull request as ready for review November 14, 2024 05:49
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 14, 2024
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 14, 2024
@mbobrovskyi mbobrovskyi force-pushed the fix/manageJobsWithoutQueueName-deployment branch from db1a636 to bad767d Compare November 14, 2024 06:07
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 14, 2024
@mbobrovskyi
Copy link
Contributor Author

/hold for #3555 #3554 #3553

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. kind/feature Categorizes issue or PR as related to a new feature. and removed kind/bug Categorizes issue or PR as related to a bug. labels Nov 15, 2024
@mbobrovskyi mbobrovskyi force-pushed the fix/manageJobsWithoutQueueName-deployment branch from 092a995 to 9ab4a5a Compare November 18, 2024 11:48
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 18, 2024
@mbobrovskyi mbobrovskyi force-pushed the fix/manageJobsWithoutQueueName-deployment branch 2 times, most recently from e86c136 to 24006dd Compare November 18, 2024 13:31
@mbobrovskyi
Copy link
Contributor Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 18, 2024
@mimowo
Copy link
Contributor

mimowo commented Nov 21, 2024

@mbobrovskyi is it still WIP or ready for review - the tests don't pass so I'm not sure

@mbobrovskyi
Copy link
Contributor Author

@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().

@mimowo
Copy link
Contributor

mimowo commented Nov 21, 2024

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.

@mbobrovskyi
Copy link
Contributor Author

Can we restict this PR to mutating only, but don't support dropping yet?

It will not work if user want to remove queue-name label.

@mbobrovskyi
Copy link
Contributor Author

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.

I can't see some problems to merge it. We will still need to delete our defaulter.

@mimowo
Copy link
Contributor

mimowo commented Nov 21, 2024

It will not work if user want to remove queue-name label.

I know, but mutating is probably a more common use-case than deleting, and would let us handle these two scenarios independently

@mbobrovskyi mbobrovskyi force-pushed the fix/manageJobsWithoutQueueName-deployment branch 2 times, most recently from fcf3de6 to 69e036e Compare November 21, 2024 12:17
podSpecQueueNameLabelPath,
)...)
allErrs := field.ErrorList{}
allErrs = append(allErrs, jobframework.ValidateQueueName(newDeployment.Object())...)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

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?

Copy link
Contributor Author

@mbobrovskyi mbobrovskyi Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration test

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())
})
})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit test

"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(),
},

Copy link
Contributor

@mimowo mimowo left a 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

@mbobrovskyi mbobrovskyi force-pushed the fix/manageJobsWithoutQueueName-deployment branch from 69e036e to bb5e82f Compare November 21, 2024 13:34
@mbobrovskyi
Copy link
Contributor Author

Can we also have e2e test for that? When renaming from non-existing to existing queue-name

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.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 21, 2024
@mbobrovskyi mbobrovskyi force-pushed the fix/manageJobsWithoutQueueName-deployment branch from bb5e82f to ec3c11b Compare November 21, 2024 13:45
@k8s-ci-robot
Copy link
Contributor

@mbobrovskyi: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kueue-test-e2e-main-1-28 ec3c11b link true /test pull-kueue-test-e2e-main-1-28
pull-kueue-test-integration-main ec3c11b link true /test pull-kueue-test-integration-main

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/feature Categorizes issue or PR as related to a new feature. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow mutating queue name in Deployment Webhook.
4 participants