From 3527c735dcc54d3c9f83cc1920aa9682f76cc114 Mon Sep 17 00:00:00 2001 From: Maia Iyer Date: Mon, 21 Oct 2024 12:56:28 -0400 Subject: [PATCH] Register type Signed-off-by: Maia Iyer --- pkg/agent/spirecrd/crdmanager.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/agent/spirecrd/crdmanager.go b/pkg/agent/spirecrd/crdmanager.go index 80944509..fde89e69 100644 --- a/pkg/agent/spirecrd/crdmanager.go +++ b/pkg/agent/spirecrd/crdmanager.go @@ -8,16 +8,18 @@ import ( "k8s.io/client-go/rest" //"k8s.io/client-go/dynamic" "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/scheme" // metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - // "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/runtime/schema" spirev1alpha1 "github.com/spiffe/spire-controller-manager/api/v1alpha1" ) -/*var gvrClusterFederatedTrustDomain = schema.GroupVersionResource{ +var gvr = schema.GroupVersion{ Group: "spire.spiffe.io", Version: "v1alpha1", - Resource: "clusterfederatedtrustdomains", -}*/ +} + +var SchemeBuilder = &scheme.Builder{GroupVersion: gvr} // CRDManager defines the interface for managing CRDs type CRDManager interface { @@ -44,6 +46,9 @@ func NewSPIRECRDManager(className string) (*SPIRECRDManager, error) { return nil, fmt.Errorf("Error creating kube client: %v", err) } + SchemeBuilder.Register(&spirev1alpha1.ClusterFederatedTrustDomain{}) + SchemeBuilder.Register(&spirev1alpha1.ClusterFederatedTrustDomainList{}) + return &SPIRECRDManager{ className: className, kubeClient: kubeClient,