Skip to content

Commit e274620

Browse files
amacaskillk8s-infra-cherrypick-robot
authored and
k8s-infra-cherrypick-robot
committed
reassign error returned from validateStoragePools so InvalidArgument error code is recorded instead of internal error code
1 parent dd65e7c commit e274620

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/gce-pd-csi-driver/controller.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
290290

291291
err = validateStoragePools(req, params, gceCS.CloudProvider.GetDefaultProject())
292292
if err != nil {
293-
return nil, status.Errorf(codes.InvalidArgument, "CreateVolume failed to validate storage pools: %v", err)
293+
// Reassign error so that all errors are reported as InvalidArgument to RecordOperationErrorMetrics.
294+
err = status.Errorf(codes.InvalidArgument, "CreateVolume failed to validate storage pools: %v", err)
295+
return nil, err
294296
}
295297

296298
// Verify that the regional availability class is only used on regional disks.

0 commit comments

Comments
 (0)