Merge pull request #40030 from colemickens/colemickens-dyn-disk-name-length

Automatic merge from submit-queue (batch tested with PRs 39826, 40030)

azure disk: restrict length of name

**What this PR does / why we need it**:
Fixes dynamic disk provisioning on Azure by properly truncating the disk name to conform to the Azure API spec.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
n/a

**Special notes for your reviewer**:
n/a

**Release note**:
```release-note
azure disk: restrict name length for Azure specifications
```

cc: @rootfs
This commit is contained in:
Kubernetes Submit Queue 2017-01-17 21:37:02 -08:00 committed by GitHub
commit 8f99b74466

View File

@ -108,7 +108,8 @@ var _ volume.Provisioner = &azureDiskProvisioner{}
func (a *azureDiskProvisioner) Provision() (*v1.PersistentVolume, error) {
var sku, location, account string
name := volume.GenerateVolumeName(a.options.ClusterName, a.options.PVName, 255)
// maxLength = 79 - (4 for ".vhd") = 75
name := volume.GenerateVolumeName(a.options.ClusterName, a.options.PVName, 75)
capacity := a.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
requestBytes := capacity.Value()
requestGB := int(volume.RoundUpSize(requestBytes, 1024*1024*1024))