From fcb4548c7db443b397d063af71dc5215404a8198 Mon Sep 17 00:00:00 2001 From: Pedro Vasconcelos Date: Wed, 27 Mar 2024 16:14:28 -0300 Subject: [PATCH] Check cluster router status before reading IP list --- pkg/cloud/services/loadbalancer/loadbalancer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/cloud/services/loadbalancer/loadbalancer.go b/pkg/cloud/services/loadbalancer/loadbalancer.go index 53e93b94f1..b66eb9fbd7 100644 --- a/pkg/cloud/services/loadbalancer/loadbalancer.go +++ b/pkg/cloud/services/loadbalancer/loadbalancer.go @@ -265,10 +265,10 @@ func (s *Service) getOrUpdateAllowedCIDRS(openStackCluster *infrav1.OpenStackClu allowedCIDRs = append(allowedCIDRs, subnet.CIDR) } } + } - if len(openStackCluster.Status.Router.IPs) > 0 { - allowedCIDRs = append(allowedCIDRs, openStackCluster.Status.Router.IPs...) - } + if openStackCluster.Status.Router != nil && len(openStackCluster.Status.Router.IPs) > 0 { + allowedCIDRs = append(allowedCIDRs, openStackCluster.Status.Router.IPs...) } }