mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Check for empty zone string
This commit is contained in:
parent
850da22c02
commit
9d4329f62c
@ -84,10 +84,12 @@ func (c *ManagedDiskController) CreateManagedDisk(options *ManagedDiskOptions) (
|
||||
var err error
|
||||
klog.V(4).Infof("azureDisk - creating new managed Name:%s StorageAccountType:%s Size:%v", options.DiskName, options.StorageAccountType, options.SizeGB)
|
||||
|
||||
var createZones *[]string
|
||||
if len(options.AvailabilityZone) > 0 && options.AvailabilityZone != "0" {
|
||||
zoneList := []string{c.common.cloud.GetZoneID(options.AvailabilityZone)}
|
||||
createZones = &zoneList
|
||||
var createZones []string
|
||||
if len(options.AvailabilityZone) > 0 {
|
||||
requestedZone := c.common.cloud.GetZoneID(options.AvailabilityZone)
|
||||
if requestedZone != "" {
|
||||
createZones = append(createZones, requestedZone)
|
||||
}
|
||||
}
|
||||
|
||||
// insert original tags to newTags
|
||||
@ -167,8 +169,8 @@ func (c *ManagedDiskController) CreateManagedDisk(options *ManagedDiskOptions) (
|
||||
DiskProperties: &diskProperties,
|
||||
}
|
||||
|
||||
if createZones != nil && len(*createZones) > 0 {
|
||||
model.Zones = createZones
|
||||
if len(createZones) > 0 {
|
||||
model.Zones = &createZones
|
||||
}
|
||||
|
||||
if options.ResourceGroup == "" {
|
||||
|
@ -77,7 +77,7 @@ func (p *Provider) CreatePD(zone string) (string, error) {
|
||||
}
|
||||
|
||||
// do not use blank zone definition
|
||||
if len(zone) > 0 && zone != "0" {
|
||||
if len(zone) > 0 {
|
||||
volumeOptions.AvailabilityZone = zone
|
||||
}
|
||||
return p.azureCloud.CreateManagedDisk(volumeOptions)
|
||||
|
Loading…
Reference in New Issue
Block a user