Add feature to add default labels to all resources (#62)

Fixes #41 
Thanks to @mhartmann-jaconi for the Helm changes in #42
This commit is contained in:
M. Essam
2025-10-07 13:59:50 +03:00
committed by GitHub
parent 1b36287705
commit 4b98bf9ff9
10 changed files with 94 additions and 10 deletions
@@ -27,6 +27,7 @@ type ServiceReconciler struct {
ClusterDNS string
NamespacedNetworks bool
ControllerNamespace string
DefaultLabels map[string]string
}
const (
@@ -138,6 +139,7 @@ func (r *ServiceReconciler) exposeService(ctx context.Context, req ctrl.Request,
Name: "router",
Namespace: routerNamespace,
Finalizers: []string{"netbird.io/cleanup"},
Labels: r.DefaultLabels,
},
Spec: netbirdiov1.NBRoutingPeerSpec{},
}
@@ -205,6 +207,7 @@ func (r *ServiceReconciler) reconcileNBResource(nbResource *netbirdiov1.NBResour
nbResource.ObjectMeta.Name = req.Name
nbResource.ObjectMeta.Namespace = req.Namespace
nbResource.ObjectMeta.Labels = r.DefaultLabels
nbResource.Finalizers = []string{"netbird.io/cleanup"}
nbResource.Spec.Name = resourceName
nbResource.Spec.NetworkID = *routingPeer.Status.NetworkID