From c2764014d2b552dee41d173b008c68bb2c2e9c44 Mon Sep 17 00:00:00 2001 From: Kubermatic Bot <41968677+kubermatic-bot@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:54:33 +0200 Subject: [PATCH] Handle possible nil map assignment (#70) Signed-off-by: Waleed Malik Co-authored-by: Waleed Malik --- internal/controllers/kubelb/loadbalancer_controller.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/controllers/kubelb/loadbalancer_controller.go b/internal/controllers/kubelb/loadbalancer_controller.go index 00de9d8..7d7cbdb 100644 --- a/internal/controllers/kubelb/loadbalancer_controller.go +++ b/internal/controllers/kubelb/loadbalancer_controller.go @@ -284,6 +284,10 @@ func (r *LoadBalancerReconciler) reconcileService(ctx context.Context, loadBalan ports = append(ports, allocatedPort) } + if service.Annotations == nil { + service.Annotations = make(map[string]string) + } + for k, v := range kubelb.PropagateAnnotations(loadBalancer.Annotations, annotations) { service.Annotations[k] = v }