Make the QPS and Burst of kube client config to be configurable in both csi-snapshotter and snapshot-controller

This commit is contained in:
Lintong Jiang
2021-11-29 11:37:23 -08:00
parent 4a9a465a87
commit f3136decb3
5 changed files with 24 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ import (
"sync"
"time"
"github.com/spf13/pflag"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
@@ -61,6 +62,9 @@ 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.")
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.")
metricsPath = flag.String("metrics-path", "/metrics", "The HTTP path where prometheus metrics will be exposed. Default is `/metrics`.")
retryIntervalStart = flag.Duration("retry-interval-start", time.Second, "Initial retry interval of failed volume snapshot creation or deletion. It doubles with each failure, up to retry-interval-max. Default is 1 second.")
@@ -127,6 +131,9 @@ func main() {
os.Exit(1)
}
config.QPS = *kubeAPIQPS
config.Burst = *kubeAPIBurst
kubeClient, err := kubernetes.NewForConfig(config)
if err != nil {
klog.Error(err.Error())