From a806535ed8ebf06095ea8fc5c83bed4170dc22a0 Mon Sep 17 00:00:00 2001 From: Samuel K Date: Sat, 18 Apr 2026 14:46:49 -0500 Subject: [PATCH 1/2] feat: add managerfactory package for generated register imports The register generator template references managerfactory.SharedManagerFactory in the NewRESTFunc type signature. Move this interface definition into apiserver so consumers don't need to define it separately. --- pkg/managerfactory/types.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 pkg/managerfactory/types.go diff --git a/pkg/managerfactory/types.go b/pkg/managerfactory/types.go new file mode 100644 index 00000000..1fca79e9 --- /dev/null +++ b/pkg/managerfactory/types.go @@ -0,0 +1,29 @@ +package managerfactory + +import ( + "context" + + "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/cache" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +// SharedManagerFactory is the interface for retrieving managers +type SharedManagerFactory interface { + Cluster(cluster string) ClusterClientAccess + Management() ManagementClientAccess +} + +// ClusterClientAccess holds the functions for cluster access +type ClusterClientAccess interface { + Config(ctx context.Context) (*rest.Config, error) + UncachedClient(ctx context.Context) (client.Client, error) +} + +// ManagementClientAccess holds the functions for management access +type ManagementClientAccess interface { + Config() *rest.Config + UncachedClient() client.Client + CachedClient() client.Client + Cache() cache.Cache +} From 7ff7463d0a7062d8879e59af310b0b7d4db03287 Mon Sep 17 00:00:00 2001 From: Samuel K Date: Sat, 18 Apr 2026 14:53:49 -0500 Subject: [PATCH 2/2] style: add periods to godoc comments in managerfactory --- pkg/managerfactory/types.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/managerfactory/types.go b/pkg/managerfactory/types.go index 1fca79e9..2097996a 100644 --- a/pkg/managerfactory/types.go +++ b/pkg/managerfactory/types.go @@ -8,19 +8,19 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) -// SharedManagerFactory is the interface for retrieving managers +// SharedManagerFactory is the interface for retrieving managers. type SharedManagerFactory interface { Cluster(cluster string) ClusterClientAccess Management() ManagementClientAccess } -// ClusterClientAccess holds the functions for cluster access +// ClusterClientAccess holds the functions for cluster access. type ClusterClientAccess interface { Config(ctx context.Context) (*rest.Config, error) UncachedClient(ctx context.Context) (client.Client, error) } -// ManagementClientAccess holds the functions for management access +// ManagementClientAccess holds the functions for management access. type ManagementClientAccess interface { Config() *rest.Config UncachedClient() client.Client