Skip to content

Commit

Permalink
azure: Move configuration of resource group in storage class.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsafrane committed Jun 25, 2018
1 parent 67e7d4c commit 291f277
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pkg/volume/azure_dd/azure_provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
Expand All @@ -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)
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 291f277

Please sign in to comment.