mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Fix possible panic when getting primary IPConfig
This commit is contained in:
parent
5d14ab37af
commit
c0e6296377
@ -221,6 +221,10 @@ func getPrimaryInterfaceID(machine compute.VirtualMachine) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getPrimaryIPConfig(nic network.Interface) (*network.InterfaceIPConfiguration, error) {
|
func getPrimaryIPConfig(nic network.Interface) (*network.InterfaceIPConfiguration, error) {
|
||||||
|
if nic.IPConfigurations == nil {
|
||||||
|
return nil, fmt.Errorf("nic.IPConfigurations for nic (nicname=%q) is nil", *nic.Name)
|
||||||
|
}
|
||||||
|
|
||||||
if len(*nic.IPConfigurations) == 1 {
|
if len(*nic.IPConfigurations) == 1 {
|
||||||
return &((*nic.IPConfigurations)[0]), nil
|
return &((*nic.IPConfigurations)[0]), nil
|
||||||
}
|
}
|
||||||
@ -231,7 +235,7 @@ func getPrimaryIPConfig(nic network.Interface) (*network.InterfaceIPConfiguratio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf("failed to determine the determine primary ipconfig. nicname=%q", *nic.Name)
|
return nil, fmt.Errorf("failed to determine the primary ipconfig. nicname=%q", *nic.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
func isInternalLoadBalancer(lb *network.LoadBalancer) bool {
|
func isInternalLoadBalancer(lb *network.LoadBalancer) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user