From c62855a70ac9cc2aaeb23481b8512c7b79eba6d6 Mon Sep 17 00:00:00 2001 From: Shelley-BaoYue Date: Mon, 25 Mar 2024 15:44:19 +0800 Subject: fix retrytimes in imageprepulljob Signed-off-by: Shelley-BaoYue --- build/crd-samples/operations/imageprepulljob.yaml | 4 ++-- edge/pkg/edgehub/task/taskexecutor/image_prepull.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/crd-samples/operations/imageprepulljob.yaml b/build/crd-samples/operations/imageprepulljob.yaml index 940a99975..041e83d26 100644 --- a/build/crd-samples/operations/imageprepulljob.yaml +++ b/build/crd-samples/operations/imageprepulljob.yaml @@ -10,5 +10,5 @@ spec: - busybox:latest nodes: - edgenode1 # Need to replaced with your own node name - timeoutSecondsOnEachNode: 300 - retryTimes: 1 \ No newline at end of file + timeoutSeconds: 300 + retryTimes: 1 diff --git a/edge/pkg/edgehub/task/taskexecutor/image_prepull.go b/edge/pkg/edgehub/task/taskexecutor/image_prepull.go index a2b19c8e7..86da16e6b 100644 --- a/edge/pkg/edgehub/task/taskexecutor/image_prepull.go +++ b/edge/pkg/edgehub/task/taskexecutor/image_prepull.go @@ -137,7 +137,7 @@ func prePullImages(prePullReq commontypes.ImagePrePullJobRequest, container util prePullStatus := v1alpha1.ImageStatus{ Image: image, } - for i := 0; i < int(prePullReq.RetryTimes); i++ { + for i := 0; i <= int(prePullReq.RetryTimes); i++ { err = container.PullImage(image, authConfig, nil) if err == nil { break -- cgit v1.2.3