From 07526633e24c87eb48b35a76dc587cf16ca36fe8 Mon Sep 17 00:00:00 2001
From: Chad Roberts <chad.roberts@suse.com>
Date: Tue, 22 Oct 2024 10:52:37 -0400
Subject: [PATCH] Non provider-specific changes to use wrangler over norman

Signed-off-by: Chad Roberts <chad.roberts@suse.com>
---
 pkg/auth/cleanup/service.go                    | 6 +++---
 pkg/auth/providers/setup.go                    | 3 +--
 pkg/controllers/management/auth/auth_config.go | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/pkg/auth/cleanup/service.go b/pkg/auth/cleanup/service.go
index f7bc564db8f..a40f2af0d9a 100644
--- a/pkg/auth/cleanup/service.go
+++ b/pkg/auth/cleanup/service.go
@@ -9,7 +9,7 @@ import (
 	v3 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3"
 	"github.com/rancher/rancher/pkg/auth/api/secrets"
 	controllers "github.com/rancher/rancher/pkg/generated/controllers/management.cattle.io/v3"
-	corev1 "github.com/rancher/rancher/pkg/generated/norman/core/v1"
+	wcorev1 "github.com/rancher/wrangler/v3/pkg/generated/controllers/core/v1"
 	apierrors "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/labels"
@@ -19,7 +19,7 @@ var errAuthConfigNil = errors.New("cannot get auth provider if its config is nil
 
 // Service performs cleanup of resources associated with an auth provider.
 type Service struct {
-	secretsInterface corev1.SecretInterface
+	secretsInterface wcorev1.SecretController
 
 	userClient controllers.UserClient
 
@@ -37,7 +37,7 @@ type Service struct {
 }
 
 // NewCleanupService creates and returns a new auth provider cleanup service.
-func NewCleanupService(secretsInterface corev1.SecretInterface, c controllers.Interface) *Service {
+func NewCleanupService(secretsInterface wcorev1.SecretController, c controllers.Interface) *Service {
 	return &Service{
 		secretsInterface: secretsInterface,
 
diff --git a/pkg/auth/providers/setup.go b/pkg/auth/providers/setup.go
index d8785a00cef..5522a6227f5 100644
--- a/pkg/auth/providers/setup.go
+++ b/pkg/auth/providers/setup.go
@@ -7,7 +7,6 @@ import (
 	"github.com/rancher/norman/types"
 	"github.com/rancher/rancher/pkg/auth/api/secrets"
 	client "github.com/rancher/rancher/pkg/client/generated/management/v3"
-	"github.com/rancher/rancher/pkg/namespace"
 	managementschema "github.com/rancher/rancher/pkg/schemas/management.cattle.io/v3"
 	"github.com/rancher/rancher/pkg/types/config"
 )
@@ -34,7 +33,7 @@ func SetupAuthConfig(ctx context.Context, management *config.ScaledContext, sche
 	Configure(ctx, management)
 
 	authConfigBaseSchema := schemas.Schema(&managementschema.Version, client.AuthConfigType)
-	authConfigBaseSchema.Store = secrets.Wrap(authConfigBaseSchema.Store, management.Core.Secrets(namespace.GlobalNamespace))
+	authConfigBaseSchema.Store = secrets.Wrap(authConfigBaseSchema.Store, management.Wrangler.Core.Secret())
 	for _, authConfigSubtype := range authConfigTypes {
 		subSchema := schemas.Schema(&managementschema.Version, authConfigSubtype)
 		GetProviderByType(authConfigSubtype).CustomizeSchema(subSchema)
diff --git a/pkg/controllers/management/auth/auth_config.go b/pkg/controllers/management/auth/auth_config.go
index f6f4ffdacd4..568c8c22c7c 100644
--- a/pkg/controllers/management/auth/auth_config.go
+++ b/pkg/controllers/management/auth/auth_config.go
@@ -52,7 +52,7 @@ func newAuthConfigController(context context.Context, mgmt *config.ManagementCon
 	controller := &authConfigController{
 		users:                   mgmt.Management.Users("").Controller().Lister(),
 		authRefresher:           providerrefresh.NewUserAuthRefresher(context, scaledContext),
-		cleanup:                 cleanup.NewCleanupService(mgmt.Core.Secrets(""), mgmt.Wrangler.Mgmt),
+		cleanup:                 cleanup.NewCleanupService(mgmt.Wrangler.Core.Secret(), mgmt.Wrangler.Mgmt),
 		authConfigsUnstructured: scaledContext.Management.AuthConfigs("").ObjectClient().UnstructuredClient(),
 	}
 	return controller