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

Do not promote when not ready on skip analysis #695

Merged
merged 9 commits into from
Sep 29, 2020
13 changes: 11 additions & 2 deletions pkg/controller/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func (c *Controller) advanceCanary(name string, namespace string) {
}

// check if analysis should be skipped
if skip := c.shouldSkipAnalysis(cd, canaryController, meshRouter); skip {
if skip := c.shouldSkipAnalysis(cd, canaryController, meshRouter, err, retriable); skip {
return
}

Expand Down Expand Up @@ -616,11 +616,20 @@ func (c *Controller) runAnalysis(canary *flaggerv1.Canary) bool {
return true
}

func (c *Controller) shouldSkipAnalysis(canary *flaggerv1.Canary, canaryController canary.Controller, meshRouter router.Interface) bool {
func (c *Controller) shouldSkipAnalysis(canary *flaggerv1.Canary, canaryController canary.Controller, meshRouter router.Interface, err error, retriable bool) bool {
if !canary.SkipAnalysis() {
return false
}

// regardless if analysis is being skipped, rollback if canary failed to progress
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without this block, flagger immediately tries to promote the new version which at this point has 0 healthy pods.

if !retriable || canary.Status.FailedChecks >= canary.GetAnalysisThreshold() {
c.recordEventWarningf(canary, "Rolling back %s.%s progress deadline exceeded %v", canary.Name, canary.Namespace, err)
c.alert(canary, fmt.Sprintf("Progress deadline exceeded %v", err), false, flaggerv1.SeverityError)
c.rollback(canary, canaryController, meshRouter)

return true
}

// route all traffic to primary
primaryWeight := 100
canaryWeight := 0
Expand Down