Skip to content

Commit e465174

Browse files
niladrihbarkbay
andauthored
feat(provisioner): Expose Kubernetes client QPS and Burst as flags (#234) (#235)
* Expose Kubernetes client QPS and Burst as flags * feat(operator-yaml): add flags for k8s client qps and burst --------- Signed-off-by: Michael Morello <[email protected]> Signed-off-by: Niladri Halder <[email protected]> Co-authored-by: Michael Morello <[email protected]>
1 parent 6ee366c commit e465174

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

cmd/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ func main() {
9898
&config.DisableExporterMetrics, "disable-exporter-metrics", true, "Exclude metrics about the exporter itself (process_*, go_*).",
9999
)
100100

101+
cmd.PersistentFlags().IntVar(
102+
&config.KubeAPIQPS, "kube-api-qps", 0, "QPS to use while talking with Kubernetes API server.",
103+
)
104+
105+
cmd.PersistentFlags().IntVar(
106+
&config.KubeAPIBurst, "kube-api-burst", 0, "Burst to allow while talking with Kubernetes API server.",
107+
)
108+
101109
config.RIopsLimitPerGB = cmd.PersistentFlags().StringSlice(
102110
"riops-per-gb", []string{},
103111
"Read IOPS per GB limit to use for each volume group prefix, "+

deploy/lvm-operator.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,8 @@ spec:
12731273
args :
12741274
- "--endpoint=$(OPENEBS_CSI_ENDPOINT)"
12751275
- "--plugin=$(OPENEBS_CONTROLLER_DRIVER)"
1276+
- "--kube-api-qps=0"
1277+
- "--kube-api-burst=0"
12761278
volumeMounts:
12771279
- name: socket-dir
12781280
mountPath: /var/lib/csi/sockets/pluginproxy/
@@ -1460,6 +1462,8 @@ spec:
14601462
- "--endpoint=$(OPENEBS_CSI_ENDPOINT)"
14611463
- "--plugin=$(OPENEBS_NODE_DRIVER)"
14621464
- "--listen-address=$(METRICS_LISTEN_ADDRESS)"
1465+
- "--kube-api-qps=0"
1466+
- "--kube-api-burst=0"
14631467
env:
14641468
- name: OPENEBS_NODE_ID
14651469
valueFrom:

pkg/driver/config/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ type Config struct {
7979

8080
// Exclude metrics about the exporter itself (process_*, go_*).
8181
DisableExporterMetrics bool
82+
83+
// KubeAPIQPS is the QPS to use while talking with Kubernetes API server.
84+
KubeAPIQPS int
85+
86+
// KubeAPIBurst is the burst to allow while talking with Kubernetes API server.
87+
KubeAPIBurst int
8288
}
8389

8490
// Default returns a new instance of config

pkg/driver/controller.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,16 @@ func (cs *controller) init() error {
181181
return errors.Wrapf(err, "failed to build kubeconfig")
182182
}
183183

184+
if cs.driver.config.KubeAPIQPS > 0 {
185+
klog.Infof("setting k8s client qps to %d", cs.driver.config.KubeAPIQPS)
186+
cfg.QPS = float32(cs.driver.config.KubeAPIQPS)
187+
}
188+
189+
if cs.driver.config.KubeAPIBurst > 0 {
190+
cfg.Burst = cs.driver.config.KubeAPIBurst
191+
klog.Infof("setting k8s client burst to %d", cs.driver.config.KubeAPIBurst)
192+
}
193+
184194
kubeClient, err := kubernetes.NewForConfig(cfg)
185195
if err != nil {
186196
return errors.Wrap(err, "failed to build k8s clientset")

0 commit comments

Comments
 (0)