fix(sandboxclaim): avoid claim identity collisions#590
Conversation
|
[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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #590 +/- ##
==========================================
+ Coverage 79.94% 79.96% +0.02%
==========================================
Files 202 202
Lines 14883 14902 +19
==========================================
+ Hits 11898 11917 +19
Misses 2556 2556
Partials 429 429
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
SandboxClaim claimed-sandbox recovery now uses stable claim identity instead of depending on a user-overridable claim-name label alone. Changes: - Add a claim-name sandbox cache index and ClaimName filter to sandbox list/count options. - Combine claim-name filtering with claim UID owner matching when counting active claimed sandboxes. - Preserve the internal agents.kruise.io/claim-name label after applying user labels so spec.labels cannot override it. - Add regression tests for recreated same-name claims, claim-name/UID filtering, and internal label override attempts. Refs openkruise#311 Signed-off-by: zhuangzhewei <zhuangzhewei09@dingtalk.com>
59a5ef9 to
2e003a8
Compare
…xclaim-identity-count Resolve the cache interface conflict by preserving the upstream reserved-failed sandbox documentation together with the SandboxClaim claim-name filter documentation. Signed-off-by: zhuangzhewei <zhuangzhewei09@dingtalk.com>
Ⅰ. Describe what this PR does
This PR fixes SandboxClaim claimed-sandbox counting so a claim is identified by both internal claim-name bookkeeping and the claim UID.
The previous flow could become unstable because
agents.kruise.io/claim-nameis an internal label but user-providedspec.labelscould override it, while claimed-sandbox recovery did not narrow the cache query by claim name. This could make recreated same-name claims or later reconciliations report incorrectClaimedReplicas.Key changes:
ListSandboxesOptionswithClaimName.ListSandboxesandCountActiveSandboxes.ClaimName: claim.Namefrom SandboxClaim claimed-sandbox recovery.agents.kruise.io/claim-namelabel after applying user labels sospec.labelscannot override it.Ⅱ. Does this pull request fix one issue?
Fixes #311
Ⅲ. Describe how to verify it
go test -count=1 ./pkg/cache/... ./pkg/controller/sandboxclaim/core/... git diff --checkⅣ. Special notes for reviews
make generateandmake manifestsare not required.GetIndexFuncs, keeping production cache and test cache index definitions consistent.