From 688dc58139a3459a834113ce219ddfbd0cacfef7 Mon Sep 17 00:00:00 2001 From: Damyan Yordanov Date: Mon, 10 Jun 2024 11:25:16 +0200 Subject: [PATCH] Create ip label map, if not existing --- controllers/ip_controller.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controllers/ip_controller.go b/controllers/ip_controller.go index 738f985..1eac20c 100644 --- a/controllers/ip_controller.go +++ b/controllers/ip_controller.go @@ -100,6 +100,9 @@ func (r *IPReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Re return ctrl.Result{}, err } + if ip.Labels == nil { + ip.Labels = map[string]string{} + } ip.Labels[IPFamilyLabelKey] = string(subnet.Status.Type) err = r.Update(ctx, ip) return ctrl.Result{}, err