diff --git a/cmd/controller/controller.go b/cmd/controller/controller.go index 4e5be8c3b5b..1c81323f181 100644 --- a/cmd/controller/controller.go +++ b/cmd/controller/controller.go @@ -13,12 +13,12 @@ import ( v1 "k8s.io/api/authorization/v1" apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apiserver/pkg/server" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/tools/leaderelection" "k8s.io/client-go/tools/leaderelection/resourcelock" "k8s.io/client-go/tools/record" "k8s.io/klog/v2" + "sigs.k8s.io/controller-runtime/pkg/manager/signals" kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" "github.com/kubeovn/kube-ovn/pkg/controller" @@ -35,7 +35,7 @@ func CmdMain() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() go func() { - stopCh := server.SetupSignalHandler() + stopCh := signals.SetupSignalHandler().Done() <-stopCh cancel() }() diff --git a/go.mod b/go.mod index ed2cc26efd0..d6bd5608bb2 100644 --- a/go.mod +++ b/go.mod @@ -42,7 +42,6 @@ require ( gopkg.in/k8snetworkplumbingwg/multus-cni.v4 v4.0.2 k8s.io/api v0.27.3 k8s.io/apimachinery v0.27.3 - k8s.io/apiserver v0.27.3 k8s.io/client-go v12.0.0+incompatible k8s.io/klog/v2 v2.100.1 k8s.io/kubectl v0.27.3 @@ -248,6 +247,7 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.27.3 // indirect + k8s.io/apiserver v0.27.3 // indirect k8s.io/cli-runtime v0.27.3 // indirect k8s.io/cloud-provider v0.27.3 // indirect k8s.io/cluster-bootstrap v0.27.3 // indirect diff --git a/pkg/controller/ovn_dnat.go b/pkg/controller/ovn_dnat.go index baa8a02eb4d..f1118c51182 100644 --- a/pkg/controller/ovn_dnat.go +++ b/pkg/controller/ovn_dnat.go @@ -6,8 +6,6 @@ import ( "fmt" "net" - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "github.com/kubeovn/kube-ovn/pkg/util" "github.com/ovn-org/libovsdb/ovsdb" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -16,6 +14,9 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/klog/v2" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + + kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" + "github.com/kubeovn/kube-ovn/pkg/util" ) func (c *Controller) enqueueAddOvnDnatRule(obj interface{}) { diff --git a/pkg/controller/ovn_fip.go b/pkg/controller/ovn_fip.go index 43e7507f3de..ee7e1fefddd 100644 --- a/pkg/controller/ovn_fip.go +++ b/pkg/controller/ovn_fip.go @@ -5,8 +5,6 @@ import ( "encoding/json" "fmt" - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "github.com/kubeovn/kube-ovn/pkg/util" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -14,6 +12,9 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/klog/v2" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + + kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" + "github.com/kubeovn/kube-ovn/pkg/util" ) func (c *Controller) enqueueAddOvnFip(obj interface{}) { diff --git a/pkg/controller/ovn_snat.go b/pkg/controller/ovn_snat.go index a868126d1c7..cdefaf62053 100644 --- a/pkg/controller/ovn_snat.go +++ b/pkg/controller/ovn_snat.go @@ -5,8 +5,6 @@ import ( "encoding/json" "fmt" - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "github.com/kubeovn/kube-ovn/pkg/util" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -14,6 +12,9 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/klog/v2" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + + kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" + "github.com/kubeovn/kube-ovn/pkg/util" ) func (c *Controller) enqueueAddOvnSnatRule(obj interface{}) {