Skip to content

Commit df298c5

Browse files
committed
UPSTREAM: 8755: Fix panic for GetZoneByNodeName on Azure Stack
Azure Stack does not support the API Version, 2020-12-01, for PlatformFaultDomain, and therefore panics when we run the cloud provider on Azure Stack. This avoids the panic, but we cannot get the correct PlatformFaultDomain (which may not be an issue).
1 parent cc04736 commit df298c5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/provider/azure_standard.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,11 @@ func (as *availabilitySet) GetZoneByNodeName(ctx context.Context, name string) (
580580
failureDomain = as.makeZone(ptr.Deref(vm.Location, ""), zoneID)
581581
} else {
582582
// Availability zone is not used for the node, falling back to fault domain.
583-
failureDomain = strconv.Itoa(int(ptr.Deref(vm.Properties.InstanceView.PlatformFaultDomain, 0)))
583+
if prop := vm.Properties; prop == nil || prop.InstanceView == nil {
584+
failureDomain = "0"
585+
} else {
586+
failureDomain = strconv.Itoa(int(ptr.Deref(vm.Properties.InstanceView.PlatformFaultDomain, 0)))
587+
}
584588
}
585589

586590
zone := cloudprovider.Zone{

0 commit comments

Comments
 (0)