-
Notifications
You must be signed in to change notification settings - Fork 85
fix(workloadmanager): check CodeInterpreter child ownership #450
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
Open
avinxshKD
wants to merge
4
commits into
volcano-sh:main
Choose a base branch
from
avinxshKD:fix/codeinterpreter-child-ownership
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+256
−18
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3c952a7
fix(workloadmanager): check CodeInterpreter child ownership
avinxshKD f722b51
fix(workloadmanager): report ownership conflicts
avinxshKD 2c5f667
fix(workloadmanager): bind child deletes to observed objects
avinxshKD 0b646d8
test(workloadmanager): simplify replacement race setup
avinxshKD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
[Medium] Bind the ownership check to the object being deleted
Both delete helpers first GET the child and confirm
metav1.IsControlledBy, butr.Delete(ctx, child)sends no UID or resourceVersion preconditions. Passing the fetched object toDeletedoes not automatically add those fields toDeleteOptions, so with another authorized writer the checked object and the deleted object can differ:sequenceDiagram participant WM as CodeInterpreter controller participant API as Kubernetes API participant Other as Concurrent authorized writer WM->>API: GET child "test" API-->>WM: A (UID 111, RV 10, owned by this CodeInterpreter) Note over WM: IsControlledBy(A) is true Other->>API: Delete A Other->>API: Create B with the same name (UID 222, not owned) alt Current: DELETE has no preconditions WM->>API: DELETE "test" by namespace/name API-->>WM: Delete the current object B else Requested: bind DELETE to observed identity/version WM->>API: DELETE "test" with UID 111 and RV 10 API-->>WM: Reject the stale request, then reconcile re-reads endThis is a source-proven latent race, not an observed failure: it requires a concurrent authorized writer to replace or mutate the child after the GET. Even so, the final DELETE can violate this PR's ownership invariant.
Could both delete helpers pass the observed UID and resourceVersion through
client.Preconditionsand return a precondition conflict so reconciliation re-reads the child? Please also add focused tests for bothSandboxTemplateandSandboxWarmPoolthat replace or mutate the object between GET and DELETE.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.
good catch, both delete paths now use UID and resourceVersion preconditions, with replacement-race tests for SandboxTemplate and SandboxWarmPool. PTAL. @ranxi2001