mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #65443 from jsafrane/azure-zone
Automatic merge from submit-queue (batch tested with PRs 64246, 65489, 65443). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. azure: Move configuration of resource group in storage class. **What this PR does / why we need it**: This moves configuration of Azure resource group into storage class. Users can't configure dynamic provisioning in PVCs, because that makes the PVC not portable to other Kubernetes installations, possibly on other clouds. /sig storage /assign @andyzhangx **Release note**: ```release-note NONE ```
This commit is contained in:
commit
23000cfbd3
@ -43,10 +43,6 @@ type azureDiskDeleter struct {
|
|||||||
var _ volume.Provisioner = &azureDiskProvisioner{}
|
var _ volume.Provisioner = &azureDiskProvisioner{}
|
||||||
var _ volume.Deleter = &azureDiskDeleter{}
|
var _ volume.Deleter = &azureDiskDeleter{}
|
||||||
|
|
||||||
// PVCAnnotationResourceGroup is the annotation used on the PVC
|
|
||||||
// to specify the resource group of azure managed disk that are not in the same resource group as the cluster.
|
|
||||||
const PVCAnnotationResourceGroup = "volume.beta.kubernetes.io/resource-group"
|
|
||||||
|
|
||||||
func (d *azureDiskDeleter) GetPath() string {
|
func (d *azureDiskDeleter) GetPath() string {
|
||||||
return getPath(d.podUID, d.dataDisk.diskName, d.plugin.host)
|
return getPath(d.podUID, d.dataDisk.diskName, d.plugin.host)
|
||||||
}
|
}
|
||||||
@ -98,6 +94,7 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
|
|||||||
cachingMode v1.AzureDataDiskCachingMode
|
cachingMode v1.AzureDataDiskCachingMode
|
||||||
strKind string
|
strKind string
|
||||||
err error
|
err error
|
||||||
|
resourceGroup string
|
||||||
)
|
)
|
||||||
// maxLength = 79 - (4 for ".vhd") = 75
|
// maxLength = 79 - (4 for ".vhd") = 75
|
||||||
name := util.GenerateVolumeName(p.options.ClusterName, p.options.PVName, 75)
|
name := util.GenerateVolumeName(p.options.ClusterName, p.options.PVName, 75)
|
||||||
@ -121,6 +118,8 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
|
|||||||
cachingMode = v1.AzureDataDiskCachingMode(v)
|
cachingMode = v1.AzureDataDiskCachingMode(v)
|
||||||
case volume.VolumeParameterFSType:
|
case volume.VolumeParameterFSType:
|
||||||
fsType = strings.ToLower(v)
|
fsType = strings.ToLower(v)
|
||||||
|
case "resourcegroup":
|
||||||
|
resourceGroup = v
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("AzureDisk - invalid option %s in storage class", k)
|
return nil, fmt.Errorf("AzureDisk - invalid option %s in storage class", k)
|
||||||
}
|
}
|
||||||
@ -149,10 +148,6 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
|
|||||||
// create disk
|
// create disk
|
||||||
diskURI := ""
|
diskURI := ""
|
||||||
if kind == v1.AzureManagedDisk {
|
if kind == v1.AzureManagedDisk {
|
||||||
resourceGroup := ""
|
|
||||||
if rg, found := p.options.PVC.Annotations[PVCAnnotationResourceGroup]; found {
|
|
||||||
resourceGroup = rg
|
|
||||||
}
|
|
||||||
tags := make(map[string]string)
|
tags := make(map[string]string)
|
||||||
if p.options.CloudTags != nil {
|
if p.options.CloudTags != nil {
|
||||||
tags = *(p.options.CloudTags)
|
tags = *(p.options.CloudTags)
|
||||||
|
Loading…
Reference in New Issue
Block a user