Skip to content

Commit

Permalink
Merge branch 'main' into refactor-global-constants
Browse files Browse the repository at this point in the history
  • Loading branch information
hisarbalik authored Dec 17, 2024
2 parents 0cb3ccb + d7671ca commit e514096
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions internal/reconciler/telemetry/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
}

0 comments on commit e514096

Please sign in to comment.