Skip to content

Commit

Permalink
refactor the grace system2
Browse files Browse the repository at this point in the history
Signed-off-by: yunbo <[email protected]>
  • Loading branch information
Funinu committed Aug 7, 2024
1 parent c2a0c10 commit 19c1336
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/controller/rollout/rollout_canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func (m *canaryReleaseManager) runCanary(c *RolloutContext) error {
return err
} else if retry {
expectedTime := time.Now().Add(tr.RecheckDuration)
// klog.Infof("step %s, recheckDuration is %.1f seconds", v1beta1.CanaryStepStateTrafficRouting, tr.RecheckDuration.Seconds())
c.RecheckTime = &expectedTime
return nil
}
Expand Down Expand Up @@ -150,6 +151,7 @@ func (m *canaryReleaseManager) runCanary(c *RolloutContext) error {
return err
} else if retry {
expectedTime := time.Now().Add(tr.RecheckDuration)
// klog.Infof("step %s, recheckDuration is %.1f seconds", v1beta1.CanaryStepStateTrafficRouting, tr.RecheckDuration.Seconds())
c.RecheckTime = &expectedTime
return nil
}
Expand Down Expand Up @@ -191,9 +193,12 @@ func (m *canaryReleaseManager) runCanary(c *RolloutContext) error {
} else if done {
canaryStatus.LastUpdateTime = &metav1.Time{Time: time.Now()}
canaryStatus.CurrentStepState = v1beta1.CanaryStepStateMetricsAnalysis
// wait a grace period after the last step is done
tr.RecheckDuration = time.Duration(trafficrouting.GetGraceSeconds(c.Rollout.Spec.Strategy.GetTrafficRouting(), defaultGracePeriodSeconds)) * time.Second
klog.Infof("rollout(%s/%s) step(%d) state from(%s) -> to(%s)", c.Rollout.Namespace, c.Rollout.Name,
canaryStatus.CurrentStepIndex, v1beta1.CanaryStepStateTrafficRouting, canaryStatus.CurrentStepState)
}
// klog.Infof("step %s, recheckDuration is %.1f seconds", v1beta1.CanaryStepStateTrafficRouting, tr.RecheckDuration.Seconds())
expectedTime := time.Now().Add(tr.RecheckDuration)
c.RecheckTime = &expectedTime

Expand Down

0 comments on commit 19c1336

Please sign in to comment.