Skip to content

Commit fc76bf2

Browse files
specialforestumagnus
authored andcommitted
PR feedback
1 parent b982517 commit fc76bf2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/blob/controllerserver.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,14 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
9797
parameters = make(map[string]string)
9898
}
9999
var storageAccountType, subsID, resourceGroup, location, account, containerName, containerNamePrefix, protocol, customTags, secretName, secretNamespace, pvcNamespace string
100-
var isHnsEnabled, requireInfraEncryption, enableBlobVersioning, createPrivateEndpoint, enableNfsV3 *bool
100+
var isHnsEnabled, requireInfraEncryption, enableBlobVersioning, createPrivateEndpoint, enableNfsV3, allowSharedKeyAccess *bool
101101
var vnetResourceGroup, vnetName, subnetName, accessTier, networkEndpointType, storageEndpointSuffix string
102102
var matchTags, useDataPlaneAPI, getLatestAccountKey bool
103103
var softDeleteBlobs, softDeleteContainers int32
104104
var vnetResourceIDs []string
105105
var err error
106106
// set allowBlobPublicAccess as false by default
107107
allowBlobPublicAccess := pointer.Bool(false)
108-
// set allowBlobPublicAccess as true by default
109-
allowSharedKeyAccess := pointer.Bool(true)
110108

111109
containerNameReplaceMap := map[string]string{}
112110

@@ -174,9 +172,11 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
174172
allowBlobPublicAccess = pointer.Bool(true)
175173
}
176174
case allowSharedKeyAccessField:
177-
if strings.EqualFold(v, falseValue) {
178-
allowSharedKeyAccess = pointer.Bool(false)
175+
var boolValue bool
176+
if boolValue, err = strconv.ParseBool(v); err != nil {
177+
return nil, status.Errorf(codes.InvalidArgument, "invalid %s: %s in volume context", allowSharedKeyAccessField, v)
179178
}
179+
allowSharedKeyAccess = pointer.Bool(boolValue)
180180
case requireInfraEncryptionField:
181181
if strings.EqualFold(v, trueValue) {
182182
requireInfraEncryption = pointer.Bool(true)
@@ -308,7 +308,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
308308
storageEndpointSuffix = d.getStorageEndPointSuffix()
309309
}
310310

311-
if storeAccountKey && !pointer.BoolDeref(allowSharedKeyAccess, false) {
311+
if storeAccountKey && !pointer.BoolDeref(allowSharedKeyAccess, true) {
312312
return nil, status.Errorf(codes.InvalidArgument, "storeAccountKey is not supported for account with shared access key disabled")
313313
}
314314

0 commit comments

Comments
 (0)