diff --git a/pkg/controller/rollout/rollout_bluegreen_test.go b/pkg/controller/rollout/rollout_bluegreen_test.go index 1666a700..dfaed0bc 100644 --- a/pkg/controller/rollout/rollout_bluegreen_test.go +++ b/pkg/controller/rollout/rollout_bluegreen_test.go @@ -64,6 +64,7 @@ func TestBlueGreenRunCanary(t *testing.T) { obj.Status.BlueGreenStatus.UpdatedRevision = "6f8cc56547" obj.Status.BlueGreenStatus.CurrentStepIndex = 1 obj.Status.BlueGreenStatus.NextStepIndex = 2 + obj.Status.BlueGreenStatus.ObservedRolloutID = "88bd5dbfd" obj.Status.BlueGreenStatus.CurrentStepState = v1beta1.CanaryStepStateUpgrade cond := util.GetRolloutCondition(obj.Status, v1beta1.RolloutConditionProgressing) cond.Reason = v1alpha1.ProgressingReasonInRolling @@ -79,6 +80,7 @@ func TestBlueGreenRunCanary(t *testing.T) { s.BlueGreenStatus.CurrentStepIndex = 1 s.BlueGreenStatus.NextStepIndex = 2 s.BlueGreenStatus.CurrentStepState = v1beta1.CanaryStepStateUpgrade + s.BlueGreenStatus.ObservedRolloutID = "88bd5dbfd" cond := util.GetRolloutCondition(*s, v1beta1.RolloutConditionProgressing) cond.Reason = v1alpha1.ProgressingReasonInRolling util.SetRolloutCondition(s, *cond) @@ -102,6 +104,7 @@ func TestBlueGreenRunCanary(t *testing.T) { } br.Spec.ReleasePlan.BatchPartition = utilpointer.Int32(0) br.Spec.ReleasePlan.RollingStyle = v1beta1.BlueGreenRollingStyle + br.Spec.ReleasePlan.RolloutID = "88bd5dbfd" return br }, }, @@ -128,6 +131,7 @@ func TestBlueGreenRunCanary(t *testing.T) { obj.Status.BlueGreenStatus.CurrentStepIndex = 1 obj.Status.BlueGreenStatus.NextStepIndex = 2 obj.Status.BlueGreenStatus.CurrentStepState = v1beta1.CanaryStepStateUpgrade + obj.Status.BlueGreenStatus.ObservedRolloutID = "88bd5dbfd" cond := util.GetRolloutCondition(obj.Status, v1beta1.RolloutConditionProgressing) cond.Reason = v1alpha1.ProgressingReasonInRolling util.SetRolloutCondition(&obj.Status, *cond) @@ -148,6 +152,7 @@ func TestBlueGreenRunCanary(t *testing.T) { } br.Spec.ReleasePlan.BatchPartition = utilpointer.Int32(0) br.Spec.ReleasePlan.RollingStyle = v1beta1.BlueGreenRollingStyle + br.Spec.ReleasePlan.RolloutID = "88bd5dbfd" br.Status = v1beta1.BatchReleaseStatus{ ObservedGeneration: 1, ObservedReleasePlanHash: util.HashReleasePlanBatches(&br.Spec.ReleasePlan), @@ -171,6 +176,7 @@ func TestBlueGreenRunCanary(t *testing.T) { s.BlueGreenStatus.UpdatedReadyReplicas = 1 s.BlueGreenStatus.CurrentStepIndex = 1 s.BlueGreenStatus.NextStepIndex = 2 + s.BlueGreenStatus.ObservedRolloutID = "88bd5dbfd" s.BlueGreenStatus.CurrentStepState = v1beta1.CanaryStepStateTrafficRouting cond := util.GetRolloutCondition(*s, v1beta1.RolloutConditionProgressing) cond.Reason = v1alpha1.ProgressingReasonInRolling @@ -195,6 +201,7 @@ func TestBlueGreenRunCanary(t *testing.T) { } br.Spec.ReleasePlan.BatchPartition = utilpointer.Int32(0) br.Spec.ReleasePlan.RollingStyle = v1beta1.BlueGreenRollingStyle + br.Spec.ReleasePlan.RolloutID = "88bd5dbfd" return br }, }, diff --git a/pkg/controller/rollout/rollout_canary_test.go b/pkg/controller/rollout/rollout_canary_test.go index 69df96d0..559379bf 100644 --- a/pkg/controller/rollout/rollout_canary_test.go +++ b/pkg/controller/rollout/rollout_canary_test.go @@ -103,6 +103,7 @@ func TestRunCanary(t *testing.T) { br.Spec.ReleasePlan.BatchPartition = utilpointer.Int32(0) br.Spec.ReleasePlan.EnableExtraWorkloadForCanary = true br.Spec.ReleasePlan.RollingStyle = v1beta1.CanaryRollingStyle + br.Spec.ReleasePlan.RolloutID = "88bd5dbfd" return br }, }, @@ -143,6 +144,7 @@ func TestRunCanary(t *testing.T) { obj.Status.CanaryStatus.CurrentStepIndex = 1 obj.Status.CanaryStatus.NextStepIndex = 2 obj.Status.CanaryStatus.CurrentStepState = v1beta1.CanaryStepStateUpgrade + obj.Status.CanaryStatus.ObservedRolloutID = "88bd5dbfd" cond := util.GetRolloutCondition(obj.Status, v1beta1.RolloutConditionProgressing) cond.Reason = v1alpha1.ProgressingReasonInRolling util.SetRolloutCondition(&obj.Status, *cond) @@ -164,6 +166,7 @@ func TestRunCanary(t *testing.T) { br.Spec.ReleasePlan.BatchPartition = utilpointer.Int32(0) br.Spec.ReleasePlan.EnableExtraWorkloadForCanary = true br.Spec.ReleasePlan.RollingStyle = v1beta1.CanaryRollingStyle + br.Spec.ReleasePlan.RolloutID = "88bd5dbfd" br.Status = v1beta1.BatchReleaseStatus{ ObservedGeneration: 1, // since we use RollingStyle over EnableExtraWorkloadForCanary now, former hardcoded hash @@ -190,6 +193,7 @@ func TestRunCanary(t *testing.T) { s.CanaryStatus.CurrentStepIndex = 1 s.CanaryStatus.NextStepIndex = 2 s.CanaryStatus.CurrentStepState = v1beta1.CanaryStepStateTrafficRouting + s.CanaryStatus.ObservedRolloutID = "88bd5dbfd" cond := util.GetRolloutCondition(*s, v1beta1.RolloutConditionProgressing) cond.Reason = v1alpha1.ProgressingReasonInRolling util.SetRolloutCondition(s, *cond) @@ -214,6 +218,7 @@ func TestRunCanary(t *testing.T) { br.Spec.ReleasePlan.BatchPartition = utilpointer.Int32(0) br.Spec.ReleasePlan.EnableExtraWorkloadForCanary = true br.Spec.ReleasePlan.RollingStyle = v1beta1.CanaryRollingStyle + br.Spec.ReleasePlan.RolloutID = "88bd5dbfd" return br }, }, diff --git a/pkg/controller/rollout/rollout_progressing_test.go b/pkg/controller/rollout/rollout_progressing_test.go index 7adcab6b..d32e035d 100644 --- a/pkg/controller/rollout/rollout_progressing_test.go +++ b/pkg/controller/rollout/rollout_progressing_test.go @@ -74,6 +74,7 @@ func TestReconcileRolloutProgressing(t *testing.T) { s.CanaryStatus.CurrentStepState = v1beta1.CanaryStepStateInit s.CurrentStepIndex = s.CanaryStatus.CurrentStepIndex s.CurrentStepState = s.CanaryStatus.CurrentStepState + s.CanaryStatus.ObservedRolloutID = "88bd5dbfd" return s }, expectTr: func() *v1alpha1.TrafficRouting { @@ -107,6 +108,7 @@ func TestReconcileRolloutProgressing(t *testing.T) { s.CanaryStatus.CurrentStepIndex = 1 s.CanaryStatus.NextStepIndex = 2 s.CanaryStatus.CurrentStepState = v1beta1.CanaryStepStateInit + s.CanaryStatus.ObservedRolloutID = "88bd5dbfd" cond := util.GetRolloutCondition(*s, v1beta1.RolloutConditionProgressing) cond.Reason = v1alpha1.ProgressingReasonInRolling util.SetRolloutCondition(s, *cond) diff --git a/pkg/controller/rollout/rollout_status.go b/pkg/controller/rollout/rollout_status.go index 840a1a46..9fd3cb0d 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,14 @@ 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 + } + if workload.IsInRollback { + rolloutID = fmt.Sprintf("rollback-%s", rolloutID) + } + return rolloutID } return "" } diff --git a/test/e2e/rollout_v1beta1_test.go b/test/e2e/rollout_v1beta1_test.go index 7035271f..8f8deee4 100644 --- a/test/e2e/rollout_v1beta1_test.go +++ b/test/e2e/rollout_v1beta1_test.go @@ -425,9 +425,12 @@ var _ = SIGDescribe("Rollout v1beta1", func() { return apps, nil } - CheckPodBatchLabel := func(namespace string, labelSelector *metav1.LabelSelector, rolloutID, batchID string, expected int) { + CheckPodBatchLabel := func(namespace string, labelSelector *metav1.LabelSelector, rolloutID, batchID string, expected int, isRollback bool) { pods, err := ListPods(namespace, labelSelector) Expect(err).NotTo(HaveOccurred()) + if isRollback && rolloutID != "" { + rolloutID = fmt.Sprintf("rollback-%s", rolloutID) + } count := 0 for _, pod := range pods { @@ -478,7 +481,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { service := &v1.Service{} Expect(GetObject(sname, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(BeEmpty()) - //canary service + // canary service cService := &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).To(HaveOccurred()) // canary ingress @@ -501,7 +504,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { service := &v1.Service{} Expect(GetObject(sname, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[selectorKey]).Should(Equal(ctx.stableRevision)) - //canary service + // canary service cService := &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[selectorKey]).Should(Equal(ctx.canaryRevision)) @@ -912,7 +915,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService := &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -1087,7 +1090,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService = &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -1157,7 +1160,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService = &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -1264,7 +1267,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService := &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -1359,7 +1362,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService = &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -1415,7 +1418,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService = &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -1471,7 +1474,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService = &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -1691,7 +1694,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService := &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -1756,7 +1759,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService = &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -1936,7 +1939,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService := &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -2001,7 +2004,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService = &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -2077,7 +2080,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService = &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -2113,7 +2116,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService = &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -2995,7 +2998,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService := &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -3156,7 +3159,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService := &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -3352,7 +3355,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService := &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -3672,7 +3675,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService := &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -3805,7 +3808,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // stable service Expect(GetObject(service.Name, service)).NotTo(HaveOccurred()) Expect(service.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(stableRevision)) - //canary service + // canary service cService := &v1.Service{} Expect(GetObject(service.Name+"-canary", cService)).NotTo(HaveOccurred()) Expect(cService.Spec.Selector[apps.DefaultDeploymentUniqueLabelKey]).Should(Equal(canaryRevision)) @@ -3998,7 +4001,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { cond = getRolloutCondition(rollout.Status, v1beta1.RolloutConditionSucceeded) Expect(string(cond.Status)).Should(Equal(string(metav1.ConditionTrue))) WaitRolloutWorkloadGeneration(rollout.Name, workload.Generation) - //Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) + // Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) // scale up replicas 5 -> 6 workload.Spec.Replicas = utilpointer.Int32(6) @@ -4192,8 +4195,8 @@ var _ = SIGDescribe("Rollout v1beta1", func() { Expect(GetObject(rollout.Name, rollout)).NotTo(HaveOccurred()) Expect(GetObject(workload.Name, workload)).NotTo(HaveOccurred()) Expect(rollout.Status.Phase).Should(Equal(v1beta1.RolloutPhaseProgressing)) - //Expect(rollout.Status.CanaryStatus.CanaryReplicas).Should(BeNumerically("==", 1)) - //Expect(rollout.Status.CanaryStatus.CanaryReadyReplicas).Should(BeNumerically("==", 1)) + // Expect(rollout.Status.CanaryStatus.CanaryReplicas).Should(BeNumerically("==", 1)) + // Expect(rollout.Status.CanaryStatus.CanaryReadyReplicas).Should(BeNumerically("==", 1)) Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(stableRevision)) Expect(rollout.Status.CanaryStatus.CanaryRevision).ShouldNot(Equal(canaryRevisionV1)) Expect(rollout.Status.CanaryStatus.CanaryRevision).Should(Equal(workload.Status.UpdateRevision[strings.LastIndex(workload.Status.UpdateRevision, "-")+1:])) @@ -4378,7 +4381,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { By("check rollout status & paused success") // v1 -> v2, start rollout action - //newEnvs := mergeEnvVar(workload.Spec.Template.Spec.Containers[0].Env, v1.EnvVar{Name: "NODE_NAME", Value: "version2"}) + // newEnvs := mergeEnvVar(workload.Spec.Template.Spec.Containers[0].Env, v1.EnvVar{Name: "NODE_NAME", Value: "version2"}) workload.Spec.Template.Spec.Containers[0].Image = "cilium/echoserver:1.10.2" UpdateCloneSet(workload) By("Update cloneSet env NODE_NAME from(version1) -> to(version2)") @@ -4427,7 +4430,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { cond = getRolloutCondition(rollout.Status, v1beta1.RolloutConditionSucceeded) Expect(string(cond.Status)).Should(Equal(string(metav1.ConditionTrue))) WaitRolloutWorkloadGeneration(rollout.Name, workload.Generation) - //Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) + // Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) // scale up replicas 5 -> 6 workload.Spec.Replicas = utilpointer.Int32(6) @@ -4566,7 +4569,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { cond = getRolloutCondition(rollout.Status, v1beta1.RolloutConditionSucceeded) Expect(string(cond.Status)).Should(Equal(string(metav1.ConditionTrue))) WaitRolloutWorkloadGeneration(rollout.Name, workload.Generation) - //Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) + // Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) // scale up replicas 5 -> 6 workload.Spec.Replicas = utilpointer.Int32(6) @@ -4968,13 +4971,13 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // wait step 1 complete By("wait step(1) pause") WaitRolloutStepPaused(rollout.Name, 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1, false) // resume rollout canary ResumeRollout(rollout.Name) By("resume rollout, and wait next step(2)") WaitRolloutStepPaused(rollout.Name, 2) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 1, false) // resume rollout ResumeRollout(rollout.Name) @@ -4984,11 +4987,11 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // check batch id after rollout By("rollout completed, and check pod batch label") - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "3", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "4", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "5", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "3", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "4", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "5", 1, false) }) It("patch batch id to pods: scaling case", func() { @@ -5054,8 +5057,8 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // wait step 2 complete By("wait step(2) pause") WaitRolloutStepPaused(rollout.Name, 2) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 1, false) // scale up replicas, 5 -> 10 By("scaling up CloneSet from 5 -> 10") @@ -5070,8 +5073,8 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // check pod batch label after scale By("check pod batch label after scale") - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 2) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 2) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 2, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 2, false) // resume rollout canary By("check rollout canary status success, resume rollout, and wait rollout canary complete") @@ -5080,10 +5083,11 @@ var _ = SIGDescribe("Rollout v1beta1", func() { WaitCloneSetAllPodsReady(workload) By("rollout completed, and check pod batch label") - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 2) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 2) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "3", 2) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "4", 4) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 2, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 2, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "3", 2, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "4", 4, false) + }) It("patch batch id to pods: rollback case", func() { @@ -5139,19 +5143,19 @@ var _ = SIGDescribe("Rollout v1beta1", func() { By("wait step(1) pause") WaitRolloutStepPaused(rollout.Name, 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1, false) By("wait step(2) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 2) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 1, false) By("wait step(3) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 3) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "3", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "3", 1, false) By("Update cloneSet env NODE_NAME from(version2) -> to(version1)") Expect(GetObject(workload.Name, workload)).NotTo(HaveOccurred()) @@ -5164,31 +5168,31 @@ var _ = SIGDescribe("Rollout v1beta1", func() { // make sure disable quickly rollback policy By("Wait step (1) paused") WaitRolloutStepPaused(rollout.Name, 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "1", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "1", 1, true) By("wait step(2) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 2) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "2", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "2", 1, true) By("wait step(3) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 3) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "3", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "3", 1, true) By("wait step(4) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 4) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "4", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "4", 1, true) By("Wait rollout complete") ResumeRollout(rollout.Name) WaitRolloutStatusPhase(rollout.Name, v1beta1.RolloutPhaseHealthy) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "1", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "2", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "3", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "4", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "5", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "1", 1, true) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "2", 1, true) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "3", 1, true) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "4", 1, true) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "5", 1, true) }) It("patch batch id to pods: only rollout-id changes", func() { @@ -5242,17 +5246,17 @@ var _ = SIGDescribe("Rollout v1beta1", func() { By("wait step(1) pause") WaitRolloutStepPaused(rollout.Name, 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1, false) By("wait step(2) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 2) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 1, false) By("wait step(3) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 3) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "3", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "3", 1, false) By("Only update rollout id = '2', and check batch label again") workload.Labels[v1beta1.RolloutIDLabel] = "2" @@ -5261,23 +5265,23 @@ var _ = SIGDescribe("Rollout v1beta1", func() { By("wait step(3) pause again") WaitRolloutStepPaused(rollout.Name, 3) time.Sleep(30 * time.Second) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "1", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "2", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "3", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "1", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "2", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "3", 1, false) By("wait step(4) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 4) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "4", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "4", 1, false) By("Wait rollout complete") ResumeRollout(rollout.Name) WaitRolloutStatusPhase(rollout.Name, v1beta1.RolloutPhaseHealthy) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "1", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "2", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "3", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "4", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "5", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "1", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "2", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "3", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "4", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "5", 1, false) }) It("patch batch id to pods: only change rollout-id after rolling the first step", func() { @@ -5331,7 +5335,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { By("wait step(1) pause") WaitRolloutStepPaused(rollout.Name, 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1, false) By("Only update rollout id = '2', and check batch label again") workload.Labels[v1beta1.RolloutIDLabel] = "2" @@ -5342,31 +5346,31 @@ var _ = SIGDescribe("Rollout v1beta1", func() { By("wait step(1) pause") WaitRolloutStepPaused(rollout.Name, 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "1", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "1", 1, false) By("wait step(2) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 2) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "2", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "2", 1, false) By("wait step(3) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 3) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "3", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "3", 1, false) By("wait step(4) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 4) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "4", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "4", 1, false) By("Wait rollout complete") ResumeRollout(rollout.Name) WaitRolloutStatusPhase(rollout.Name, v1beta1.RolloutPhaseHealthy) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "1", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "2", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "3", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "4", 1) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "5", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "1", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "2", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "3", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "4", 1, false) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "2", "5", 1, false) }) }) @@ -5497,7 +5501,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { cond = getRolloutCondition(rollout.Status, v1beta1.RolloutConditionSucceeded) Expect(string(cond.Status)).Should(Equal(string(metav1.ConditionTrue))) WaitRolloutWorkloadGeneration(rollout.Name, workload.Generation) - //Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) + // Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) // scale up replicas 5 -> 6 workload.Spec.Replicas = utilpointer.Int32(6) @@ -5782,7 +5786,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { By("check rollout status & paused success") // v1 -> v2, start rollout action - //newEnvs := mergeEnvVar(workload.Spec.Template.Spec.Containers[0].Env, v1.EnvVar{Name: "NODE_NAME", Value: "version2"}) + // newEnvs := mergeEnvVar(workload.Spec.Template.Spec.Containers[0].Env, v1.EnvVar{Name: "NODE_NAME", Value: "version2"}) workload.Spec.Template.Spec.Containers[0].Image = "cilium/echoserver:1.10.2" UpdateNativeStatefulSet(workload) By("Update cloneSet env NODE_NAME from(version1) -> to(version2)") @@ -5826,7 +5830,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { cond = getRolloutCondition(rollout.Status, v1beta1.RolloutConditionSucceeded) Expect(string(cond.Status)).Should(Equal(string(metav1.ConditionTrue))) WaitRolloutWorkloadGeneration(rollout.Name, workload.Generation) - //Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) + // Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) // scale up replicas 5 -> 6 workload.Spec.Replicas = utilpointer.Int32(6) @@ -5966,7 +5970,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { cond = getRolloutCondition(rollout.Status, v1beta1.RolloutConditionSucceeded) Expect(string(cond.Status)).Should(Equal(string(metav1.ConditionTrue))) WaitRolloutWorkloadGeneration(rollout.Name, workload.Generation) - //Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) + // Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) // scale up replicas 5 -> 6 workload.Spec.Replicas = utilpointer.Int32(6) @@ -6251,7 +6255,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { By("check rollout status & paused success") // v1 -> v2, start rollout action - //newEnvs := mergeEnvVar(workload.Spec.Template.Spec.Containers[0].Env, v1.EnvVar{Name: "NODE_NAME", Value: "version2"}) + // newEnvs := mergeEnvVar(workload.Spec.Template.Spec.Containers[0].Env, v1.EnvVar{Name: "NODE_NAME", Value: "version2"}) workload.Spec.Template.Spec.Containers[0].Image = "cilium/echoserver:1.10.2" UpdateAdvancedStatefulSet(workload) By("Update cloneSet env NODE_NAME from(version1) -> to(version2)") @@ -6295,7 +6299,7 @@ var _ = SIGDescribe("Rollout v1beta1", func() { cond = getRolloutCondition(rollout.Status, v1beta1.RolloutConditionSucceeded) Expect(string(cond.Status)).Should(Equal(string(metav1.ConditionTrue))) WaitRolloutWorkloadGeneration(rollout.Name, workload.Generation) - //Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) + // Expect(rollout.Status.CanaryStatus.StableRevision).Should(Equal(canaryRevision)) // scale up replicas 5 -> 6 workload.Spec.Replicas = utilpointer.Int32(6) @@ -6365,19 +6369,19 @@ var _ = SIGDescribe("Rollout v1beta1", func() { By("wait step(1) pause") WaitRolloutStepPaused(rollout.Name, 1) Expect(checkUpdateReadyPods(1, 1)).Should(BeTrue()) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "1", 1, false) By("wait step(2) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 2) Expect(checkUpdateReadyPods(2, 3)).Should(BeTrue()) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 2) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "2", 2, false) By("wait step(3) pause") ResumeRollout(rollout.Name) WaitRolloutStepPaused(rollout.Name, 3) Expect(checkUpdateReadyPods(4, 6)).Should(BeTrue()) - CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "3", 3) + CheckPodBatchLabel(workload.Namespace, workload.Spec.Selector, "1", "3", 3, false) // By("wait step(4) pause") // ResumeRolloutCanary(rollout.Name)