From 5efdf10936b0ec7d6a8ea309375bdb72f27b6e68 Mon Sep 17 00:00:00 2001 From: Xinmin Du <10803082+doris-xm@user.noreply.gitee.com> Date: Tue, 7 Jan 2025 13:57:30 +0800 Subject: [PATCH 1/2] Upgrade klog dependency to v2 Signed-off-by: Xinmin Du <10803082+doris-xm@user.noreply.gitee.com> Signed-off-by: Xinmin Du <2812493086@qq.com> --- cmd/db-manager/v1beta1/main.go | 2 +- .../v1beta1/file-metricscollector/main.go | 2 +- cmd/suggestion/goptuna/v1beta1/main.go | 2 +- go.mod | 3 +-- go.sum | 8 ++------ hack/swagger/main.go | 2 +- pkg/db/v1beta1/common/connection.go | 2 +- pkg/db/v1beta1/db.go | 2 +- pkg/db/v1beta1/mysql/init.go | 2 +- pkg/db/v1beta1/mysql/mysql.go | 2 +- pkg/db/v1beta1/postgres/init.go | 2 +- pkg/db/v1beta1/postgres/postgres.go | 2 +- pkg/metricscollector/v1beta1/common/pns.go | 2 +- .../file-metricscollector/file-metricscollector.go | 2 +- pkg/suggestion/v1beta1/goptuna/service.go | 2 +- 15 files changed, 16 insertions(+), 21 deletions(-) diff --git a/cmd/db-manager/v1beta1/main.go b/cmd/db-manager/v1beta1/main.go index 17f949f0690..d219ff8bd06 100644 --- a/cmd/db-manager/v1beta1/main.go +++ b/cmd/db-manager/v1beta1/main.go @@ -28,7 +28,7 @@ import ( api_pb "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" db "github.com/kubeflow/katib/pkg/db/v1beta1" "github.com/kubeflow/katib/pkg/db/v1beta1/common" - "k8s.io/klog" + "k8s.io/klog/v2" "google.golang.org/grpc" "google.golang.org/grpc/reflection" diff --git a/cmd/metricscollector/v1beta1/file-metricscollector/main.go b/cmd/metricscollector/v1beta1/file-metricscollector/main.go index c91a18060bc..07898ec781f 100644 --- a/cmd/metricscollector/v1beta1/file-metricscollector/main.go +++ b/cmd/metricscollector/v1beta1/file-metricscollector/main.go @@ -53,7 +53,7 @@ import ( psutil "github.com/shirou/gopsutil/v3/process" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - "k8s.io/klog" + "k8s.io/klog/v2" commonv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1" api "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" diff --git a/cmd/suggestion/goptuna/v1beta1/main.go b/cmd/suggestion/goptuna/v1beta1/main.go index 719405d54cc..b76156660cf 100644 --- a/cmd/suggestion/goptuna/v1beta1/main.go +++ b/cmd/suggestion/goptuna/v1beta1/main.go @@ -24,7 +24,7 @@ import ( api_v1_beta1 "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" suggestion "github.com/kubeflow/katib/pkg/suggestion/v1beta1/goptuna" "google.golang.org/grpc" - "k8s.io/klog" + "k8s.io/klog/v2" ) const ( diff --git a/go.mod b/go.mod index 3219346c9f4..5cab171fab1 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( k8s.io/apimachinery v0.29.3 k8s.io/client-go v0.29.3 k8s.io/code-generator v0.29.3 - k8s.io/klog v1.0.0 + k8s.io/klog/v2 v2.130.1 k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 sigs.k8s.io/controller-runtime v0.17.3 sigs.k8s.io/structured-merge-diff/v4 v4.4.1 @@ -150,7 +150,6 @@ require ( k8s.io/apiextensions-apiserver v0.29.2 // indirect k8s.io/component-base v0.29.2 // indirect k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 // indirect - k8s.io/klog/v2 v2.110.1 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect ) diff --git a/go.sum b/go.sum index d8ee4e246b7..42ae156412d 100644 --- a/go.sum +++ b/go.sum @@ -216,9 +216,7 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= @@ -1251,11 +1249,9 @@ k8s.io/component-base v0.29.2 h1:lpiLyuvPA9yV1aQwGLENYyK7n/8t6l3nn3zAtFTJYe8= k8s.io/component-base v0.29.2/go.mod h1:BfB3SLrefbZXiBfbM+2H1dlat21Uewg/5qtKOl8degM= k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 h1:pWEwq4Asjm4vjW7vcsmijwBhOr1/shsbSYiWXmNGlks= k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= -k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= -k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= -k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= -k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-aggregator v0.28.1 h1:rvG4llYnQKHjj6YjjoBPEJxfD1uH0DJwkrJTNKGAaCs= k8s.io/kube-aggregator v0.28.1/go.mod h1:JaLizMe+AECSpO2OmrWVsvnG0V3dX1RpW+Wq/QHbu18= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= diff --git a/hack/swagger/main.go b/hack/swagger/main.go index eda8a9689bb..5e69bc39051 100644 --- a/hack/swagger/main.go +++ b/hack/swagger/main.go @@ -23,7 +23,7 @@ import ( "strings" "github.com/kubeflow/katib/pkg/apis/v1beta1" - "k8s.io/klog" + "k8s.io/klog/v2" "k8s.io/kube-openapi/pkg/common" "k8s.io/kube-openapi/pkg/validation/spec" ) diff --git a/pkg/db/v1beta1/common/connection.go b/pkg/db/v1beta1/common/connection.go index 2f65e19ce96..5709d0594a2 100644 --- a/pkg/db/v1beta1/common/connection.go +++ b/pkg/db/v1beta1/common/connection.go @@ -21,7 +21,7 @@ import ( "fmt" "time" - "k8s.io/klog" + "k8s.io/klog/v2" ) func OpenSQLConn(driverName string, dataSourceName string, interval time.Duration, diff --git a/pkg/db/v1beta1/db.go b/pkg/db/v1beta1/db.go index d5834711023..19a16aad78e 100644 --- a/pkg/db/v1beta1/db.go +++ b/pkg/db/v1beta1/db.go @@ -23,7 +23,7 @@ import ( "github.com/kubeflow/katib/pkg/db/v1beta1/common" "github.com/kubeflow/katib/pkg/db/v1beta1/mysql" "github.com/kubeflow/katib/pkg/db/v1beta1/postgres" - "k8s.io/klog" + "k8s.io/klog/v2" ) func NewKatibDBInterface(dbName string, connectTimeout time.Duration) (common.KatibDBInterface, error) { diff --git a/pkg/db/v1beta1/mysql/init.go b/pkg/db/v1beta1/mysql/init.go index fe2a2987f0b..48587d2d449 100644 --- a/pkg/db/v1beta1/mysql/init.go +++ b/pkg/db/v1beta1/mysql/init.go @@ -19,7 +19,7 @@ package mysql import ( "fmt" - "k8s.io/klog" + "k8s.io/klog/v2" "github.com/kubeflow/katib/pkg/db/v1beta1/common" "github.com/kubeflow/katib/pkg/util/v1beta1/env" diff --git a/pkg/db/v1beta1/mysql/mysql.go b/pkg/db/v1beta1/mysql/mysql.go index b17aee8705f..4c25a188bed 100644 --- a/pkg/db/v1beta1/mysql/mysql.go +++ b/pkg/db/v1beta1/mysql/mysql.go @@ -23,7 +23,7 @@ import ( "time" _ "github.com/go-sql-driver/mysql" - "k8s.io/klog" + "k8s.io/klog/v2" v1beta1 "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" "github.com/kubeflow/katib/pkg/db/v1beta1/common" diff --git a/pkg/db/v1beta1/postgres/init.go b/pkg/db/v1beta1/postgres/init.go index 71c573128c2..6318d0eb983 100644 --- a/pkg/db/v1beta1/postgres/init.go +++ b/pkg/db/v1beta1/postgres/init.go @@ -19,7 +19,7 @@ package postgres import ( "fmt" - "k8s.io/klog" + "k8s.io/klog/v2" "github.com/kubeflow/katib/pkg/db/v1beta1/common" "github.com/kubeflow/katib/pkg/util/v1beta1/env" diff --git a/pkg/db/v1beta1/postgres/postgres.go b/pkg/db/v1beta1/postgres/postgres.go index af60d0b0efc..808af5ad93c 100644 --- a/pkg/db/v1beta1/postgres/postgres.go +++ b/pkg/db/v1beta1/postgres/postgres.go @@ -27,7 +27,7 @@ import ( v1beta1 "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" "github.com/kubeflow/katib/pkg/db/v1beta1/common" "github.com/kubeflow/katib/pkg/util/v1beta1/env" - "k8s.io/klog" + "k8s.io/klog/v2" ) const dbDriver = "postgres" diff --git a/pkg/metricscollector/v1beta1/common/pns.go b/pkg/metricscollector/v1beta1/common/pns.go index 66a5a3f0bb5..08a657d6235 100644 --- a/pkg/metricscollector/v1beta1/common/pns.go +++ b/pkg/metricscollector/v1beta1/common/pns.go @@ -25,7 +25,7 @@ import ( "time" psutil "github.com/shirou/gopsutil/v3/process" - "k8s.io/klog" + "k8s.io/klog/v2" ) // WaitPidsOpts is the input options for metrics collector diff --git a/pkg/metricscollector/v1beta1/file-metricscollector/file-metricscollector.go b/pkg/metricscollector/v1beta1/file-metricscollector/file-metricscollector.go index 27b4520c4cb..a9ddc9ba2cd 100644 --- a/pkg/metricscollector/v1beta1/file-metricscollector/file-metricscollector.go +++ b/pkg/metricscollector/v1beta1/file-metricscollector/file-metricscollector.go @@ -27,7 +27,7 @@ import ( "strings" "time" - "k8s.io/klog" + "k8s.io/klog/v2" commonv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1" v1beta1 "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" diff --git a/pkg/suggestion/v1beta1/goptuna/service.go b/pkg/suggestion/v1beta1/goptuna/service.go index f9f17486b6f..10cea4b3814 100644 --- a/pkg/suggestion/v1beta1/goptuna/service.go +++ b/pkg/suggestion/v1beta1/goptuna/service.go @@ -24,7 +24,7 @@ import ( api_v1_beta1 "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "k8s.io/klog" + "k8s.io/klog/v2" ) const ( From c82c0318eee8dd4d3cf0127e4884367c100a605e Mon Sep 17 00:00:00 2001 From: Xinmin Du <2812493086@qq.com> Date: Tue, 14 Jan 2025 14:34:47 +0800 Subject: [PATCH 2/2] fix: fix conflict with k8s upate Signed-off-by: Xinmin Du <2812493086@qq.com> --- go.mod | 2 +- go.sum | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4947f21b094..3ee6131f3d7 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( k8s.io/apimachinery v0.30.7 k8s.io/client-go v0.30.7 k8s.io/code-generator v0.30.7 - k8s.io/klog v1.0.0 + k8s.io/klog/v2 v2.130.1 k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f sigs.k8s.io/controller-runtime v0.18.5 sigs.k8s.io/structured-merge-diff/v4 v4.4.1 diff --git a/go.sum b/go.sum index 774db0fc200..fa553f56afc 100644 --- a/go.sum +++ b/go.sum @@ -213,7 +213,6 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= @@ -1240,7 +1239,6 @@ k8s.io/code-generator v0.30.7 h1:Vw8991AoEjwW3qjkJhsTJosrlCN+6+VA3KR7wU28Sc0= k8s.io/code-generator v0.30.7/go.mod h1:kMe4cE9rGqC9SoXwHqV7VaD4F8G7UL0BQF6NbRqxOdo= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 h1:NGrVE502P0s0/1hudf8zjgwki1X/TByhmAoILTarmzo= k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8= -k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-aggregator v0.30.3 h1:hy5zfQ7p6BuJgc/XtGp3GBh2MPfOj6b1n3raKKMHOQE=