Skip to content

Commit 550c67a

Browse files
committed
Configurable throughput for clients to the API server.
Defaults for QPS and Burst remain unchanged. This change also creates a new client for leader election.
1 parent 91a2a04 commit 550c67a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

cmd/csi-provisioner/csi-provisioner.go

+15-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ var (
7474

7575
defaultFSType = flag.String("default-fstype", "", "The default filesystem type of the volume to provision when fstype is unspecified in the StorageClass. If the default is not set and fstype is unset in the StorageClass, then no fstype will be set")
7676

77+
kubeAPIQPS = flag.Float32("kube-api-qps", 5, "QPS to use while communicating with the kubernetes apiserver. Defaults to 5.0.")
78+
kubeAPIBurst = flag.Int("kube-api-burst", 10, "Burst to use while communicating with the kubernetes apiserver. Defaults to 10.")
79+
7780
featureGates map[string]bool
7881
provisionController *controller.ProvisionController
7982
version = "unknown"
@@ -124,10 +127,15 @@ func main() {
124127
if err != nil {
125128
klog.Fatalf("Failed to create config: %v", err)
126129
}
130+
131+
config.QPS = *kubeAPIQPS
132+
config.Burst = *kubeAPIBurst
133+
127134
clientset, err := kubernetes.NewForConfig(config)
128135
if err != nil {
129136
klog.Fatalf("Failed to create client: %v", err)
130137
}
138+
131139
// snapclientset.NewForConfig creates a new Clientset for VolumesnapshotV1beta1Client
132140
snapClient, err := snapclientset.NewForConfig(config)
133141
if err != nil {
@@ -282,7 +290,13 @@ func main() {
282290
// to preserve backwards compatibility
283291
lockName := strings.Replace(provisionerName, "/", "-", -1)
284292

285-
le := leaderelection.NewLeaderElection(clientset, lockName, run)
293+
// create a new clientset for leader election
294+
leClientset, err := kubernetes.NewForConfig(config)
295+
if err != nil {
296+
klog.Fatalf("Failed to create leaderelection client: %v", err)
297+
}
298+
299+
le := leaderelection.NewLeaderElection(leClientset, lockName, run)
286300

287301
if *leaderElectionNamespace != "" {
288302
le.WithNamespace(*leaderElectionNamespace)

0 commit comments

Comments
 (0)