From af2f0c76cab663abe578dcc953f5b677e897bfd8 Mon Sep 17 00:00:00 2001 From: ColdsteelRail <574252631@qq.com> Date: Tue, 16 Jul 2024 11:21:36 +0800 Subject: [PATCH] GetOpsStatus: do not change progress if crr not found --- pkg/controllers/operationjob/restart/restart.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/controllers/operationjob/restart/restart.go b/pkg/controllers/operationjob/restart/restart.go index a73c0628..281b80b3 100644 --- a/pkg/controllers/operationjob/restart/restart.go +++ b/pkg/controllers/operationjob/restart/restart.go @@ -102,16 +102,13 @@ func (p *KruiseRestartHandler) GetOpsProgress( // get crr related to this candidate crr, err := getCRRByOperationJobAndPod(ctx, c, operationJob, candidate.PodName) if errors.IsNotFound(err) { - progress = appsv1alpha1.OperationProgressPending - // do not handle not found error err = nil return } else if err != nil { return } - if crr.Status.Phase == kruisev1alpha1.ContainerRecreateRequestCompleted || - crr.Status.Phase == kruisev1alpha1.ContainerRecreateRequestSucceeded { + if crr.Status.Phase == kruisev1alpha1.ContainerRecreateRequestCompleted || crr.Status.Phase == kruisev1alpha1.ContainerRecreateRequestSucceeded { progress = appsv1alpha1.OperationProgressSucceeded } else if crr.Status.Phase == kruisev1alpha1.ContainerRecreateRequestFailed { progress = appsv1alpha1.OperationProgressFailed @@ -134,7 +131,6 @@ func (p *KruiseRestartHandler) ReleaseTarget(ctx context.Context, c client.Clien } return c.Delete(ctx, crr) - } func getCRRByOperationJobAndPod(ctx context.Context, c client.Client, instance *appsv1alpha1.OperationJob, podName string) (*kruisev1alpha1.ContainerRecreateRequest, error) {