-
Notifications
You must be signed in to change notification settings - Fork 725
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
Prototype for frozen canaries. #1196
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -274,18 +274,22 @@ func (c *Controller) advanceCanary(name string, namespace string) { | |
c.recordEventInfof(cd, "New revision detected! Restarting analysis for %s.%s", | ||
cd.Spec.TargetRef.Name, cd.Namespace) | ||
|
||
// route all traffic back to primary | ||
primaryWeight = c.totalWeight(cd) | ||
canaryWeight = 0 | ||
if err := meshRouter.SetRoutes(cd, primaryWeight, canaryWeight, false); err != nil { | ||
c.recordEventWarningf(cd, "%v", err) | ||
return | ||
if !cd.Spec.Analysis.FreezeOnFailure { | ||
// route all traffic back to primary | ||
primaryWeight = c.totalWeight(cd) | ||
if err := meshRouter.SetRoutes(cd, primaryWeight, canaryWeight, false); err != nil { | ||
c.recordEventWarningf(cd, "%v", err) | ||
return | ||
} | ||
} else { | ||
canaryWeight = c.totalWeight(cd) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the reasoning behind this. Why would we want to set |
||
} | ||
|
||
// reset status | ||
status := flaggerv1.CanaryStatus{ | ||
Phase: flaggerv1.CanaryPhaseProgressing, | ||
CanaryWeight: 0, | ||
CanaryWeight: canaryWeight, | ||
FailedChecks: 0, | ||
Iterations: 0, | ||
} | ||
|
@@ -355,6 +359,14 @@ func (c *Controller) advanceCanary(name string, namespace string) { | |
c.alert(cd, fmt.Sprintf("Progress deadline exceeded %v", err), | ||
false, flaggerv1.SeverityError) | ||
} | ||
if cd.Spec.Analysis.FreezeOnFailure { | ||
c.recordEventInfof(cd, "Freezing failed canary: %s.%s", cd.Spec.TargetRef.Name, cd.Namespace) | ||
cd.Status.Phase = flaggerv1.CanaryPhaseFrozen | ||
if err := canaryController.SyncStatus(cd, cd.Status); err != nil { | ||
c.recordEventWarningf(cd, "%v", err) | ||
} | ||
return | ||
} | ||
c.rollback(cd, canaryController, meshRouter) | ||
return | ||
} | ||
|
@@ -788,7 +800,8 @@ func (c *Controller) checkCanaryStatus(canary *flaggerv1.Canary, canaryControlle | |
if canary.Status.Phase == flaggerv1.CanaryPhaseProgressing || | ||
canary.Status.Phase == flaggerv1.CanaryPhaseWaitingPromotion || | ||
canary.Status.Phase == flaggerv1.CanaryPhasePromoting || | ||
canary.Status.Phase == flaggerv1.CanaryPhaseFinalising { | ||
canary.Status.Phase == flaggerv1.CanaryPhaseFinalising || | ||
canary.Status.Phase == flaggerv1.CanaryPhaseFrozen { | ||
return true | ||
} | ||
|
||
|
@@ -834,7 +847,8 @@ func (c *Controller) checkCanaryStatus(canary *flaggerv1.Canary, canaryControlle | |
|
||
func (c *Controller) hasCanaryRevisionChanged(canary *flaggerv1.Canary, canaryController canary.Controller) bool { | ||
if canary.Status.Phase == flaggerv1.CanaryPhaseProgressing || | ||
canary.Status.Phase == flaggerv1.CanaryPhaseWaitingPromotion { | ||
canary.Status.Phase == flaggerv1.CanaryPhaseWaitingPromotion || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need to check for |
||
canary.Status.Phase == flaggerv1.CanaryPhaseFrozen { | ||
if diff, _ := canaryController.HasTargetChanged(canary); diff { | ||
return true | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why restart only when
FreezeOnFailure
is disabled? Even, ifFreezeOnFailue
is true and the canary deployment changed, I think we'd want the canary analysis to restart.