diff --git a/api/jobs.go b/api/jobs.go index 4f73da10c..901b41e7f 100644 --- a/api/jobs.go +++ b/api/jobs.go @@ -383,7 +383,6 @@ type UpdateStrategy struct { // DefaultUpdateStrategy provides a baseline that can be used to upgrade // jobs with the old policy or for populating field defaults. func DefaultUpdateStrategy() *UpdateStrategy { - // boolPtr fields are omitted to avoid masking an unconfigured nil return &UpdateStrategy{ Stagger: timeToPtr(30 * time.Second), MaxParallel: intToPtr(1), @@ -393,6 +392,7 @@ func DefaultUpdateStrategy() *UpdateStrategy { ProgressDeadline: timeToPtr(10 * time.Minute), AutoRevert: boolToPtr(false), Canary: intToPtr(0), + AutoPromote: boolToPtr(false), } } @@ -487,8 +487,6 @@ func (u *UpdateStrategy) Merge(o *UpdateStrategy) { func (u *UpdateStrategy) Canonicalize() { d := DefaultUpdateStrategy() - // boolPtr fields are omitted to avoid masking an unconfigured nil - if u.MaxParallel == nil { u.MaxParallel = d.MaxParallel } @@ -520,6 +518,10 @@ func (u *UpdateStrategy) Canonicalize() { if u.Canary == nil { u.Canary = d.Canary } + + if u.AutoPromote == nil { + u.AutoPromote = d.AutoPromote + } } // Empty returns whether the UpdateStrategy is empty or has user defined values. @@ -556,6 +558,10 @@ func (u *UpdateStrategy) Empty() bool { return false } + if u.AutoPromote != nil && *u.AutoPromote { + return false + } + if u.Canary != nil && *u.Canary != 0 { return false }