From d7671ca70406cf662ef3306c0b1707f543bbdc1d Mon Sep 17 00:00:00 2001 From: Stanislav Khalash Date: Mon, 16 Dec 2024 18:35:15 +0100 Subject: [PATCH] chore: Remove validating webhook deletion logic (#1684) --- internal/reconciler/telemetry/reconciler.go | 24 --------------------- 1 file changed, 24 deletions(-) diff --git a/internal/reconciler/telemetry/reconciler.go b/internal/reconciler/telemetry/reconciler.go index bc168d725..749f5c3bb 100644 --- a/internal/reconciler/telemetry/reconciler.go +++ b/internal/reconciler/telemetry/reconciler.go @@ -7,8 +7,6 @@ import ( "gopkg.in/yaml.v3" admissionregistrationv1 "k8s.io/api/admissionregistration/v1" corev1 "k8s.io/api/core/v1" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -136,10 +134,6 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu } func (r *Reconciler) doReconcile(ctx context.Context, telemetry *operatorv1alpha1.Telemetry) error { - if err := r.deleteOldValidatingWebhook(ctx); err != nil { - return fmt.Errorf("failed to delete old validating webhook: %w", err) - } - if err := r.handleFinalizer(ctx, telemetry); err != nil { return fmt.Errorf("failed to manage finalizer: %w", err) } @@ -301,21 +295,3 @@ func (r *Reconciler) reconcileWebhook(ctx context.Context, telemetry *operatorv1 return nil } - -func (r *Reconciler) deleteOldValidatingWebhook(ctx context.Context) error { - oldValidatingWebhook := &admissionregistrationv1.ValidatingWebhookConfiguration{ - ObjectMeta: metav1.ObjectMeta{ - Name: "validation.webhook.telemetry.kyma-project.io", - }, - } - - if err := r.Delete(ctx, oldValidatingWebhook); err != nil { - if apierrors.IsNotFound(err) { - return nil - } - - return fmt.Errorf("failed to delete old validating webhook: %w", err) - } - - return nil -}