mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
jobs update stanza canonicalize and default AutoPromote
This commit is contained in:
12
api/jobs.go
12
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user