Skip to content

Commit

Permalink
feat: wait for first batch of pods to be ready before adding canary s…
Browse files Browse the repository at this point in the history
…elector label to SVC

Signed-off-by: Aaron Weisberg <[email protected]>
  • Loading branch information
aweis89 committed Mar 5, 2021
1 parent 6f501f7 commit 07f9d02
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions USERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Organizations below are **officially** using Argo Rollouts. Please send a PR wit
1. [Quipper](https://www.quipper.com/)
1. [Devtron Labs](https://github.com/devtron-labs/devtron)
1. [Quizlet](https://quizlet.com)
1. [Skillz] (https://www.skillz.com)
8 changes: 4 additions & 4 deletions rollout/canary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1033,9 +1033,9 @@ func TestCanaryRolloutWithCanaryService(t *testing.T) {
f := newFixture(t)
defer f.Close()

rollout := newCanaryRollout("foo", 0, nil, nil, nil, intstr.FromInt(1), intstr.FromInt(0))
rollout := newCanaryRollout("foo", 1, nil, nil, nil, intstr.FromInt(1), intstr.FromInt(0))
canarySvc := newService("canary", 80, nil, rollout)
rs := newReplicaSetWithStatus(rollout, 0, 0)
rs := newReplicaSetWithStatus(rollout, 1, 1)
rollout.Spec.Strategy.Canary.CanaryService = canarySvc.Name

f.rolloutLister = append(f.rolloutLister, rollout)
Expand Down Expand Up @@ -1084,9 +1084,9 @@ func TestCanaryRolloutWithStableService(t *testing.T) {
f := newFixture(t)
defer f.Close()

rollout := newCanaryRollout("foo", 0, nil, nil, nil, intstr.FromInt(1), intstr.FromInt(0))
rollout := newCanaryRollout("foo", 1, nil, nil, nil, intstr.FromInt(1), intstr.FromInt(0))
stableSvc := newService("stable", 80, nil, rollout)
rs := newReplicaSetWithStatus(rollout, 0, 0)
rs := newReplicaSetWithStatus(rollout, 1, 1)
rollout.Spec.Strategy.Canary.StableService = stableSvc.Name
rollout.Status.StableRS = rs.Labels[v1alpha1.DefaultRolloutUniqueLabelKey]

Expand Down
6 changes: 6 additions & 0 deletions rollout/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ func (c *rolloutContext) reconcileStableAndCanaryService() error {
if c.rollout.Spec.Strategy.Canary == nil {
return nil
}
if c.newRS == nil || c.newRS.Status.ReadyReplicas == 0 {
return nil
}
if c.newRS.Spec.Replicas == nil || *c.newRS.Spec.Replicas > c.newRS.Status.ReadyReplicas {
return nil
}
if c.rollout.Spec.Strategy.Canary.StableService != "" && c.stableRS != nil {
svc, err := c.servicesLister.Services(c.rollout.Namespace).Get(c.rollout.Spec.Strategy.Canary.StableService)
if err != nil {
Expand Down

0 comments on commit 07f9d02

Please sign in to comment.