Add path component to finalizer (#202)

The Kubernetes client warns about not having a path component in the
finalizer. This change adds a unqiue path component for each reconciler
kind.
This commit is contained in:
Philip Laine
2026-04-23 19:18:06 +02:00
committed by GitHub
parent 9838f0dccc
commit 91036022c0
11 changed files with 38 additions and 30 deletions
+3 -2
View File
@@ -33,6 +33,7 @@ import (
nbv1alpha1 "github.com/netbirdio/kubernetes-operator/api/v1alpha1"
"github.com/netbirdio/kubernetes-operator/internal/gatewayutil"
"github.com/netbirdio/kubernetes-operator/internal/k8sutil"
)
type GatewayReconciler struct {
@@ -90,7 +91,7 @@ func (r *GatewayReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
Reason: string(gatewayv1.GatewayReasonAccepted),
}
meta.SetStatusCondition(&gw.Status.Conditions, cond)
controllerutil.AddFinalizer(gw, nbv1alpha1.NetbirdFinalizer)
controllerutil.AddFinalizer(gw, k8sutil.Finalizer("gateway"))
err = sp.Patch(ctx, gw)
if err != nil {
return ctrl.Result{}, err
@@ -158,7 +159,7 @@ func (r *GatewayReconciler) reconcileDelete(ctx context.Context, sp *patch.Seria
}
}
controllerutil.RemoveFinalizer(gw, nbv1alpha1.NetbirdFinalizer)
controllerutil.RemoveFinalizer(gw, k8sutil.Finalizer("gateway"))
err = sp.Patch(ctx, gw)
if err != nil {
return ctrl.Result{}, err