Skip to content

Commit

Permalink
Avoid nil pointer panic while assigning private IP on Azure
Browse files Browse the repository at this point in the history
If any previously assigned IP present in IP configurations
of the NIC is removed from public load balancer backend pool
then cloud-network-config-controller starts to panic due to
a nil pointer.

This PR checks whether load balancer backend pull is nil or
not before proceeding further.

Signed-off-by: Arnab Ghosh <arnabghosh89@gmail.com>
  • Loading branch information
arghosh93 authored and openshift-cherrypick-robot committed Apr 12, 2024
1 parent 78d453a commit 573759c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/cloudprovider/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ func (a *Azure) AssignPrivateIP(ip net.IP, node *corev1.Node) error {
// UserDefinedRouting, which doesn't impose such constraints on secondary IPs.
loadBalancerBackendAddressPoolsArgument := (*networkInterface.IPConfigurations)[0].LoadBalancerBackendAddressPools
var attachedOutboundRule *network.SubResource
if (*networkInterface.IPConfigurations)[0].LoadBalancerBackendAddressPools != nil {
OuterLoop:
for _, ipconfig := range *networkInterface.IPConfigurations {
OuterLoop:
for _, ipconfig := range *networkInterface.IPConfigurations {
if ipconfig.LoadBalancerBackendAddressPools != nil {
for _, pool := range *ipconfig.LoadBalancerBackendAddressPools {
if pool.ID == nil {
continue
Expand Down

0 comments on commit 573759c

Please sign in to comment.