Merge pull request #99122 from huffmanca/update-minimum-azure-file-size

Updates the Azure File minimum size for premium accounts
This commit is contained in:
Kubernetes Prow Robot 2021-02-17 11:59:07 -08:00 committed by GitHub
commit 0f140bf1ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -55,8 +55,9 @@ var _ volume.PersistentVolumePlugin = &azureFilePlugin{}
var _ volume.ExpandableVolumePlugin = &azureFilePlugin{}
const (
azureFilePluginName = "kubernetes.io/azure-file"
defaultSecretNamespace = "default"
azureFilePluginName = "kubernetes.io/azure-file"
defaultSecretNamespace = "default"
minimumPremiumShareSize = 100 // GB
)
func getPath(uid types.UID, volName string, host volume.VolumeHost) string {

View File

@ -207,10 +207,15 @@ func (a *azureFileProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
resourceGroup = a.options.PVC.ObjectMeta.Annotations[resourceGroupAnnotation]
}
fileShareSize := int(requestGiB)
// when use azure file premium, account kind should be specified as FileStorage
accountKind := string(storage.StorageV2)
if strings.HasPrefix(strings.ToLower(sku), "premium") {
accountKind = string(storage.FileStorage)
// when using azure file premium, the shares have a minimum size
if fileShareSize < minimumPremiumShareSize {
fileShareSize = minimumPremiumShareSize
}
}
accountOptions := &azure.AccountOptions{
@ -225,7 +230,7 @@ func (a *azureFileProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
shareOptions := &fileclient.ShareOptions{
Name: shareName,
Protocol: storage.SMB,
RequestGiB: requestGiB,
RequestGiB: fileShareSize,
}
account, key, err := a.azureProvider.CreateFileShare(accountOptions, shareOptions)
@ -252,7 +257,7 @@ func (a *azureFileProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
PersistentVolumeReclaimPolicy: a.options.PersistentVolumeReclaimPolicy,
AccessModes: a.options.PVC.Spec.AccessModes,
Capacity: v1.ResourceList{
v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", requestGiB)),
v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", fileShareSize)),
},
PersistentVolumeSource: v1.PersistentVolumeSource{
AzureFile: &v1.AzureFilePersistentVolumeSource{