Skip to content

Commit dc2fc4a

Browse files
andyzhangxk8s-infra-cherrypick-robot
authored andcommitted
fix: allow clientID, tenantID workload identity parameters in sc
1 parent d5af860 commit dc2fc4a

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

pkg/blob/blob.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ const (
9898
ephemeralField = "csi.storage.k8s.io/ephemeral"
9999
podNamespaceField = "csi.storage.k8s.io/pod.namespace"
100100
serviceAccountTokenField = "csi.storage.k8s.io/serviceAccount.tokens"
101-
clientIDField = "clientID"
102-
tenantIDField = "tenantID"
101+
clientIDField = "clientid"
102+
tenantIDField = "tenantid"
103103
mountOptionsField = "mountoptions"
104104
falseValue = "false"
105105
trueValue = "true"
@@ -539,9 +539,9 @@ func (d *Driver) GetAuthEnv(ctx context.Context, volumeID, protocol string, attr
539539
if getLatestAccountKey, err = strconv.ParseBool(v); err != nil {
540540
return rgName, accountName, accountKey, containerName, authEnv, fmt.Errorf("invalid %s: %s in volume context", getLatestAccountKeyField, v)
541541
}
542-
case strings.ToLower(clientIDField):
542+
case clientIDField:
543543
clientID = v
544-
case strings.ToLower(tenantIDField):
544+
case tenantIDField:
545545
tenantID = v
546546
case strings.ToLower(serviceAccountTokenField):
547547
serviceAccountToken = v
@@ -580,7 +580,9 @@ func (d *Driver) GetAuthEnv(ctx context.Context, volumeID, protocol string, attr
580580
}
581581

582582
authEnv = append(authEnv, "AZURE_STORAGE_SPN_CLIENT_ID="+clientID)
583-
authEnv = append(authEnv, "AZURE_STORAGE_SPN_TENANT_ID="+tenantID)
583+
if tenantID != "" {
584+
authEnv = append(authEnv, "AZURE_STORAGE_SPN_TENANT_ID="+tenantID)
585+
}
584586
authEnv = append(authEnv, "WORKLOAD_IDENTITY_TOKEN="+workloadIdentityToken)
585587

586588
return rgName, accountName, accountKey, containerName, authEnv, err

pkg/blob/controllerserver.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
186186
case storageIdentityClientIDField:
187187
case storageIdentityObjectIDField:
188188
case storageIdentityResourceIDField:
189+
case clientIDField:
190+
case tenantIDField:
189191
case msiEndpointField:
190192
case storageAADEndpointField:
191193
// no op, only used in NodeStageVolume

pkg/blob/controllerserver_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,8 @@ func TestCreateVolume(t *testing.T) {
439439
mp[mountPermissionsField] = "0750"
440440
mp[storageAuthTypeField] = "msi"
441441
mp[storageIdentityClientIDField] = "msi"
442+
mp[clientIDField] = "clientID"
443+
mp[tenantIDField] = "tenantID"
442444
mp[storageIdentityObjectIDField] = "msi"
443445
mp[storageIdentityResourceIDField] = "msi"
444446
mp[msiEndpointField] = "msi"

0 commit comments

Comments
 (0)