From a7020349dd8db1ea9ddbb9655f033eb753070ac8 Mon Sep 17 00:00:00 2001 From: zhihao jian Date: Thu, 26 Dec 2024 10:34:21 +0800 Subject: [PATCH] fix patch rollout batch id --- pkg/controller/rollout/rollout_status.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/controller/rollout/rollout_status.go b/pkg/controller/rollout/rollout_status.go index 840a1a46..e33776eb 100755 --- a/pkg/controller/rollout/rollout_status.go +++ b/pkg/controller/rollout/rollout_status.go @@ -119,7 +119,7 @@ func (r *RolloutReconciler) calculateRolloutStatus(rollout *v1beta1.Rollout) (re // newStatus.CanaryStatus.CurrentStepState == "Completed" { // // do something after rollout // } - //``` + // ``` // But at the first deployment of Rollout/Workload, CanaryStatus isn't set due to no rollout progression, // and PaaS platform cannot judge whether the deployment is completed base on the code above. So we have // to update the status just like the rollout was completed. @@ -349,7 +349,11 @@ func (r *RolloutReconciler) handleFinalizer(rollout *v1beta1.Rollout) error { func getRolloutID(workload *util.Workload) string { if workload != nil { - return workload.Labels[v1beta1.RolloutIDLabel] + rolloutID := workload.Labels[v1beta1.RolloutIDLabel] + if rolloutID == "" { + rolloutID = workload.CanaryRevision + } + return rolloutID } return "" }