Skip to content

fix: CSI function should return internal error #1053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ The following table lists the configurable parameters of the latest Azure File C
| `linux.resources.livenessProbe.requests.cpu` | liveness-probe cpu requests | 10m |
| `linux.resources.livenessProbe.requests.memory` | liveness-probe memory requests | 20Mi |
| `linux.resources.nodeDriverRegistrar.limits.memory` | csi-node-driver-registrar memory limits | 100Mi |
| `linux.resources.nodeDriverRegistrar.requests.cpu` | csi-node-driver-registrar cpu requests | 10m |
| `linux.resources.nodeDriverRegistrar.requests.cpu` | csi-node-driver-registrar cpu requests | 30m |
| `linux.resources.nodeDriverRegistrar.requests.memory` | csi-node-driver-registrar memory requests | 20Mi |
| `linux.resources.azurefile.limits.memory` | azurefile memory limits | 200Mi |
| `linux.resources.azurefile.requests.cpu` | azurefile cpu requests | 10m |
Expand Down
Binary file modified charts/latest/azurefile-csi-driver-v0.0.0.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion charts/latest/azurefile-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ windows:
limits:
memory: 100Mi
requests:
cpu: 10m
cpu: 30m
memory: 40Mi
azurefile:
limits:
Expand Down
2 changes: 1 addition & 1 deletion deploy/csi-azurefile-node-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ spec:
limits:
memory: 100Mi
requests:
cpu: 10m
cpu: 30m
memory: 40Mi
- name: azurefile
image: mcr.microsoft.com/k8s/csi/azurefile-csi:latest
Expand Down
14 changes: 7 additions & 7 deletions pkg/azurefile/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)

tags, err := ConvertTagsToMap(customTags)
if err != nil {
return nil, err
return nil, status.Errorf(codes.InvalidArgument, err.Error())
}

accountOptions := &azure.AccountOptions{
Expand Down Expand Up @@ -367,7 +367,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
// search in cache first
cache, err := d.accountSearchCache.Get(lockKey, azcache.CacheReadTypeDefault)
if err != nil {
return nil, err
return nil, status.Errorf(codes.Internal, err.Error())
}
if cache != nil {
accountName = cache.(string)
Expand Down Expand Up @@ -415,7 +415,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
if len(secret) == 0 && useDataPlaneAPI {
if accountKey == "" {
if accountKey, err = d.GetStorageAccesskey(ctx, accountOptions, secret, secretName, secretNamespace); err != nil {
return nil, fmt.Errorf("failed to GetStorageAccesskey on account(%s) rg(%s), error: %v", accountOptions.Name, accountOptions.ResourceGroup, err)
return nil, status.Errorf(codes.Internal, "failed to GetStorageAccesskey on account(%s) rg(%s), error: %v", accountOptions.Name, accountOptions.ResourceGroup, err)
}
}
secret = createStorageAccountSecret(accountName, accountKey)
Expand Down Expand Up @@ -457,20 +457,20 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
d.volumeLocks.Release(volName)
// clean search cache
if err := d.accountSearchCache.Delete(lockKey); err != nil {
return nil, err
return nil, status.Errorf(codes.Internal, err.Error())
}
// remove the volName from the volMap to stop it matching the same storage account
d.volMap.Delete(volName)
return d.CreateVolume(ctx, req)
}
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)
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)
}
klog.V(2).Infof("create file share %s on storage account %s successfully", validFileShareName, accountName)

if isDiskFsType(fsType) && !strings.HasSuffix(diskName, vhdSuffix) {
if accountKey == "" {
if accountKey, err = d.GetStorageAccesskey(ctx, accountOptions, req.GetSecrets(), secretName, secretNamespace); err != nil {
return nil, fmt.Errorf("failed to GetStorageAccesskey on account(%s) rg(%s), error: %v", accountOptions.Name, accountOptions.ResourceGroup, err)
return nil, status.Errorf(codes.Internal, "failed to GetStorageAccesskey on account(%s) rg(%s), error: %v", accountOptions.Name, accountOptions.ResourceGroup, err)
}
}
if fileShareName == "" {
Expand Down Expand Up @@ -503,7 +503,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
if !useSeretCache {
if accountKey == "" {
if accountKey, err = d.GetStorageAccesskey(ctx, accountOptions, req.GetSecrets(), secretName, secretNamespace); err != nil {
return nil, fmt.Errorf("failed to GetStorageAccesskey on account(%s) rg(%s), error: %v", accountOptions.Name, accountOptions.ResourceGroup, err)
return nil, status.Errorf(codes.Internal, "failed to GetStorageAccesskey on account(%s) rg(%s), error: %v", accountOptions.Name, accountOptions.ResourceGroup, err)
}
}
storeSecretName, err := d.SetAzureCredentials(ctx, accountName, accountKey, secretName, secretNamespace)
Expand Down
4 changes: 2 additions & 2 deletions pkg/azurefile/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolu
}

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

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