controllers/crd: preserve strategy retry counter across failed-CR replace#537
Open
SAY-5 wants to merge 2 commits into
Open
controllers/crd: preserve strategy retry counter across failed-CR replace#537SAY-5 wants to merge 2 commits into
SAY-5 wants to merge 2 commits into
Conversation
c3d5a40 to
c806aae
Compare
…lace SubmitCustomResource clears the strategy retry counter on every successful Create. When the Create happens because we just deleted a failed CR (ReplaceConcurrencyPolicy), the reset turned the retry budget into an infinite loop: every replacement re-zeroed the counter and the instance group would keep submitting a new CR forever regardless of MaxRetries (keikoproj#317). Track whether we replaced anything on this pass with a didReplace bool and only zero the counter on the genuine first-time submission branch. On replace we keep the accumulated count so the strategy-level retry budget is actually enforced. Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com> Fixes keikoproj#317 Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
82cc2a8 to
7cef9f1
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #537 +/- ##
==========================================
- Coverage 46.89% 46.87% -0.03%
==========================================
Files 40 40
Lines 5879 5882 +3
==========================================
Hits 2757 2757
- Misses 2964 2967 +3
Partials 158 158 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What type of PR is this?
Description
SubmitCustomResourceincontrollers/providers/kubernetes/crd.goclears the strategy retry counter on every successful CRCreate. When thatCreatefires because we just deleted a failed CR viaReplaceConcurrencyPolicy, the reset turns the retry budget into an infinite loop: every replacement re-zeros the counter and the instance group keeps resubmitting a new CR forever regardless ofMaxRetries.Original bug report: #317.
Related issue(s)
Fixes #317
High-level overview of changes
didReplace boolthat is flipped totruewhenever wekube.Resource(...).Delete(...)a stale/failed CR in theReplaceConcurrencyPolicybranch.Create, only callstatus.SetStrategyRetryCount(0)when!didReplace.This preserves the existing behaviour on the genuine first-time submission path while honouring
MaxRetrieson the replace path.Testing performed
make testpasses locally.activeResourcesempty): counter still reset to 0 on success, matches previous behaviour.ReplaceConcurrencyPolicydeletes one CR then recreates): retry counter is preserved, and once it exceedsMaxRetriesthe strategy errors out instead of resubmitting indefinitely.Checklist
make testlocally and all tests passgit commit -sfor DCO verification