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

Update workload AdmissionChecks status on AdmissionRequest creation error. #4114

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

mbobrovskyi
Copy link
Contributor

@mbobrovskyi mbobrovskyi commented Jan 31, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

Update workload AdmissionChecks status on AdmissionRequest creation error.

Which issue(s) this PR fixes:

Fixes #3025

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fix the bug that prevented Kueue from updating the AdmissionCheck state in the Workload status on a ProvisioningRequest creation error.

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jan 31, 2025
@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 Jan 31, 2025
Copy link

netlify bot commented Jan 31, 2025

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit a2d05b0
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/679cc7bc5004340008eac744

@mbobrovskyi
Copy link
Contributor Author

/cc @mimowo

@k8s-ci-robot k8s-ci-robot requested a review from mimowo January 31, 2025 12:10
@mbobrovskyi mbobrovskyi changed the title Save workload AdmissionChecks on AdmissionRequest creation error. Update workload AdmissionChecks on AdmissionRequest creation error. Jan 31, 2025
@mbobrovskyi mbobrovskyi changed the title Update workload AdmissionChecks on AdmissionRequest creation error. Update workload AdmissionChecks status on AdmissionRequest creation error. Jan 31, 2025
@mimowo
Copy link
Contributor

mimowo commented Jan 31, 2025

Please describe why we need this PR in the description and release note that is focused on what is fixed from the user perspective.

cc @PBundyra or @gabesaba could you help with the first pass?

@PBundyra
Copy link
Contributor

Other than my comment above, LGTM

@PBundyra
Copy link
Contributor

PBundyra commented Jan 31, 2025

Please describe why we need this PR in the description and release note that is focused on what is fixed from the user perspective.

cc @PBundyra or @gabesaba could you help with the first pass?

The rationale behind this PR is that we haven't been actually patching the changes we make if ProvReq's creations fails:
https://github.com/kubernetes-sigs/kueue/blob/main/pkg/controller/admissionchecks/provisioning/controller.go#L309-L311

@mimowo
Copy link
Contributor

mimowo commented Jan 31, 2025

as I synced with @mbobrovskyi this is likely a bug which made #3056 not working. I believe we should think of better testing. Maybe an integration or e2e with a custom webhook?

EDIT: I'm ok with just manual testing for this PR if this unblocks #4086 (as I was told), but please open an issue for an automated testing at the integration level.

EDIT2: not sure how complex it is to deploy in Kueue a webhook during integration tests (might be simpler or harder depending on the testing frameworks). FWIIW we do it in core k8s at the integration and e2e level (example integration, example e2e), but I agree it would be overkill for this PR.

@mbobrovskyi mbobrovskyi force-pushed the fix/handle-creation-error branch from 9501795 to a2d05b0 Compare January 31, 2025 12:53
@mimowo
Copy link
Contributor

mimowo commented Jan 31, 2025

proposal, is it accurate?
/release-note-edit

Fix the bug that prevented Kueue from updating the AdmissionCheck state in the Workload status on a ProvisioningRequest creation error.

@mbobrovskyi
Copy link
Contributor Author

mbobrovskyi commented Jan 31, 2025

I'm ok with just manual testing for this PR if this unblocks #4086 (as I was told).

I manually tested it, and it works fine. I added CEL validation for spec.podSets[0].podTemplateRef.name to prevent creating a ProvisioningRequest with a name containing xyz. The AdmissionChecks status message has been updated:

Error creating ProvisioningRequest "xyz-ac-prov-1": ProvisioningRequest.autoscaling.x-k8s.io "xyz-ac-prov-1" is invalid: [spec.podSets[0].podTemplateRef.name: Invalid value: "string": The name must not contain 'xyz', spec.podSets[1].podTemplateRef.name: Invalid value: "string": The name must not contain 'xyz']

please open an issue for an automated testing at the integration level.

Created an issue #4115 for follow-ups.

@mimowo
Copy link
Contributor

mimowo commented Jan 31, 2025

/lgtm
/approve
Looks great!, thanks for manual double checking!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 31, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 2c328aeb3b039c3aff6bf5e4f078f14de8e67822

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mbobrovskyi, mimowo

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 31, 2025
@mimowo
Copy link
Contributor

mimowo commented Jan 31, 2025

/cherry-pick release-0.10 release-0.9

@k8s-infra-cherrypick-robot
Copy link
Contributor

@mimowo: once the present PR merges, I will cherry-pick it on top of release-0.10 in a new PR and assign it to you.

In response to this:

/cherry-pick release-0.10 release-0.9

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.

@k8s-ci-robot k8s-ci-robot merged commit 418091a into kubernetes-sigs:main Jan 31, 2025
18 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v0.11 milestone Jan 31, 2025
@k8s-infra-cherrypick-robot
Copy link
Contributor

@mimowo: #4114 failed to apply on top of branch "release-0.10":

Applying: Update workload AdmissionChecks on AdmissionRequest creation error.
Using index info to reconstruct a base tree...
M	pkg/controller/admissionchecks/provisioning/controller.go
M	pkg/controller/admissionchecks/provisioning/controller_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/controller/admissionchecks/provisioning/controller_test.go
Auto-merging pkg/controller/admissionchecks/provisioning/controller.go
CONFLICT (content): Merge conflict in pkg/controller/admissionchecks/provisioning/controller.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Update workload AdmissionChecks on AdmissionRequest creation error.

In response to this:

/cherry-pick release-0.10 release-0.9

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.

@mimowo
Copy link
Contributor

mimowo commented Jan 31, 2025

@mbobrovskyi please prepare cherry-picks manually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Surface errors when a PodTemplate or a ProvReq is invalid
5 participants