Skip to content

Commit f1667b1

Browse files
authored
Merge pull request #1942 from k8s-infra-cherrypick-robot/cherry-pick-1939-to-release-1.25
[release-1.25] fix: allow clientID, tenantID workload identity parameters in storage class
2 parents 0211226 + cbe445e commit f1667b1

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
@@ -100,8 +100,8 @@ const (
100100
ephemeralField = "csi.storage.k8s.io/ephemeral"
101101
podNamespaceField = "csi.storage.k8s.io/pod.namespace"
102102
serviceAccountTokenField = "csi.storage.k8s.io/serviceAccount.tokens"
103-
clientIDField = "clientID"
104-
tenantIDField = "tenantID"
103+
clientIDField = "clientid"
104+
tenantIDField = "tenantid"
105105
mountOptionsField = "mountoptions"
106106
falseValue = "false"
107107
trueValue = "true"
@@ -541,9 +541,9 @@ func (d *Driver) GetAuthEnv(ctx context.Context, volumeID, protocol string, attr
541541
if getLatestAccountKey, err = strconv.ParseBool(v); err != nil {
542542
return rgName, accountName, accountKey, containerName, authEnv, fmt.Errorf("invalid %s: %s in volume context", getLatestAccountKeyField, v)
543543
}
544-
case strings.ToLower(clientIDField):
544+
case clientIDField:
545545
clientID = v
546-
case strings.ToLower(tenantIDField):
546+
case tenantIDField:
547547
tenantID = v
548548
case strings.ToLower(serviceAccountTokenField):
549549
serviceAccountToken = v
@@ -582,7 +582,9 @@ func (d *Driver) GetAuthEnv(ctx context.Context, volumeID, protocol string, attr
582582
}
583583

584584
authEnv = append(authEnv, "AZURE_STORAGE_SPN_CLIENT_ID="+clientID)
585-
authEnv = append(authEnv, "AZURE_STORAGE_SPN_TENANT_ID="+tenantID)
585+
if tenantID != "" {
586+
authEnv = append(authEnv, "AZURE_STORAGE_SPN_TENANT_ID="+tenantID)
587+
}
586588
authEnv = append(authEnv, "WORKLOAD_IDENTITY_TOKEN="+workloadIdentityToken)
587589

588590
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
@@ -187,6 +187,8 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
187187
case storageIdentityClientIDField:
188188
case storageIdentityObjectIDField:
189189
case storageIdentityResourceIDField:
190+
case clientIDField:
191+
case tenantIDField:
190192
case msiEndpointField:
191193
case storageAADEndpointField:
192194
// 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
@@ -449,6 +449,8 @@ func TestCreateVolume(t *testing.T) {
449449
mp[mountPermissionsField] = "0750"
450450
mp[storageAuthTypeField] = "msi"
451451
mp[storageIdentityClientIDField] = "msi"
452+
mp[clientIDField] = "clientID"
453+
mp[tenantIDField] = "tenantID"
452454
mp[storageIdentityObjectIDField] = "msi"
453455
mp[storageIdentityResourceIDField] = "msi"
454456
mp[msiEndpointField] = "msi"

0 commit comments

Comments
 (0)