From 2b2402f2f8d450011f03c387116d95613065a92b Mon Sep 17 00:00:00 2001 From: QuantumEnigmaa Date: Tue, 28 May 2024 10:36:25 +0200 Subject: [PATCH] remove finalizers from secrets and configmaps --- pkg/common/secret/manager.go | 5 ----- pkg/monitoring/mimir/service.go | 3 --- pkg/monitoring/prometheusagent/secret.go | 5 ----- pkg/monitoring/prometheusagent/service.go | 4 ---- 4 files changed, 17 deletions(-) diff --git a/pkg/common/secret/manager.go b/pkg/common/secret/manager.go index 9bef0007..c76db31b 100644 --- a/pkg/common/secret/manager.go +++ b/pkg/common/secret/manager.go @@ -3,8 +3,6 @@ package secret import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/giantswarm/observability-operator/pkg/monitoring" ) type Manager interface { @@ -20,9 +18,6 @@ func (m SimpleManager) GenerateGenericSecret(secretName string, secretNamespace ObjectMeta: metav1.ObjectMeta{ Name: secretName, Namespace: secretNamespace, - Finalizers: []string{ - monitoring.MonitoringFinalizer, - }, }, Data: map[string][]byte{ key: []byte(value), diff --git a/pkg/monitoring/mimir/service.go b/pkg/monitoring/mimir/service.go index e1f7db15..9e35e001 100644 --- a/pkg/monitoring/mimir/service.go +++ b/pkg/monitoring/mimir/service.go @@ -8,12 +8,10 @@ import ( corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/log" "github.com/giantswarm/observability-operator/pkg/common/password" "github.com/giantswarm/observability-operator/pkg/common/secret" - "github.com/giantswarm/observability-operator/pkg/monitoring" "github.com/giantswarm/observability-operator/pkg/monitoring/prometheusagent" ) @@ -149,7 +147,6 @@ func (ms *MimirService) DeleteIngressSecret(ctx context.Context) error { // Delete the finalizer desired := current.DeepCopy() - controllerutil.RemoveFinalizer(desired, monitoring.MonitoringFinalizer) err = ms.Client.Patch(ctx, current, client.MergeFrom(desired)) if err != nil { return errors.WithStack(err) diff --git a/pkg/monitoring/prometheusagent/secret.go b/pkg/monitoring/prometheusagent/secret.go index dfb7d3f8..cc290614 100644 --- a/pkg/monitoring/prometheusagent/secret.go +++ b/pkg/monitoring/prometheusagent/secret.go @@ -13,8 +13,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/config" "sigs.k8s.io/yaml" - - "github.com/giantswarm/observability-operator/pkg/monitoring" ) const ( @@ -97,9 +95,6 @@ func (pas PrometheusAgentService) buildRemoteWriteSecret(ctx context.Context, ObjectMeta: metav1.ObjectMeta{ Name: getPrometheusAgentRemoteWriteSecretName(cluster), Namespace: cluster.Namespace, - Finalizers: []string{ - monitoring.MonitoringFinalizer, - }, }, Data: map[string][]byte{ "values": marshalledValues, diff --git a/pkg/monitoring/prometheusagent/service.go b/pkg/monitoring/prometheusagent/service.go index ba64568c..378cfc3e 100644 --- a/pkg/monitoring/prometheusagent/service.go +++ b/pkg/monitoring/prometheusagent/service.go @@ -10,13 +10,11 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/log" "github.com/giantswarm/observability-operator/pkg/common" "github.com/giantswarm/observability-operator/pkg/common/organization" "github.com/giantswarm/observability-operator/pkg/common/password" - "github.com/giantswarm/observability-operator/pkg/monitoring" ) type PrometheusAgentService struct { @@ -179,7 +177,6 @@ func (pas PrometheusAgentService) deleteConfigMap(ctx context.Context, cluster * // Delete the finalizer desired := current.DeepCopy() - controllerutil.RemoveFinalizer(desired, monitoring.MonitoringFinalizer) err = pas.Client.Patch(ctx, desired, client.MergeFrom(current)) if err != nil { return errors.WithStack(err) @@ -209,7 +206,6 @@ func (pas PrometheusAgentService) deleteSecret(ctx context.Context, cluster *clu // Delete the finalizer desired := current.DeepCopy() - controllerutil.RemoveFinalizer(desired, monitoring.MonitoringFinalizer) err = pas.Client.Patch(ctx, current, client.MergeFrom(desired)) if err != nil { return errors.WithStack(err)