From c191935747bfffad8d832ed8bc0c8dd217a1eaf4 Mon Sep 17 00:00:00 2001 From: Konstantin Khlebnikov Date: Tue, 19 Dec 2023 21:05:42 +0100 Subject: [PATCH] fix: return gRPC code "unavailable" if server is not initialized yet Correct error code helps client to decide when it should retry request. Signed-off-by: Konstantin Khlebnikov --- pkg/cri/instrument/instrumented_service.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/cri/instrument/instrumented_service.go b/pkg/cri/instrument/instrumented_service.go index aa795d06d..ade7a6454 100644 --- a/pkg/cri/instrument/instrumented_service.go +++ b/pkg/cri/instrument/instrumented_service.go @@ -18,7 +18,6 @@ package instrument import ( "context" - "errors" "github.com/containerd/containerd/v2/errdefs" "github.com/containerd/containerd/v2/tracing" @@ -63,7 +62,7 @@ func (in *instrumentedService) checkInitialized() error { if in.c.IsInitialized() { return nil } - return errors.New("server is not initialized yet") + return errdefs.ToGRPCf(errdefs.ErrUnavailable, "server is not initialized yet") } func (in *instrumentedService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandboxRequest) (res *runtime.RunPodSandboxResponse, err error) {