mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
Fix nil pointer dereference in the azure provider
PlatformFaultDomain in the VM properties returned by Azure will be nil if the VM is not part of an availability set. Use to.Int32() from the Azure SDK to safely retrieve its value.
This commit is contained in:
@@ -463,7 +463,7 @@ func (as *availabilitySet) GetZoneByNodeName(name string) (cloudprovider.Zone, e
|
||||
failureDomain = as.makeZone(to.String(vm.Location), zoneID)
|
||||
} else {
|
||||
// Availability zone is not used for the node, falling back to fault domain.
|
||||
failureDomain = strconv.Itoa(int(*vm.VirtualMachineProperties.InstanceView.PlatformFaultDomain))
|
||||
failureDomain = strconv.Itoa(int(to.Int32(vm.VirtualMachineProperties.InstanceView.PlatformFaultDomain)))
|
||||
}
|
||||
|
||||
zone := cloudprovider.Zone{
|
||||
|
Reference in New Issue
Block a user