From 520598b27c100d225d4005d4de513dd54fca9354 Mon Sep 17 00:00:00 2001
From: Adam Furbee <Adam.Furbee@sony.com>
Date: Tue, 24 Jun 2025 14:57:33 -0500
Subject: [PATCH] Allow setting kubeclient burst and qps overrides

---
 .../templates/deployment.yaml                   |  3 +++
 deploy/chart/local-path-provisioner/values.yaml | 17 ++++++++++++-----
 main.go                                         | 14 ++++++++++++++
 3 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/deploy/chart/local-path-provisioner/templates/deployment.yaml b/deploy/chart/local-path-provisioner/templates/deployment.yaml
index 73708e3c..789e7298 100644
--- a/deploy/chart/local-path-provisioner/templates/deployment.yaml
+++ b/deploy/chart/local-path-provisioner/templates/deployment.yaml
@@ -67,6 +67,9 @@ spec:
             - --deletion-retry-count
             - {{ .Values.deletionRetryCount | quote }}
           {{- end }}
+          {{- range .Values.extraArgs }}
+            - {{ . }}
+          {{- end }}
           volumeMounts:
             - name: config-volume
               mountPath: /etc/config/
diff --git a/deploy/chart/local-path-provisioner/values.yaml b/deploy/chart/local-path-provisioner/values.yaml
index a2d5c792..95ad3c44 100644
--- a/deploy/chart/local-path-provisioner/values.yaml
+++ b/deploy/chart/local-path-provisioner/values.yaml
@@ -92,13 +92,15 @@ nodePathMap:
 #     ## OR
 #     # See above
 #     nodePathMap: {}
-    
+
 podAnnotations: {}
 
-podSecurityContext: {}
+podSecurityContext:
+  {}
   # runAsNonRoot: true
 
-securityContext: {}
+securityContext:
+  {}
   # allowPrivilegeEscalation: false
   # seccompProfile:
   #   type: RuntimeDefault
@@ -108,7 +110,8 @@ securityContext: {}
   # runAsGroup: 65534
   # readOnlyRootFilesystem: true
 
-resources: {}
+resources:
+  {}
   # We usually recommend not to specify default resources and to leave this as a conscious
   # choice for the user. This also increases chances charts run on environments with little
   # resources, such as Minikube. If you do want to specify resources, uncomment the following
@@ -121,7 +124,8 @@ resources: {}
   #   memory: 128Mi
 
 helperPod:
-  resources: {}
+  resources:
+    {}
     # limits:
     #   cpu: 100m
     #   memory: 128Mi
@@ -174,3 +178,6 @@ configmap:
 
 # Number of retries of failed volume deletion. 0 means retry indefinitely.
 # deletionRetryCount: 15
+
+# Extra arguments to pass to the CLI
+extraArgs: []
diff --git a/main.go b/main.go
index d0a35a06..dbe4e0f0 100644
--- a/main.go
+++ b/main.go
@@ -49,6 +49,8 @@ var (
 	FlagDeletionRetryCount        = "deletion-retry-count"
 	DefaultDeletionRetryCount     = pvController.DefaultFailedDeleteThreshold
 	EnvConfigMountPath            = "CONFIG_MOUNT_PATH"
+	FlagKubeClientBurst           = "kube-client-burst"
+	FlagKubeClientQPS             = "kube-client-qps"
 )
 
 func cmdNotFound(_ *cli.Context, command string) {
@@ -132,6 +134,16 @@ func StartCmd() cli.Command {
 				Usage: "Number of retries of failed volume deletion. 0 means retry indefinitely.",
 				Value: DefaultDeletionRetryCount,
 			},
+			cli.IntFlag{
+				Name:  FlagKubeClientBurst,
+				Usage: "Burst value for kubernetes client.",
+				Value: rest.DefaultBurst,
+			},
+			cli.Float64Flag{
+				Name:  FlagKubeClientQPS,
+				Usage: "QPS value for kubernetes client.",
+				Value: float64(rest.DefaultQPS),
+			},
 		},
 		Action: func(c *cli.Context) {
 			if err := startDaemon(c); err != nil {
@@ -191,6 +203,8 @@ func startDaemon(c *cli.Context) error {
 	if err != nil {
 		return errors.Wrap(err, "unable to get client config")
 	}
+	config.Burst = c.Int(FlagKubeClientBurst)
+	config.QPS = float32(c.Float64(FlagKubeClientQPS))
 
 	kubeClient, err := clientset.NewForConfig(config)
 	if err != nil {
-- 
GitLab