diff --git a/cmd/controller/controller.go b/cmd/controller/controller.go index 0c98312addf..ed5cfec6067 100644 --- a/cmd/controller/controller.go +++ b/cmd/controller/controller.go @@ -13,6 +13,7 @@ import ( v1 "k8s.io/api/authorization/v1" apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/tools/leaderelection" "k8s.io/client-go/tools/leaderelection/resourcelock" @@ -52,6 +53,7 @@ func CmdMain() { if err := checkPermission(config); err != nil { util.LogFatalAndExit(err, "failed to check permission") } + utilruntime.Must(kubeovnv1.AddToScheme(scheme.Scheme)) go func() { mux := http.NewServeMux() diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 907e6df0469..dc4ec484840 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -28,7 +28,6 @@ import ( anpinformer "sigs.k8s.io/network-policy-api/pkg/client/informers/externalversions" anplister "sigs.k8s.io/network-policy-api/pkg/client/listers/apis/v1alpha1" - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" kubeovninformer "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions" kubeovnlister "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" ovnipam "github.com/kubeovn/kube-ovn/pkg/ipam" @@ -265,7 +264,6 @@ type Controller struct { // Run creates and runs a new ovn controller func Run(ctx context.Context, config *Configuration) { - utilruntime.Must(kubeovnv1.AddToScheme(scheme.Scheme)) klog.V(4).Info("Creating event broadcaster") eventBroadcaster := record.NewBroadcasterWithCorrelatorOptions(record.CorrelatorOptions{BurstSize: 100}) eventBroadcaster.StartLogging(klog.Infof)