From a65cae893840c4a94913978de6be8eb3baa84fd9 Mon Sep 17 00:00:00 2001 From: Peter Wilcsinszky Date: Fri, 8 Nov 2024 17:58:45 +0100 Subject: [PATCH] fix: configcheck cleaner label selector Signed-off-by: Peter Wilcsinszky --- pkg/resources/configcheck/configcheck.go | 5 +++-- pkg/resources/fluentd/fluentd.go | 2 +- pkg/resources/syslogng/syslogng.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/resources/configcheck/configcheck.go b/pkg/resources/configcheck/configcheck.go index 7d59cd508..9d721e20b 100644 --- a/pkg/resources/configcheck/configcheck.go +++ b/pkg/resources/configcheck/configcheck.go @@ -46,11 +46,12 @@ type ConfigCheckCleaner struct { labels client.MatchingLabels } -func NewConfigCheckCleaner(c client.Client, component string) *ConfigCheckCleaner { +func NewConfigCheckCleaner(c client.Client, component string, logging string) *ConfigCheckCleaner { return &ConfigCheckCleaner{ client: c, labels: client.MatchingLabels{ - "app.kubernetes.io/component": component, + "app.kubernetes.io/component": component, + "app.kubernetes.io/managed-by": logging, }, } } diff --git a/pkg/resources/fluentd/fluentd.go b/pkg/resources/fluentd/fluentd.go index 0ecaa607c..aba9872f7 100644 --- a/pkg/resources/fluentd/fluentd.go +++ b/pkg/resources/fluentd/fluentd.go @@ -168,7 +168,7 @@ func (r *Reconciler) Reconcile(ctx context.Context) (*reconcile.Result, error) { } if result, ok := r.Logging.Status.ConfigCheckResults[hash]; ok { - cleaner := configcheck.NewConfigCheckCleaner(r.Client, ComponentConfigCheck) + cleaner := configcheck.NewConfigCheckCleaner(r.Client, ComponentConfigCheck, r.Logging.GetName()) var cleanupErrs error cleanupErrs = errors.Append(cleanupErrs, cleaner.SecretCleanup(ctx, hash)) diff --git a/pkg/resources/syslogng/syslogng.go b/pkg/resources/syslogng/syslogng.go index 374e153d7..a8a3b6447 100644 --- a/pkg/resources/syslogng/syslogng.go +++ b/pkg/resources/syslogng/syslogng.go @@ -142,7 +142,7 @@ func (r *Reconciler) Reconcile(ctx context.Context) (*reconcile.Result, error) { // Cleanup previous configcheck results if result, ok := r.Logging.Status.ConfigCheckResults[hash]; ok { - cleaner := configcheck.NewConfigCheckCleaner(r.Client, ComponentConfigCheck) + cleaner := configcheck.NewConfigCheckCleaner(r.Client, ComponentConfigCheck, r.Logging.GetName()) var cleanupErrs error cleanupErrs = errors.Append(cleanupErrs, cleaner.SecretCleanup(ctx, hash))