Skip to content

fix: enqueue reconcile when sandbox pod deletion starts#640

Open
ashnaaseth2325-oss wants to merge 1 commit into
openkruise:masterfrom
ashnaaseth2325-oss:fix/pod-deletion-enqueue
Open

fix: enqueue reconcile when sandbox pod deletion starts#640
ashnaaseth2325-oss wants to merge 1 commit into
openkruise:masterfrom
ashnaaseth2325-oss:fix/pod-deletion-enqueue

Conversation

@ashnaaseth2325-oss

Copy link
Copy Markdown
Contributor

SUMMARY

This PR ensures the Sandbox controller reconciles as soon as an agent Pod enters the terminating state. Previously, update events that only set DeletionTimestamp were ignored, delaying Sandbox status updates until the Pod was fully deleted.

The change is limited to pkg/controller/sandbox/pod_event_handler.go and its corresponding unit tests in pkg/controller/sandbox/pod_event_handler_test.go.

FIX

// Before
if isActivePodUpdate(oldObj, newObj) {
    w.Add(reconcile.Request{NamespacedName: client.ObjectKeyFromObject(evt.ObjectNew)})
}

// After
deletionStarted := oldObj.DeletionTimestamp.IsZero() && !newObj.DeletionTimestamp.IsZero()

if deletionStarted || isActivePodUpdate(oldObj, newObj) {
    w.Add(reconcile.Request{NamespacedName: client.ObjectKeyFromObject(evt.ObjectNew)})
}

Signed-off-by: ashnaaseth2325-oss <ashnaaseth2325@gmail.com>
@kruise-bot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zmberg for approval by writing /assign @zmberg in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.84615% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.03%. Comparing base (e549e5b) to head (8e76566).

Files with missing lines Patch % Lines
pkg/controller/sandbox/sandbox_controller.go 40.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #640      +/-   ##
==========================================
- Coverage   80.08%   80.03%   -0.06%     
==========================================
  Files         229      229              
  Lines       17831    17840       +9     
==========================================
- Hits        14280    14278       -2     
- Misses       2969     2978       +9     
- Partials      582      584       +2     
Flag Coverage Δ
unittests 80.03% <53.84%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants