Do not attempt to truncate revision history if revisionHistoryLimit is negative

This commit is contained in:
Arda Güçlü
2024-12-19 11:35:29 +03:00
parent fd78b52967
commit b82572f6f6
2 changed files with 36 additions and 1 deletions

View File

@@ -194,7 +194,7 @@ func (ssc *defaultStatefulSetControl) truncateHistory(
}
historyLen := len(history)
historyLimit := int(*set.Spec.RevisionHistoryLimit)
if historyLen <= historyLimit {
if historyLimit < 0 || historyLen <= historyLimit {
return nil
}
// delete any non-live history to maintain the revision limit.