Skip to content

Commit d74ae66

Browse files
authored
Merge pull request #626 from lintongj/fix-cmd-flag-issue-from-pr-621
Fixed the bug introduced by PR 621 and exposed the kube-api-qps cmd option properly
2 parents 0703120 + 9d1492a commit d74ae66

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

cmd/csi-snapshotter/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828

2929
"google.golang.org/grpc"
3030

31-
"github.com/spf13/pflag"
3231
"k8s.io/client-go/kubernetes"
3332
"k8s.io/client-go/kubernetes/scheme"
3433
"k8s.io/client-go/rest"
@@ -73,7 +72,7 @@ var (
7372
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.")
7473
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.")
7574

76-
kubeAPIQPS = pflag.Float32("kube-api-qps", 5, "QPS to use while communicating with the kubernetes apiserver. Defaults to 5.0.")
75+
kubeAPIQPS = flag.Float64("kube-api-qps", 5, "QPS to use while communicating with the kubernetes apiserver. Defaults to 5.0.")
7776
kubeAPIBurst = flag.Int("kube-api-burst", 10, "Burst to use while communicating with the kubernetes apiserver. Defaults to 10.")
7877

7978
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() {
106105
os.Exit(1)
107106
}
108107

109-
config.QPS = *kubeAPIQPS
108+
config.QPS = (float32)(*kubeAPIQPS)
110109
config.Burst = *kubeAPIBurst
111110

112111
kubeClient, err := kubernetes.NewForConfig(config)

cmd/snapshot-controller/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"sync"
2828
"time"
2929

30-
"github.com/spf13/pflag"
3130
"k8s.io/client-go/kubernetes"
3231
"k8s.io/client-go/kubernetes/scheme"
3332
"k8s.io/client-go/rest"
@@ -62,7 +61,7 @@ var (
6261
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.")
6362
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.")
6463

65-
kubeAPIQPS = pflag.Float32("kube-api-qps", 5, "QPS to use while communicating with the kubernetes apiserver. Defaults to 5.0.")
64+
kubeAPIQPS = flag.Float64("kube-api-qps", 5, "QPS to use while communicating with the kubernetes apiserver. Defaults to 5.0.")
6665
kubeAPIBurst = flag.Int("kube-api-burst", 10, "Burst to use while communicating with the kubernetes apiserver. Defaults to 10.")
6766

6867
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() {
131130
os.Exit(1)
132131
}
133132

134-
config.QPS = *kubeAPIQPS
133+
config.QPS = (float32)(*kubeAPIQPS)
135134
config.Burst = *kubeAPIBurst
136135

137136
kubeClient, err := kubernetes.NewForConfig(config)

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ require (
1717
github.com/prometheus/client_model v0.2.0
1818
github.com/prometheus/common v0.26.0
1919
github.com/spf13/cobra v1.1.3
20-
github.com/spf13/pflag v1.0.5
2120
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5 // indirect
2221
google.golang.org/appengine v1.6.7 // indirect
2322
google.golang.org/grpc v1.38.0

vendor/modules.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ github.com/prometheus/procfs/internal/util
115115
## explicit
116116
github.com/spf13/cobra
117117
# github.com/spf13/pflag v1.0.5
118-
## explicit
119118
github.com/spf13/pflag
120119
# golang.org/x/net v0.0.0-20210520170846-37e1c6afe023
121120
golang.org/x/net/context

0 commit comments

Comments
 (0)