From 5c22112cb8c1fa8cc84e33f96763a920886e72fc Mon Sep 17 00:00:00 2001 From: Alejandro Ruiz <4057165+aruiz14@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:44:15 +0200 Subject: [PATCH] refactor(pkg/managementuser/secret): leftover secret lister (#46995) --- pkg/controllers/managementuser/secret/secret.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/controllers/managementuser/secret/secret.go b/pkg/controllers/managementuser/secret/secret.go index 1bf1724e885..91176c68fc0 100644 --- a/pkg/controllers/managementuser/secret/secret.go +++ b/pkg/controllers/managementuser/secret/secret.go @@ -82,7 +82,6 @@ func registerDeferred(ctx context.Context, cluster *config.UserContext) { n := &NamespaceController{ clusterSecretsClient: clusterSecretsClient, - clusterSecretsLister: clusterSecretsClient.Controller().Lister(), managementSecrets: cluster.Management.Core.Secrets("").Controller().Lister(), } cluster.Core.Namespaces("").AddHandler(ctx, "secretsController", n.sync) @@ -118,7 +117,6 @@ func registerDeferred(ctx context.Context, cluster *config.UserContext) { type NamespaceController struct { clusterSecretsClient v1.SecretInterface - clusterSecretsLister v1.SecretLister managementSecrets v1.SecretLister } @@ -149,7 +147,7 @@ func (n *NamespaceController) sync(key string, obj *corev1.Namespace) (runtime.O continue } namespacedSecret := getNamespacedSecret(secret, obj.Name) - if _, err := n.clusterSecretsLister.Get(namespacedSecret.Namespace, namespacedSecret.Name); err == nil { + if _, err := n.clusterSecretsClient.GetNamespaced(namespacedSecret.Namespace, namespacedSecret.Name, metav1.GetOptions{}); err == nil { continue } logrus.Infof("Creating secret [%s] into namespace [%s]", namespacedSecret.Name, obj.Name)