Skip to content

Commit

Permalink
refactor(pkg/managementuser/secret): leftover secret lister (rancher#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aruiz14 authored Sep 9, 2024
1 parent 0d525c8 commit 5c22112
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/controllers/managementuser/secret/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -118,7 +117,6 @@ func registerDeferred(ctx context.Context, cluster *config.UserContext) {

type NamespaceController struct {
clusterSecretsClient v1.SecretInterface
clusterSecretsLister v1.SecretLister
managementSecrets v1.SecretLister
}

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5c22112

Please sign in to comment.