Skip to content

Commit

Permalink
fix: Set Canary Strategy default maxUnavailable to 25%
Browse files Browse the repository at this point in the history
Signed-off-by: khhirani <[email protected]>
  • Loading branch information
khhirani committed Feb 5, 2021
1 parent 7384684 commit 3e42c0e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions utils/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
// DefaultMaxSurge default number for the max number of additional pods that can be brought up during a rollout
DefaultMaxSurge = "25"
// DefaultMaxUnavailable default number for the max number of unavailable pods during a rollout
DefaultMaxUnavailable = 0
DefaultMaxUnavailable = "25"
// DefaultProgressDeadlineSeconds default number of seconds for the rollout to be making progress
DefaultProgressDeadlineSeconds = int32(600)
// DefaultScaleDownDelaySeconds default seconds before scaling down old replicaset after switching services
Expand Down Expand Up @@ -57,7 +57,7 @@ func GetMaxUnavailableOrDefault(rollout *v1alpha1.Rollout) *intstr.IntOrString {
if rollout.Spec.Strategy.Canary != nil && rollout.Spec.Strategy.Canary.MaxUnavailable != nil {
return rollout.Spec.Strategy.Canary.MaxUnavailable
}
defaultValue := intstr.FromInt(DefaultMaxUnavailable)
defaultValue := intstr.FromString(DefaultMaxUnavailable)
return &defaultValue
}

Expand Down
2 changes: 1 addition & 1 deletion utils/defaults/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestGetMaxUnavailableOrDefault(t *testing.T) {
assert.Equal(t, maxUnavailable, *GetMaxUnavailableOrDefault(rolloutBlueGreenNonDefaultValue))

rolloutDefaultValue := &v1alpha1.Rollout{}
assert.Equal(t, intstr.FromInt(DefaultMaxUnavailable), *GetMaxUnavailableOrDefault(rolloutDefaultValue))
assert.Equal(t, intstr.FromString(DefaultMaxUnavailable), *GetMaxUnavailableOrDefault(rolloutDefaultValue))
}

func TestGetCanaryIngressAnnotationPrefixOrDefault(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion utils/replicaset/replicaset.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ func MaxSurge(rollout *v1alpha1.Rollout) int32 {
return int32(0)
}
// Error caught by validation
maxSurge, _, _ := resolveFenceposts(defaults.GetMaxSurgeOrDefault(rollout), defaults.GetMaxUnavailableOrDefault(rollout), rolloutReplicas)
maxSurge, _, _ := resolveFenceposts(defaults.GetMaxSurgeOrDefault(rollout), defaults.GetMaxSurgeOrDefault(rollout), rolloutReplicas)
return maxSurge
}

Expand Down

0 comments on commit 3e42c0e

Please sign in to comment.