mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 10:49:15 +00:00
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:
@@ -31,6 +31,7 @@ type NBResourceReconciler struct {
|
||||
ManagementURL string
|
||||
AllowAutomaticPolicyCreation bool
|
||||
ClusterName string
|
||||
DefaultLabels map[string]string
|
||||
netbird *netbird.Client
|
||||
}
|
||||
|
||||
@@ -128,6 +129,7 @@ func (r *NBResourceReconciler) handlePolicyCreate(ctx context.Context, nbResourc
|
||||
Name: generatedName,
|
||||
Annotations: map[string]string{"netbird.io/generated-by": req.NamespacedName.String()},
|
||||
Finalizers: []string{"netbird.io/cleanup"},
|
||||
Labels: r.DefaultLabels,
|
||||
},
|
||||
Spec: netbirdiov1.NBPolicySpec{
|
||||
Name: name,
|
||||
@@ -148,6 +150,7 @@ func (r *NBResourceReconciler) handlePolicyCreate(ctx context.Context, nbResourc
|
||||
if nbPolicy.Annotations == nil {
|
||||
nbPolicy.Annotations = make(map[string]string)
|
||||
}
|
||||
nbPolicy.Labels = r.DefaultLabels
|
||||
nbPolicy.Annotations["netbird.io/generated-by"] = req.NamespacedName.String()
|
||||
nbPolicy.Spec = netbirdiov1.NBPolicySpec{
|
||||
Name: name,
|
||||
@@ -505,6 +508,7 @@ func (r *NBResourceReconciler) handleGroups(ctx context.Context, req ctrl.Reques
|
||||
},
|
||||
},
|
||||
Finalizers: []string{"netbird.io/group-cleanup", "netbird.io/resource-cleanup"},
|
||||
Labels: r.DefaultLabels,
|
||||
},
|
||||
Spec: netbirdiov1.NBGroupSpec{
|
||||
Name: groupName,
|
||||
|
||||
Reference in New Issue
Block a user