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
```
pull/8/head
Kubernetes Submit Queue 2018-06-27 08:17:17 -07:00 committed by GitHub
commit 23000cfbd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 8 deletions

View File

@ -43,10 +43,6 @@ type azureDiskDeleter struct {
var _ volume.Provisioner = &azureDiskProvisioner{}
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 {
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
strKind string
err error
resourceGroup string
)
// maxLength = 79 - (4 for ".vhd") = 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)
case volume.VolumeParameterFSType:
fsType = strings.ToLower(v)
case "resourcegroup":
resourceGroup = v
default:
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
diskURI := ""
if kind == v1.AzureManagedDisk {
resourceGroup := ""
if rg, found := p.options.PVC.Annotations[PVCAnnotationResourceGroup]; found {
resourceGroup = rg
}
tags := make(map[string]string)
if p.options.CloudTags != nil {
tags = *(p.options.CloudTags)