From 00c6445529deb5ae6833254e6a88227cf6ea175b Mon Sep 17 00:00:00 2001 From: Yusan Kurban <21994267+yusank@users.noreply.github.com> Date: Mon, 19 Dec 2022 11:13:47 +0800 Subject: [PATCH] fix: register own crd scheme (#4) * fix: register own crd scheme Signed-off-by: Yusan Kurban --- cmd/app/webhook.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- pkg/util/gclient/gclient.go | 3 +++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/app/webhook.go b/cmd/app/webhook.go index 45e33de..9066c3b 100644 --- a/cmd/app/webhook.go +++ b/cmd/app/webhook.go @@ -283,7 +283,7 @@ func (s *setupManager) setupInterrupter() error { Kind: "ClusterValidatePolicy", }, interrupter.NewClusterValidatePolicyInterrupter(baseInterrupter, s.tokenManager, s.client, s.cvpLister)) - return nil + return s.policyInterrupterManager.OnStartUp() } func (s *setupManager) setupOverridePolicyManager() (err error) { diff --git a/go.mod b/go.mod index 3394b78..f679b21 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/go-logr/logr v1.2.3 - github.com/k-cloud-labs/pkg v0.4.1 + github.com/k-cloud-labs/pkg v0.4.2 github.com/open-policy-agent/cert-controller v0.3.0 github.com/spf13/cobra v1.4.0 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index 4440145..7729753 100644 --- a/go.sum +++ b/go.sum @@ -323,8 +323,8 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/k-cloud-labs/pkg v0.4.1 h1:uPbttHdkMBze+F1I9kbrL6EUjbhei0cf4ApN/XRF6iA= -github.com/k-cloud-labs/pkg v0.4.1/go.mod h1:xIgN1grjPSJY7/fKtA+4Q/gWsaVyjmT/AnOagIh2BJM= +github.com/k-cloud-labs/pkg v0.4.2 h1:U8F8wpF06hEabJ1EyKwJ49j146yNixxoWH1ltiKlhlY= +github.com/k-cloud-labs/pkg v0.4.2/go.mod h1:IlPsCdDrC9lTY5eX241KsVvN9FKGMUTm2MEJA1vEQ/I= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= diff --git a/pkg/util/gclient/gclient.go b/pkg/util/gclient/gclient.go index 83be015..6132414 100644 --- a/pkg/util/gclient/gclient.go +++ b/pkg/util/gclient/gclient.go @@ -5,6 +5,8 @@ import ( "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" "sigs.k8s.io/controller-runtime/pkg/client" + + clientsetscheme "github.com/k-cloud-labs/pkg/client/clientset/versioned/scheme" ) // aggregatedScheme aggregates Kubernetes and extended schemes. @@ -13,6 +15,7 @@ var aggregatedScheme = runtime.NewScheme() func init() { var _ = scheme.AddToScheme(aggregatedScheme) // add Kubernetes schemes // add custom crd scheme to aggregatedScheme + var _ = clientsetscheme.AddToScheme(aggregatedScheme) } // NewSchema returns a singleton schema set which aggregated Kubernetes's schemes and extended schemes.