Skip to content

Commit b8c28d0

Browse files
Merge pull request #201 from HarrisonWAffel/retries-after-restart
Add ResetFailureCountOnServiceRestart
2 parents 7ad21ff + fb4a027 commit b8c28d0

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

pkg/applyinator/applyinator.go

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ type Plan struct {
4545
OneTimeInstructions []OneTimeInstruction `json:"instructions,omitempty"`
4646
Probes map[string]prober.Probe `json:"probes,omitempty"`
4747
PeriodicInstructions []PeriodicInstruction `json:"periodicInstructions,omitempty"`
48+
// ResetFailureCountOnStartup denotes whether the system-agent should reset the failure count
49+
// and applied-checksum for plans that are force applied each time the system-agent starts.
50+
ResetFailureCountOnStartup bool `json:"resetFailureCountOnStartup,omitempty"`
4851
}
4952

5053
type CommonInstruction struct {

pkg/k8splan/watcher.go

+6
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ func (w *watcher) start(ctx context.Context, strictVerify bool) {
215215
logrus.Infof("Detected first start, force-applying one-time instruction set")
216216
needsApplied = true
217217
hasRunOnce = true
218+
// Plans which have previously succeeded but need to be force applied
219+
// should continue to respect the specified failure count.
220+
if cp.Plan.ResetFailureCountOnStartup {
221+
secret.Data[appliedChecksumKey] = []byte("")
222+
secret.Data[failureCountKey] = []byte("0")
223+
}
218224
}
219225

220226
// Check to see if we've exceeded our failure count threshold

0 commit comments

Comments
 (0)