From 19c133694c189a2a5dcd1931851ca1669b2088fd Mon Sep 17 00:00:00 2001 From: yunbo Date: Wed, 7 Aug 2024 17:43:10 +0800 Subject: [PATCH] refactor the grace system2 Signed-off-by: yunbo --- pkg/controller/rollout/rollout_canary.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/controller/rollout/rollout_canary.go b/pkg/controller/rollout/rollout_canary.go index e77760be..5de9fa2d 100644 --- a/pkg/controller/rollout/rollout_canary.go +++ b/pkg/controller/rollout/rollout_canary.go @@ -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 } @@ -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 } @@ -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