From 5fd0df7dfb068da54c85e81fcd825478c7176f57 Mon Sep 17 00:00:00 2001 From: zhangzujian Date: Tue, 20 Dec 2022 14:05:04 +0800 Subject: [PATCH 1/2] remove unused subnet status fields --- cmd/controller/controller.go | 17 +++++++++-------- go.mod | 2 +- pkg/apis/kubeovn/v1/types.go | 2 -- pkg/controller/vpc_nat_gw_eip.go | 7 ++++--- pkg/controller/vpc_nat_gw_nat.go | 5 +++-- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/cmd/controller/controller.go b/cmd/controller/controller.go index dcca1b068ed..7e728e81340 100644 --- a/cmd/controller/controller.go +++ b/cmd/controller/controller.go @@ -3,25 +3,26 @@ package controller import ( "context" "fmt" + "net/http" + "net/http/pprof" + "os" + "time" + + "github.com/prometheus/client_golang/prometheus/promhttp" + 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" - "net/http" - "net/http/pprof" - "os" - "time" + "k8s.io/klog/v2" "github.com/kubeovn/kube-ovn/pkg/controller" "github.com/kubeovn/kube-ovn/pkg/ovs" "github.com/kubeovn/kube-ovn/pkg/util" "github.com/kubeovn/kube-ovn/versions" - "github.com/prometheus/client_golang/prometheus/promhttp" - v1 "k8s.io/api/authorization/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/klog/v2" ) const ovnLeaderResource = "kube-ovn-controller" diff --git a/go.mod b/go.mod index 18bb633af09..d2a9099b14f 100644 --- a/go.mod +++ b/go.mod @@ -40,6 +40,7 @@ require ( gopkg.in/k8snetworkplumbingwg/multus-cni.v3 v3.9.2 k8s.io/api v0.26.0 k8s.io/apimachinery v0.26.0 + k8s.io/apiserver v0.26.0 k8s.io/client-go v12.0.0+incompatible k8s.io/klog/v2 v2.80.1 k8s.io/kubernetes v1.26.0 @@ -230,7 +231,6 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.26.0 // indirect - k8s.io/apiserver v0.26.0 // indirect k8s.io/cloud-provider v0.26.0 // indirect k8s.io/cluster-bootstrap v0.26.0 // indirect k8s.io/component-base v0.26.0 // indirect diff --git a/pkg/apis/kubeovn/v1/types.go b/pkg/apis/kubeovn/v1/types.go index 82f76ed1994..30de978874c 100644 --- a/pkg/apis/kubeovn/v1/types.go +++ b/pkg/apis/kubeovn/v1/types.go @@ -179,8 +179,6 @@ type SubnetStatus struct { // +patchStrategy=merge Conditions []SubnetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` - AvailableIPs float64 `json:"availableIPs"` - UsingIPs float64 `json:"usingIPs"` V4AvailableIPs float64 `json:"v4availableIPs"` V4UsingIPs float64 `json:"v4usingIPs"` V6AvailableIPs float64 `json:"v6availableIPs"` diff --git a/pkg/controller/vpc_nat_gw_eip.go b/pkg/controller/vpc_nat_gw_eip.go index 181b105efdf..57fa3f49c9d 100644 --- a/pkg/controller/vpc_nat_gw_eip.go +++ b/pkg/controller/vpc_nat_gw_eip.go @@ -8,9 +8,6 @@ import ( "strings" "time" - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "github.com/kubeovn/kube-ovn/pkg/ovs" - "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/fields" @@ -19,6 +16,10 @@ 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/ovs" + "github.com/kubeovn/kube-ovn/pkg/util" ) var ( diff --git a/pkg/controller/vpc_nat_gw_nat.go b/pkg/controller/vpc_nat_gw_nat.go index 52d5ba511dc..a90b71dc482 100644 --- a/pkg/controller/vpc_nat_gw_nat.go +++ b/pkg/controller/vpc_nat_gw_nat.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) enqueueAddIptablesFip(obj interface{}) { From c8df6b2a07adcd831800d92397db3235a43048b1 Mon Sep 17 00:00:00 2001 From: zhangzujian Date: Tue, 20 Dec 2022 14:13:03 +0800 Subject: [PATCH 2/2] check whether go mod is tidy --- .github/workflows/build-x86-image.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-x86-image.yaml b/.github/workflows/build-x86-image.yaml index 769c6a34c3d..7de573fbcf7 100644 --- a/.github/workflows/build-x86-image.yaml +++ b/.github/workflows/build-x86-image.yaml @@ -64,6 +64,7 @@ jobs: - name: Build run: | go mod tidy + git diff --exit-code make lint make image-kube-ovn make tar-kube-ovn