From 6622ee6325c61edd8639e8e233293ae246f6f3c8 Mon Sep 17 00:00:00 2001 From: Alexis MacAskill Date: Thu, 5 Oct 2023 17:34:12 +0000 Subject: [PATCH] Change Unavailable error codes that signal a problem with the driver to Internal error codes in preparation for filtering out Unavailable from our SLO --- pkg/gce-cloud-provider/compute/gce-compute.go | 3 ++- pkg/gce-pd-csi-driver/controller.go | 2 +- pkg/gce-pd-csi-driver/identity.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/gce-cloud-provider/compute/gce-compute.go b/pkg/gce-cloud-provider/compute/gce-compute.go index 9626787bd..e7962cffc 100644 --- a/pkg/gce-cloud-provider/compute/gce-compute.go +++ b/pkg/gce-cloud-provider/compute/gce-compute.go @@ -889,7 +889,8 @@ func wrapOpErr(name string, opErr *computev1.OperationErrorErrors) error { } // codeForGCEOpError return the grpc error code for the passed in -// gce operation error. +// gce operation error. All of these error codes are filtered out from our SLO, +// but will be monitored by the stockout reporting dashboard. func codeForGCEOpError(err computev1.OperationErrorErrors) codes.Code { userErrors := map[string]codes.Code{ "RESOURCE_NOT_FOUND": codes.NotFound, diff --git a/pkg/gce-pd-csi-driver/controller.go b/pkg/gce-pd-csi-driver/controller.go index 78359b15c..19c311611 100644 --- a/pkg/gce-pd-csi-driver/controller.go +++ b/pkg/gce-pd-csi-driver/controller.go @@ -1902,7 +1902,7 @@ func (b *csiErrorBackoff) code(id csiErrorBackoffId) codes.Code { // If we haven't recorded a code, return unavailable, which signals a problem with the driver // (ie, next() wasn't called correctly). klog.Errorf("using default code for %s", id) - return codes.Unavailable + return codes.Internal } func (b *csiErrorBackoff) next(id csiErrorBackoffId, code codes.Code) { diff --git a/pkg/gce-pd-csi-driver/identity.go b/pkg/gce-pd-csi-driver/identity.go index 898122f82..7583f6c0f 100644 --- a/pkg/gce-pd-csi-driver/identity.go +++ b/pkg/gce-pd-csi-driver/identity.go @@ -29,7 +29,7 @@ type GCEIdentityServer struct { // GetPluginInfo(context.Context, *GetPluginInfoRequest) (*GetPluginInfoResponse, error) func (gceIdentity *GCEIdentityServer) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) { if gceIdentity.Driver.name == "" { - return nil, status.Error(codes.Unavailable, "Driver name not configured") + return nil, status.Error(codes.Internal, "Driver name not configured") } return &csi.GetPluginInfoResponse{