Skip to content

Commit d5ca5ae

Browse files
committed
feat: support allowCrossTenantReplication storage class parameter
Add allowcrosstenantreplication parameter to StorageClass to control cross-tenant object replication on the storage account. When set to false, the storage account cannot be used as source or destination for cross-tenant replication, following least-privilege principles.
1 parent e0d2b98 commit d5ca5ae

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

pkg/azurefile/azurefile.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ const (
126126
allowBlobPublicAccessField = "allowblobpublicaccess"
127127
publicNetworkAccessField = "publicnetworkaccess"
128128
allowSharedKeyAccessField = "allowsharedkeyaccess"
129+
allowCrossTenantReplicationField = "allowcrosstenantreplication"
129130
storageEndpointSuffixField = "storageendpointsuffix"
130131
fsGroupChangePolicyField = "fsgroupchangepolicy"
131132
ephemeralField = "csi.storage.k8s.io/ephemeral"

pkg/azurefile/controllerserver.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
122122
var secretNamespace, pvcNamespace, protocol, customTags, storageEndpointSuffix, networkEndpointType, shareAccessTier, accountAccessTier, rootSquashType, tagValueDelimiter string
123123
var createAccount, useSeretCache, matchTags, selectRandomMatchingAccount, getLatestAccountKey, encryptInTransit, mountWithManagedIdentity, mountWithWIToken bool
124124
var vnetResourceGroup, vnetName, vnetLinkName, publicNetworkAccess, subnetName, shareNamePrefix, fsGroupChangePolicy, useDataPlaneAPI string
125-
var requireInfraEncryption, disableDeleteRetentionPolicy, enableLFS, isMultichannelEnabled, allowSharedKeyAccess *bool
125+
var requireInfraEncryption, disableDeleteRetentionPolicy, enableLFS, isMultichannelEnabled, allowSharedKeyAccess, allowCrossTenantReplication *bool
126126
var provisionedBandwidthMibps, provisionedIops *int32
127127
// set allowBlobPublicAccess as false by default
128128
allowBlobPublicAccess := ptr.To(false)
@@ -225,6 +225,12 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
225225
return nil, status.Errorf(codes.InvalidArgument, "invalid %s: %s in storage class", allowSharedKeyAccessField, v)
226226
}
227227
allowSharedKeyAccess = &value
228+
case allowCrossTenantReplicationField:
229+
value, err := strconv.ParseBool(v)
230+
if err != nil {
231+
return nil, status.Errorf(codes.InvalidArgument, "invalid %s: %s in storage class", allowCrossTenantReplicationField, v)
232+
}
233+
allowCrossTenantReplication = &value
228234
case pvcNameKey:
229235
fileShareNameReplaceMap[pvcNameMetadata] = v
230236
case pvNameKey:
@@ -557,6 +563,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
557563
DisableFileServiceDeleteRetentionPolicy: disableDeleteRetentionPolicy,
558564
AllowBlobPublicAccess: allowBlobPublicAccess,
559565
AllowSharedKeyAccess: allowSharedKeyAccess,
566+
AllowCrossTenantReplication: allowCrossTenantReplication,
560567
PublicNetworkAccess: publicNetworkAccess,
561568
VNetResourceGroup: vnetResourceGroup,
562569
VNetName: vnetName,

vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/storage/azure_storageaccount.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)