Merge pull request #67171 from feiskyer/fix-zoned

Automatic merge from submit-queue. 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>.

AzureDisk: Parse zoned first before using it

**What this PR does / why we need it**:

`zoned` should be parsed first before using.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes https://github.com/kubernetes/kubernetes/pull/67121#discussion_r208639436

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

/cc @ddebroy @khenidak @andyzhangx
pull/8/head
Kubernetes Submit Queue 2018-08-09 01:05:26 -07:00 committed by GitHub
commit 41d66aaf87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -180,6 +180,11 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
return nil, err
}
zoned, err = parseZoned(strZoned, kind)
if err != nil {
return nil, err
}
if kind != v1.AzureManagedDisk {
if resourceGroup != "" {
return nil, errors.New("StorageClass option 'resourceGroup' can be used only for managed disks")
@ -190,11 +195,6 @@ func (p *azureDiskProvisioner) Provision(selectedNode *v1.Node, allowedTopologie
}
}
zoned, err = parseZoned(strZoned, kind)
if err != nil {
return nil, err
}
if !zoned && (zonePresent || zonesPresent) {
return nil, fmt.Errorf("zone or zones StorageClass parameters must be used together with zoned parameter")
}