From 9d1492a945f9a811eb32a0166db7daa3ab8745de Mon Sep 17 00:00:00 2001 From: Lintong Jiang Date: Fri, 10 Dec 2021 12:51:32 -0800 Subject: [PATCH] Fixed the bug introduced by PR 621 and exposed the kube-api-qps cmd option properly --- cmd/csi-snapshotter/main.go | 5 ++--- cmd/snapshot-controller/main.go | 5 ++--- go.mod | 1 - vendor/modules.txt | 1 - 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cmd/csi-snapshotter/main.go b/cmd/csi-snapshotter/main.go index f8021d0b..fe414a0d 100644 --- a/cmd/csi-snapshotter/main.go +++ b/cmd/csi-snapshotter/main.go @@ -28,7 +28,6 @@ import ( "google.golang.org/grpc" - "github.com/spf13/pflag" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" @@ -73,7 +72,7 @@ var ( leaderElectionRenewDeadline = flag.Duration("leader-election-renew-deadline", 10*time.Second, "Duration, in seconds, that the acting leader will retry refreshing leadership before giving up. Defaults to 10 seconds.") leaderElectionRetryPeriod = flag.Duration("leader-election-retry-period", 5*time.Second, "Duration, in seconds, the LeaderElector clients should wait between tries of actions. Defaults to 5 seconds.") - kubeAPIQPS = pflag.Float32("kube-api-qps", 5, "QPS to use while communicating with the kubernetes apiserver. Defaults to 5.0.") + kubeAPIQPS = flag.Float64("kube-api-qps", 5, "QPS to use while communicating with the kubernetes apiserver. Defaults to 5.0.") kubeAPIBurst = flag.Int("kube-api-burst", 10, "Burst to use while communicating with the kubernetes apiserver. Defaults to 10.") metricsAddress = flag.String("metrics-address", "", "(deprecated) The TCP network address where the prometheus metrics endpoint will listen (example: `:8080`). The default is empty string, which means metrics endpoint is disabled. Only one of `--metrics-address` and `--http-endpoint` can be set.") @@ -106,7 +105,7 @@ func main() { os.Exit(1) } - config.QPS = *kubeAPIQPS + config.QPS = (float32)(*kubeAPIQPS) config.Burst = *kubeAPIBurst kubeClient, err := kubernetes.NewForConfig(config) diff --git a/cmd/snapshot-controller/main.go b/cmd/snapshot-controller/main.go index 6962ad8b..c5911557 100644 --- a/cmd/snapshot-controller/main.go +++ b/cmd/snapshot-controller/main.go @@ -27,7 +27,6 @@ import ( "sync" "time" - "github.com/spf13/pflag" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" @@ -62,7 +61,7 @@ var ( leaderElectionRenewDeadline = flag.Duration("leader-election-renew-deadline", 10*time.Second, "Duration, in seconds, that the acting leader will retry refreshing leadership before giving up. Defaults to 10 seconds.") leaderElectionRetryPeriod = flag.Duration("leader-election-retry-period", 5*time.Second, "Duration, in seconds, the LeaderElector clients should wait between tries of actions. Defaults to 5 seconds.") - kubeAPIQPS = pflag.Float32("kube-api-qps", 5, "QPS to use while communicating with the kubernetes apiserver. Defaults to 5.0.") + kubeAPIQPS = flag.Float64("kube-api-qps", 5, "QPS to use while communicating with the kubernetes apiserver. Defaults to 5.0.") kubeAPIBurst = flag.Int("kube-api-burst", 10, "Burst to use while communicating with the kubernetes apiserver. Defaults to 10.") httpEndpoint = flag.String("http-endpoint", "", "The TCP network address where the HTTP server for diagnostics, including metrics, will listen (example: :8080). The default is empty string, which means the server is disabled.") @@ -131,7 +130,7 @@ func main() { os.Exit(1) } - config.QPS = *kubeAPIQPS + config.QPS = (float32)(*kubeAPIQPS) config.Burst = *kubeAPIBurst kubeClient, err := kubernetes.NewForConfig(config) diff --git a/go.mod b/go.mod index dcadc08f..44fb15cb 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,6 @@ require ( github.com/prometheus/client_model v0.2.0 github.com/prometheus/common v0.26.0 github.com/spf13/cobra v1.1.3 - github.com/spf13/pflag v1.0.5 golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/grpc v1.38.0 diff --git a/vendor/modules.txt b/vendor/modules.txt index 37fbf617..c4f646d9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -115,7 +115,6 @@ github.com/prometheus/procfs/internal/util ## explicit github.com/spf13/cobra # github.com/spf13/pflag v1.0.5 -## explicit github.com/spf13/pflag # golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 golang.org/x/net/context