model-serving: guard pod deletion by UID - #1427
Conversation
Signed-off-by: Avinash Kumar Deepak <avinash8655279@gmail.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
ptal @YaoZengzeng @LiZhenCheng9527 when get chance |
|
/lgtm |
Signed-off-by: Avinash Kumar Deepak <avinash8655279@gmail.com>
|
@LiZhenCheng9527 updated, we now track each pod’s grace timer using its name and UID, soo a replacement pod gets its own timer instead of being skipped because of the old pod. PTAL @acsoto also take a look if u have time sir, as lgtm tag has been removed now. |
|
/lgtm |
|
thanks @acsoto for a lgtm 😄 |
LiZhenCheng9527
left a comment
There was a problem hiding this comment.
I don't think a Grace unit test is important enough to warrant creating a new file.
| }, 2*time.Second, 10*time.Millisecond) | ||
| } | ||
|
|
||
| func newGracePeriodTestController(t *testing.T, pod *corev1.Pod) (*ModelServingController, *kubefake.Clientset) { |
There was a problem hiding this comment.
nit: Other test functions also have the need to create controllers. Can a test helper function be created that can be used by most unit tests?
There was a problem hiding this comment.
Maybe you can to this in another PR.
Signed-off-by: Avinash Kumar Deepak <avinash8655279@gmail.com>
|
New changes are detected. LGTM label has been removed. |
|
@LiZhenCheng9527 done, Grace tests moved into model_serving_controller_test.go. and
sure, separate PR for Shared helper refactor |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Prevents a stale ModelServing grace timer from deleting a replacement pod with the same name.
The controller now checks the pod UID before deleting it and uses a UID precondition on the delete request.
Which issue(s) this PR fixes:
Fixes #1426
Bug evidence (required for bug-related PRs):
A ModelServing with the following configuration can hit this:
A failed or restarted pod starts the grace timer. If that pod is deleted or replaced during the grace period, the replacement gets the same deterministic name but a different UID. The old handler previously looked up and deleted the pod by name only:
kthena/pkg/model-serving-controller/controller/model_serving_controller.go
Lines 1731 to 1768 in 3f3e715
The added test reproduces this with separate failed and replacement pod UIDs. It also verifies UID preconditions for delayed and immediate deletion.
Tested with:
This was reproduced with the controller fake client, not on a live cluster.
Special notes for your reviewer:
AI assistance was used during code inspection and initial preparation. I reviewed the final diff and ran the relevant tests locally on my own.
Race tests were not run because the local Windows environment does not have
gcc.Does this PR introduce a user-facing change?: