diff --git a/module-controller/internal/controller/moduledeployment_controller.go b/module-controller/internal/controller/moduledeployment_controller.go index 8f30998c5..29caf00e3 100644 --- a/module-controller/internal/controller/moduledeployment_controller.go +++ b/module-controller/internal/controller/moduledeployment_controller.go @@ -388,8 +388,22 @@ func (r *ModuleDeploymentReconciler) updateModuleReplicaSet(moduleDeployment *mo } moduleDeployment.Status.ReleaseStatus.CurrentBatch += 1 - moduleDeployment.Status.ReleaseStatus.Progress = moduledeploymentv1alpha1.ModuleDeploymentReleaseProgressExecuting moduleDeployment.Status.ReleaseStatus.LastTransitionTime = metav1.Now() + + var grayTime = 0 + + if moduleDeployment.Spec.OperationStrategy.NeedConfirm { + moduleDeployment.Status.ReleaseStatus.Progress = moduledeploymentv1alpha1.ModuleDeploymentReleaseProgressWaitingForConfirmation + } else if grayTime = int(moduleDeployment.Spec.OperationStrategy.GrayTimeBetweenBatchSeconds); grayTime != 0 { + if curBatch == batchCount { + moduleDeployment.Status.ReleaseStatus.Progress = moduledeploymentv1alpha1.ModuleDeploymentReleaseProgressExecuting + } else { + moduleDeployment.Status.ReleaseStatus.Progress = moduledeploymentv1alpha1.ModuleDeploymentReleaseProgressPaused + } + } else { + moduleDeployment.Status.ReleaseStatus.Progress = moduledeploymentv1alpha1.ModuleDeploymentReleaseProgressExecuting + } + moduleDeployment.Status.Conditions = append(moduleDeployment.Status.Conditions, moduledeploymentv1alpha1.ModuleDeploymentCondition{ Type: moduledeploymentv1alpha1.DeploymentProgressing, Status: corev1.ConditionTrue, @@ -397,7 +411,7 @@ func (r *ModuleDeploymentReconciler) updateModuleReplicaSet(moduleDeployment *mo Message: fmt.Sprintf("deployment release: curbatch %v, batchCount %v", curBatch, batchCount), }) - return false, r.Status().Update(ctx, moduleDeployment) + return grayTime == 0, r.Status().Update(ctx, moduleDeployment) } // generate module replicas