fix(controller): Do not extend sandbox ShutdownTime on malformed pause-retention annotation - #890
fix(controller): Do not extend sandbox ShutdownTime on malformed pause-retention annotation#890vishalmore90 wants to merge 2 commits into
Conversation
…e-retention annotation Signed-off-by: vishal <httpsvishal07@gmail.com>
|
[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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #890 +/- ##
==========================================
+ Coverage 82.31% 82.39% +0.07%
==========================================
Files 244 254 +10
Lines 19782 21461 +1679
==========================================
+ Hits 16284 17683 +1399
- Misses 2888 3079 +191
- Partials 610 699 +89
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:
|
|
/Review |
Ⅰ. Describe what this PR does
Fixes a logic bug where a malformed
agents.kruise.io/reserve-paused-sandbox-durationannotation causesresolveRetentionAnnotationOrDefaultto silently returnmanaged=true.This previously caused
handlePauseTimeoutto extendSpec.ShutdownTimeby ~100 years the next time the sandbox auto-pauses, instead of cleanly treating the invalid annotation as absent.The fix correctly returns
managed=falsefor unparsable annotations and emits a KubernetesWarningevent to help operators identify the misconfiguration.Ⅱ. Does this pull request fix one issue?
fixes #889
Ⅲ. Describe how to verify it
PauseTimein the near future and aShutdownTime.kubectl annotate sandbox <name> agents.kruise.io/reserve-paused-sandbox-duration=invalid-duration.PauseTimeto be reached.InvalidRetentionAnnotation).PauseTimeand gets paused, but itsShutdownTimeremains unchanged and is not extended by 100 years.ShutdownTimeis reached.make testand ensure the updated test caseinvalid annotation patches paused without extending shutdown timepasses.Ⅳ. Special notes for reviews
The test case
"invalid annotation patches paused without backfilling default"insandbox_controller_test.goinadvertently encoded the bug's behavior (expectShutdownChange: true). This PR updates that test case to correctly expectexpectShutdownChange: falseand renames it.