diff --git a/charts/aws-ebs-csi-driver/templates/controller.yaml b/charts/aws-ebs-csi-driver/templates/controller.yaml index 3763a933ac..7350f829c3 100644 --- a/charts/aws-ebs-csi-driver/templates/controller.yaml +++ b/charts/aws-ebs-csi-driver/templates/controller.yaml @@ -350,6 +350,18 @@ spec: - --csi-address=$(ADDRESS) - --v={{ .Values.sidecars.resizer.logLevel }} - --handle-volume-inuse-error=false + - --leader-election={{ (.Values.sidecars.resizer.leaderElection).enabled | required "leader election state for csi-resizer is required, must be set to true || false." }} + {{- if .Values.sidecars.resizer.leaderElection.enabled }} + {{- if .Values.sidecars.resizer.leaderElection.leaseDuration }} + - --leader-election-lease-duration={{ .Values.sidecars.resizer.leaderElection.leaseDuration }} + {{- end }} + {{- if .Values.sidecars.resizer.leaderElection.renewDeadline}} + - --leader-election-renew-deadline={{ .Values.sidecars.resizer.leaderElection.renewDeadline }} + {{- end }} + {{- if .Values.sidecars.resizer.leaderElection.retryPeriod }} + - --leader-election-retry-period={{ .Values.sidecars.resizer.leaderElection.retryPeriod }} + {{- end }} + {{- end }} env: - name: ADDRESS value: /var/lib/csi/sockets/pluginproxy/csi.sock diff --git a/charts/aws-ebs-csi-driver/values.yaml b/charts/aws-ebs-csi-driver/values.yaml index 944ea2e26c..51c13bc493 100644 --- a/charts/aws-ebs-csi-driver/values.yaml +++ b/charts/aws-ebs-csi-driver/values.yaml @@ -84,6 +84,16 @@ sidecars: pullPolicy: IfNotPresent repository: public.ecr.aws/eks-distro/kubernetes-csi/external-resizer tag: "v1.8.0-eks-1-27-3" + # Tune leader lease election for csi-resizer. + # Leader election is on by default. + leaderElection: + enabled: true + # Optional values to tune lease behavior. + # The arguments provided must be in an acceptable time.ParseDuration format. + # Ref: https://pkg.go.dev/flag#Duration + # leaseDuration: "15s" + # renewDeadline: "10s" + # retryPeriod: "5s" logLevel: 2 resources: {} securityContext: diff --git a/deploy/kubernetes/base/controller.yaml b/deploy/kubernetes/base/controller.yaml index 0b1e89774b..1830c1f80a 100644 --- a/deploy/kubernetes/base/controller.yaml +++ b/deploy/kubernetes/base/controller.yaml @@ -206,6 +206,7 @@ spec: - --csi-address=$(ADDRESS) - --v=2 - --handle-volume-inuse-error=false + - --leader-election=true env: - name: ADDRESS value: /var/lib/csi/sockets/pluginproxy/csi.sock