Skip to content

Commit

Permalink
GetOpsStatus: do not change progress if crr not found
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdsteelRail committed Jul 16, 2024
1 parent 69a8560 commit af2f0c7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions pkg/controllers/operationjob/restart/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit af2f0c7

Please sign in to comment.