Skip to content

Commit b299b3d

Browse files
fix: return early in service reconciler when lb is nil
When buildModel returns lb == nil (e.g. for a ClusterIP service that should not have a load balancer, such as one created by Istio Gateway API with networking.istio.io/service-type: ClusterIP), the reconciler correctly runs cleanupLoadBalancerResources but then falls through to reconcileLoadBalancerResources with lb still nil. This causes a nil pointer dereference panic at lb.DNSName().Resolve(ctx). Add a return nil after successful cleanup when lb == nil so the reconciler exits cleanly without entering the LB provisioning path. Related: #4724 Signed-off-by: Joey Jonko <joey.jonko@happyreturns.com>
1 parent 46816a2 commit b299b3d

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

controllers/service/service_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ func (r *serviceReconciler) reconcile(ctx context.Context, req reconcile.Request
137137
if err != nil {
138138
return ctrlerrors.NewErrorWithMetrics(controllerName, "cleanup_load_balancer_error", err, r.metricsCollector)
139139
}
140+
return nil
140141
}
141142
return r.reconcileLoadBalancerResources(ctx, svc, stack, lb, backendSGRequired)
142143
}

0 commit comments

Comments
 (0)