Skip to content

Commit 616deaa

Browse files
authored
Merge pull request #1053 from kubernetes-sigs/fix-internal-error
fix: CSI function should return internal error
2 parents ef93e17 + 0d19b73 commit 616deaa

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

Diff for: charts/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ The following table lists the configurable parameters of the latest Azure File C
147147
| `linux.resources.livenessProbe.requests.cpu` | liveness-probe cpu requests | 10m |
148148
| `linux.resources.livenessProbe.requests.memory` | liveness-probe memory requests | 20Mi |
149149
| `linux.resources.nodeDriverRegistrar.limits.memory` | csi-node-driver-registrar memory limits | 100Mi |
150-
| `linux.resources.nodeDriverRegistrar.requests.cpu` | csi-node-driver-registrar cpu requests | 10m |
150+
| `linux.resources.nodeDriverRegistrar.requests.cpu` | csi-node-driver-registrar cpu requests | 30m |
151151
| `linux.resources.nodeDriverRegistrar.requests.memory` | csi-node-driver-registrar memory requests | 20Mi |
152152
| `linux.resources.azurefile.limits.memory` | azurefile memory limits | 200Mi |
153153
| `linux.resources.azurefile.requests.cpu` | azurefile cpu requests | 10m |

Diff for: charts/latest/azurefile-csi-driver-v0.0.0.tgz

1 Byte
Binary file not shown.

Diff for: charts/latest/azurefile-csi-driver/values.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ windows:
209209
limits:
210210
memory: 100Mi
211211
requests:
212-
cpu: 10m
212+
cpu: 30m
213213
memory: 40Mi
214214
azurefile:
215215
limits:

Diff for: deploy/csi-azurefile-node-windows.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ spec:
8888
limits:
8989
memory: 100Mi
9090
requests:
91-
cpu: 10m
91+
cpu: 30m
9292
memory: 40Mi
9393
- name: azurefile
9494
image: mcr.microsoft.com/k8s/csi/azurefile-csi:latest

Diff for: pkg/azurefile/controllerserver.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
333333

334334
tags, err := ConvertTagsToMap(customTags)
335335
if err != nil {
336-
return nil, err
336+
return nil, status.Errorf(codes.InvalidArgument, err.Error())
337337
}
338338

339339
accountOptions := &azure.AccountOptions{
@@ -367,7 +367,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
367367
// search in cache first
368368
cache, err := d.accountSearchCache.Get(lockKey, azcache.CacheReadTypeDefault)
369369
if err != nil {
370-
return nil, err
370+
return nil, status.Errorf(codes.Internal, err.Error())
371371
}
372372
if cache != nil {
373373
accountName = cache.(string)
@@ -415,7 +415,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
415415
if len(secret) == 0 && useDataPlaneAPI {
416416
if accountKey == "" {
417417
if accountKey, err = d.GetStorageAccesskey(ctx, accountOptions, secret, secretName, secretNamespace); err != nil {
418-
return nil, fmt.Errorf("failed to GetStorageAccesskey on account(%s) rg(%s), error: %v", accountOptions.Name, accountOptions.ResourceGroup, err)
418+
return nil, status.Errorf(codes.Internal, "failed to GetStorageAccesskey on account(%s) rg(%s), error: %v", accountOptions.Name, accountOptions.ResourceGroup, err)
419419
}
420420
}
421421
secret = createStorageAccountSecret(accountName, accountKey)
@@ -457,20 +457,20 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
457457
d.volumeLocks.Release(volName)
458458
// clean search cache
459459
if err := d.accountSearchCache.Delete(lockKey); err != nil {
460-
return nil, err
460+
return nil, status.Errorf(codes.Internal, err.Error())
461461
}
462462
// remove the volName from the volMap to stop it matching the same storage account
463463
d.volMap.Delete(volName)
464464
return d.CreateVolume(ctx, req)
465465
}
466-
return nil, fmt.Errorf("failed to create file share(%s) on account(%s) type(%s) rg(%s) location(%s) size(%d), error: %v", validFileShareName, account, sku, resourceGroup, location, fileShareSize, err)
466+
return nil, status.Errorf(codes.Internal, "failed to create file share(%s) on account(%s) type(%s) rg(%s) location(%s) size(%d), error: %v", validFileShareName, account, sku, resourceGroup, location, fileShareSize, err)
467467
}
468468
klog.V(2).Infof("create file share %s on storage account %s successfully", validFileShareName, accountName)
469469

470470
if isDiskFsType(fsType) && !strings.HasSuffix(diskName, vhdSuffix) {
471471
if accountKey == "" {
472472
if accountKey, err = d.GetStorageAccesskey(ctx, accountOptions, req.GetSecrets(), secretName, secretNamespace); err != nil {
473-
return nil, fmt.Errorf("failed to GetStorageAccesskey on account(%s) rg(%s), error: %v", accountOptions.Name, accountOptions.ResourceGroup, err)
473+
return nil, status.Errorf(codes.Internal, "failed to GetStorageAccesskey on account(%s) rg(%s), error: %v", accountOptions.Name, accountOptions.ResourceGroup, err)
474474
}
475475
}
476476
if fileShareName == "" {
@@ -503,7 +503,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
503503
if !useSeretCache {
504504
if accountKey == "" {
505505
if accountKey, err = d.GetStorageAccesskey(ctx, accountOptions, req.GetSecrets(), secretName, secretNamespace); err != nil {
506-
return nil, fmt.Errorf("failed to GetStorageAccesskey on account(%s) rg(%s), error: %v", accountOptions.Name, accountOptions.ResourceGroup, err)
506+
return nil, status.Errorf(codes.Internal, "failed to GetStorageAccesskey on account(%s) rg(%s), error: %v", accountOptions.Name, accountOptions.ResourceGroup, err)
507507
}
508508
}
509509
storeSecretName, err := d.SetAzureCredentials(ctx, accountName, accountKey, secretName, secretNamespace)

Diff for: pkg/azurefile/nodeserver.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolu
103103
}
104104

105105
if err = preparePublishPath(target, d.mounter); err != nil {
106-
return nil, fmt.Errorf("prepare publish failed for %s with error: %v", target, err)
106+
return nil, status.Errorf(codes.Internal, "prepare publish failed for %s with error: %v", target, err)
107107
}
108108

109109
klog.V(2).Infof("NodePublishVolume: mounting %s at %s with mountOptions: %v", source, target, mountOptions)
@@ -313,7 +313,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
313313
mountFsType = nfs
314314
}
315315
if err := prepareStagePath(cifsMountPath, d.mounter); err != nil {
316-
return nil, fmt.Errorf("prepare stage path failed for %s with error: %v", cifsMountPath, err)
316+
return nil, status.Errorf(codes.Internal, "prepare stage path failed for %s with error: %v", cifsMountPath, err)
317317
}
318318
if err := wait.PollImmediate(1*time.Second, 2*time.Minute, func() (bool, error) {
319319
return true, SMBMount(d.mounter, source, cifsMountPath, mountFsType, mountOptions, sensitiveMountOptions)

0 commit comments

Comments
 (0)