mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +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
|
var err error
|
||||||
klog.V(4).Infof("azureDisk - creating new managed Name:%s StorageAccountType:%s Size:%v", options.DiskName, options.StorageAccountType, options.SizeGB)
|
klog.V(4).Infof("azureDisk - creating new managed Name:%s StorageAccountType:%s Size:%v", options.DiskName, options.StorageAccountType, options.SizeGB)
|
||||||
|
|
||||||
var createZones *[]string
|
var createZones []string
|
||||||
if len(options.AvailabilityZone) > 0 && options.AvailabilityZone != "0" {
|
if len(options.AvailabilityZone) > 0 {
|
||||||
zoneList := []string{c.common.cloud.GetZoneID(options.AvailabilityZone)}
|
requestedZone := c.common.cloud.GetZoneID(options.AvailabilityZone)
|
||||||
createZones = &zoneList
|
if requestedZone != "" {
|
||||||
|
createZones = append(createZones, requestedZone)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert original tags to newTags
|
// insert original tags to newTags
|
||||||
@ -167,8 +169,8 @@ func (c *ManagedDiskController) CreateManagedDisk(options *ManagedDiskOptions) (
|
|||||||
DiskProperties: &diskProperties,
|
DiskProperties: &diskProperties,
|
||||||
}
|
}
|
||||||
|
|
||||||
if createZones != nil && len(*createZones) > 0 {
|
if len(createZones) > 0 {
|
||||||
model.Zones = createZones
|
model.Zones = &createZones
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.ResourceGroup == "" {
|
if options.ResourceGroup == "" {
|
||||||
|
@ -77,7 +77,7 @@ func (p *Provider) CreatePD(zone string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do not use blank zone definition
|
// do not use blank zone definition
|
||||||
if len(zone) > 0 && zone != "0" {
|
if len(zone) > 0 {
|
||||||
volumeOptions.AvailabilityZone = zone
|
volumeOptions.AvailabilityZone = zone
|
||||||
}
|
}
|
||||||
return p.azureCloud.CreateManagedDisk(volumeOptions)
|
return p.azureCloud.CreateManagedDisk(volumeOptions)
|
||||||
|
Loading…
Reference in New Issue
Block a user