Skip to content

Commit

Permalink
set weight to 100 by comparing the rollout.Status.CurrentPodHash and …
Browse files Browse the repository at this point in the history
…rollout.Status.StableRS

co-authored-by: Jesse Suen <jesse_suen@intuit.com>
Signed-off-by: Hui Kang <hui.kang@salesforce.com>
  • Loading branch information
Hui Kang and jessesuen committed Jul 13, 2021
1 parent aff0e67 commit 154229c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/replicaset/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func CalculateReplicaCountsForCanary(rollout *v1alpha1.Rollout, newRS *appsv1.Re
desiredStableRSReplicaCount := int32(math.Ceil(float64(rolloutSpecReplica) * (1 - (float64(weight) / 100))))
desiredNewRSReplicaCount := int32(math.Ceil(float64(rolloutSpecReplica) * (float64(weight) / 100)))

if rollout.Spec.Strategy.Canary.TrafficRouting != nil && !rollout.Status.Abort {
if rollout.Spec.Strategy.Canary.TrafficRouting != nil {
return desiredNewRSReplicaCount, rolloutSpecReplica
}

Expand Down Expand Up @@ -293,7 +293,7 @@ func GetCurrentCanaryStep(rollout *v1alpha1.Rollout) (*v1alpha1.CanaryStep, *int

// GetCanaryReplicasOrWeight either returns a static set of replicas or a weight percentage
func GetCanaryReplicasOrWeight(rollout *v1alpha1.Rollout) (*int32, int32) {
if rollout.Status.PromoteFull {
if rollout.Status.PromoteFull || rollout.Status.CurrentPodHash == rollout.Status.StableRS {
return nil, 100
}
if scs := UseSetCanaryScale(rollout); scs != nil {
Expand Down

0 comments on commit 154229c

Please sign in to comment.