Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Clear ProgressDeadlineExceeded Condition in paused BlueGreen Ro… #1002

Merged
merged 14 commits into from
Mar 1, 2021
Merged
4 changes: 0 additions & 4 deletions rollout/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,6 @@ func (c *rolloutContext) cleanupRollouts(oldRSs []*appsv1.ReplicaSet) error {
// that were paused for longer than progressDeadlineSeconds.
func (c *rolloutContext) checkPausedConditions() error {
cond := conditions.GetRolloutCondition(c.rollout.Status, v1alpha1.RolloutProgressing)
if cond != nil && cond.Reason == conditions.TimedOutReason {
// If we have reported lack of progress, do not overwrite it with a paused condition.
return nil
}
pausedCondExists := cond != nil && cond.Reason == conditions.PausedRolloutReason

isPaused := len(c.rollout.Status.PauseConditions) > 0 || c.rollout.Spec.Paused
Expand Down
120 changes: 120 additions & 0 deletions test/e2e/bluegreen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,123 @@ spec:
Then().
ExpectRevisionPods("revision 2 has active metadata2", "2", podsHaveActiveMetadata2)
}

func (s *BlueGreenSuite) TestBlueGreenProgressDeadlineExceededWithPause() {
s.Given().
RolloutObjects(`
kind: Service
apiVersion: v1
metadata:
name: rollout-bluegreen-active
spec:
selector:
app: rollout-bluegreen-with-pause
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: rollout-bluegreen-with-pause
spec:
replicas: 1
revisionHistoryLimit: 2
progressDeadlineSeconds: 5 # note this is less than initialDelaySeconds
selector:
matchLabels:
app: rollout-bluegreen-with-pause
template:
metadata:
labels:
app: rollout-bluegreen-with-pause
spec:
containers:
- name: rollouts-demo
image: nginx:1.19-alpine
ports:
- containerPort: 80
readinessProbe:
initialDelaySeconds: 10
httpGet:
path: /
port: 80
periodSeconds: 30
strategy:
blueGreen:
autoPromotionEnabled: false
activeService: rollout-bluegreen-active
`).
When().
ApplyManifests().
WaitForRolloutReplicas(1).
WaitForRolloutStatus("Degraded").
WaitForRolloutStatus("Healthy").
UpdateSpec().
WaitForRolloutStatus("Degraded").
WaitForRolloutStatus("Paused").
PromoteRollout().
WaitForRolloutStatus("Healthy").
Then().
ExpectActiveRevision("2")
}

func (s *BlueGreenSuite) TestBlueGreenProgressDeadlineExceededWithoutPause() {
s.Given().
RolloutObjects(`
kind: Service
apiVersion: v1
metadata:
name: rollout-bluegreen-active
spec:
selector:
app: rollout-bluegreen-without-pause
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: rollout-bluegreen-without-pause
spec:
replicas: 1
revisionHistoryLimit: 2
progressDeadlineSeconds: 5 # note this is less than initialDelaySeconds
selector:
matchLabels:
app: rollout-bluegreen-without-pause
template:
metadata:
labels:
app: rollout-bluegreen-without-pause
spec:
containers:
- name: rollouts-demo
image: nginx:1.19-alpine
ports:
- containerPort: 80
readinessProbe:
initialDelaySeconds: 10
httpGet:
path: /
port: 80
periodSeconds: 30
strategy:
blueGreen:
autoPromotionEnabled: true
activeService: rollout-bluegreen-active
`).
When().
ApplyManifests().
WaitForRolloutReplicas(1).
WaitForRolloutStatus("Degraded").
WaitForRolloutStatus("Healthy").
UpdateSpec().
WaitForRolloutStatus("Degraded").
WaitForRolloutStatus("Healthy").
Then().
ExpectActiveRevision("2")
}
52 changes: 52 additions & 0 deletions test/e2e/canary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,55 @@ spec:
Then().
ExpectRevisionPods("revision 2 has stable metadata2", "2", podsHaveStableMetadata2)
}

func (s *CanarySuite) TestCanaryProgressDeadlineExceededWithPause() {
s.Given().
RolloutObjects(`
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: rollout-canary-with-pause
spec:
replicas: 3
revisionHistoryLimit: 2
progressDeadlineSeconds: 5
selector:
matchLabels:
app: rollout-canary-with-pause
template:
metadata:
labels:
app: rollout-canary-with-pause
spec:
containers:
- name: rollouts-demo
image: nginx:1.19-alpine
ports:
- containerPort: 80
readinessProbe:
initialDelaySeconds: 10
httpGet:
path: /
port: 80
periodSeconds: 30
strategy:
canary:
steps:
- setWeight: 20
- pause: {}
`).
When().
ApplyManifests().
WaitForRolloutStatus("Degraded").
WaitForRolloutStatus("Healthy").
WaitForRolloutReplicas(3).
UpdateSpec().
WaitForRolloutStatus("Degraded").
WaitForRolloutStatus("Paused").
Then().
ExpectCanaryStablePodCount(1, 3).
When().
PromoteRollout().
WaitForRolloutStatus("Degraded").
WaitForRolloutStatus("Healthy")
}
4 changes: 2 additions & 2 deletions utils/conditions/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ func RolloutProgressing(rollout *v1alpha1.Rollout, newStatus *v1alpha1.RolloutSt

strategySpecificProgress := false
if rollout.Spec.Strategy.BlueGreen != nil {
activeSelectorChange := rollout.Status.BlueGreen.ActiveSelector != newStatus.BlueGreen.ActiveSelector
previewSelectorChange := rollout.Status.BlueGreen.PreviewSelector != newStatus.BlueGreen.PreviewSelector
activeSelectorChange := oldStatus.BlueGreen.ActiveSelector != newStatus.BlueGreen.ActiveSelector
previewSelectorChange := oldStatus.BlueGreen.PreviewSelector != newStatus.BlueGreen.PreviewSelector
strategySpecificProgress = activeSelectorChange || previewSelectorChange
}

Expand Down