mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
fix canary rollback behaviour
Prevents the canary from getting triggered, when a canary deploy is updated to match the primary deploy after an analysis fails. Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
This commit is contained in:
@@ -48,6 +48,9 @@ func syncCanaryStatus(flaggerClient clientset.Interface, cd *flaggerv1.Canary, s
|
||||
cdCopy.Status.FailedChecks = status.FailedChecks
|
||||
cdCopy.Status.Iterations = status.Iterations
|
||||
cdCopy.Status.LastAppliedSpec = hash
|
||||
if status.Phase == flaggerv1.CanaryPhaseInitialized {
|
||||
cdCopy.Status.LastPromotedSpec = hash
|
||||
}
|
||||
cdCopy.Status.LastTransitionTime = metav1.Now()
|
||||
setAll(cdCopy)
|
||||
|
||||
|
||||
@@ -758,6 +758,14 @@ func (c *Controller) shouldAdvance(canary *flaggerv1.Canary, canaryController ca
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// Make sure to sync lastAppliedSpec even if the canary is in a failed state.
|
||||
if canary.Status.Phase == flaggerv1.CanaryPhaseFailed {
|
||||
if err := canaryController.SyncStatus(canary, canary.Status); err != nil {
|
||||
c.logger.With("canary", fmt.Sprintf("%s.%s", canary.Name, canary.Namespace)).Errorf("%v", err)
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
|
||||
newTarget, err := canaryController.HasTargetChanged(canary)
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
||||
Reference in New Issue
Block a user