Repository navigation
Sanitize remote metadata for MultiKueue external-framework jobs - #12643
Conversation
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
|
Hi @apullo777. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough
Safe remote object cloning
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/ok-to-test |
|
|
||
| // cloneUnstructuredForCreation creates a copy of obj containing only the GVK, name, | ||
| // namespace, labels, annotations and spec, the unstructured analogue of | ||
| // api.CloneObjectMetaForCreation; keep the two in sync. Dropping the rest (notably |
There was a problem hiding this comment.
To be more precise, this replicates the logic of copySpec func(dst, src PtrT), which just so happens to, for every implementation, copy the spec and use the api.CloneObjectMetaForCreation to copy the ObjectMeta.
To avoid having to sync methods we can extract the part that does indeed focus on mirroring api.CloneObjectMetaForCreation and make one of the methods call the other. Since both cases would require converting Unstructured and ObjectMeta in both directions, choosing where the logic actually lies should mainly be a cosmetic choice. It might be easier to use the api.CloneObjectMetaForCreation here instead of the other way around as it is placed in the utils/api package.
There was a problem hiding this comment.
Thanks, that makes sense. I will update cloneUnstructuredForCreation to reuse api.CloneObjectMetaForCreation for the metadata part, and keep only the unstructured-specific spec copy locally.
That should remove the parallel whitelist / “keep in sync” concern while keeping the behavior covered by the existing TestCloneUnstructuredForCreation cases. I will also thread an error return through, since the unstructured to ObjectMeta conversion can fail.
|
/lgtm |
|
@mimowo: once the present PR merges, I will cherry-pick it on top of DetailsIn 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-sigs/prow repository. |
|
LGTM label has been added. DetailsGit tree hash: ec9a735ee501ab2f081e4af9bf893c27f6943b18 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: apullo777, mimowo The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@mimowo: new pull request created: #12677 DetailsIn 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-sigs/prow repository. |
|
@mimowo: #12643 failed to apply on top of branch "release-0.17": DetailsIn 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-sigs/prow repository. |
|
Let me do the cherry-pick for 0.17 :) |
What type of PR is this?
/kind bug
/area multikueue
What this PR does / why we need it:
The external-framework MultiKueue adapter created remote objects from
localObj.DeepCopy()and only clearedresourceVersion. This could copy source-cluster metadata such as ownerReferences to the worker cluster.Since those owner UIDs do not exist on the worker, the worker garbage collector can delete the remote object, causing the adapter to recreate it repeatedly.
This PR builds the remote unstructured object from scratch instead, keeping only GVK, name, namespace, labels, annotations, and spec. This mirrors the
api.CloneObjectMetaForCreationwhitelist used by the typed adapters.The integration test asserts that the remote object is created without
ownerReferences,finalizers, orstatus. It does not assert the full create-delete loop because envtest does not run a real garbage collector. AI assistance was used for parts of this change.Which issue(s) this PR fixes:
Fixes #12540
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Summary by CodeRabbit
Bug Fixes
Tests