File tree Expand file tree Collapse file tree 5 files changed +57
-11
lines changed
vertical-pod-autoscaler/charts/vertical-pod-autoscaler Expand file tree Collapse file tree 5 files changed +57
-11
lines changed Original file line number Diff line number Diff line change @@ -97,9 +97,15 @@ The Vertical Pod Autoscaler (VPA) automatically adjusts the CPU and memory resou
9797| updater.image.pullPolicy | string | ` "IfNotPresent" ` | |
9898| updater.image.repository | string | ` "registry.k8s.io/autoscaling/vpa-updater" ` | |
9999| updater.image.tag | string | ` nil ` | |
100+ | updater.leaderElection.enabled | string | ` nil ` | |
101+ | updater.leaderElection.leaseDuration | string | ` "15s" ` | |
102+ | updater.leaderElection.renewDeadline | string | ` "10s" ` | |
103+ | updater.leaderElection.resourceName | string | ` "vpa-updater-lease" ` | |
104+ | updater.leaderElection.resourceNamespace | string | ` "" ` | |
105+ | updater.leaderElection.retryPeriod | string | ` "2s" ` | |
100106| updater.podAnnotations | object | ` {} ` | |
101107| updater.podLabels | object | ` {} ` | |
102- | updater.replicas | int | ` 1 ` | |
108+ | updater.replicas | int | ` 2 ` | |
103109| updater.serviceAccount.annotations | object | ` {} ` | |
104110| updater.serviceAccount.create | bool | ` true ` | |
105111| updater.serviceAccount.labels | object | ` {} ` | |
Original file line number Diff line number Diff line change 4040 valueFrom :
4141 fieldRef :
4242 fieldPath : metadata.namespace
43+ args :
44+ - --v=4
45+ - --stderrthreshold=info
46+ {{- /* Smart auto-enable: if enabled is null, auto-enable when replicas > 1 */ -}}
47+ {{- $leaderElectionEnabled := .Values.updater.leaderElection.enabled }}
48+ {{- if eq $leaderElectionEnabled nil }}
49+ {{- $leaderElectionEnabled = gt (int .Values.updater.replicas) 1 }}
50+ {{- end }}
51+ {{- if $leaderElectionEnabled }}
52+ - --leader-elect=true
53+ - --leader-elect-resource-namespace={{ .Values.updater.leaderElection.resourceNamespace | default .Release.Namespace }}
54+ - --leader-elect-resource-name={{ .Values.updater.leaderElection.resourceName }}
55+ - --leader-elect-lease-duration={{ .Values.updater.leaderElection.leaseDuration }}
56+ - --leader-elect-renew-deadline={{ .Values.updater.leaderElection.renewDeadline }}
57+ - --leader-elect-retry-period={{ .Values.updater.leaderElection.retryPeriod }}
58+ {{- end }}
4359 ports :
4460 - name : prometheus
4561 containerPort : 8943
Original file line number Diff line number Diff line change 1- {{- if and (.Values.updater.enabled) .Values.updater.serviceAccount.create -}}
1+ {{- if and .Values.updater.enabled .Values.rbac.create -}}
2+ {{- /* Smart auto-enable: if enabled is null, auto-enable when replicas > 1 */ -}}
3+ {{- $leaderElectionEnabled := .Values.updater.leaderElection.enabled }}
4+ {{- if eq $leaderElectionEnabled nil }}
5+ {{- $leaderElectionEnabled = gt (int .Values.updater.replicas) 1 }}
6+ {{- end }}
7+ {{- if $leaderElectionEnabled }}
28apiVersion : rbac.authorization.k8s.io/v1
39kind : Role
410metadata :
511 name : {{ include "vertical-pod-autoscaler.updater.fullname" . }}-leader-locking
612 namespace : {{ .Release.Namespace }}
713 labels :
814 {{- include "vertical-pod-autoscaler.updater.labels" . | nindent 4 }}
9- {{- with .Values.updater.serviceAccount.labels }}
10- {{- toYaml . | nindent 4 }}
11- {{- end }}
12- {{- with .Values.updater.serviceAccount.annotations }}
13- annotations :
14- {{- toYaml . | nindent 4 }}
15- {{- end }}
1615rules :
1716 - apiGroups :
1817 - " coordination.k8s.io"
@@ -24,10 +23,12 @@ rules:
2423 - " coordination.k8s.io"
2524 resourceNames :
2625 - vpa-updater
26+ - {{ .Values.updater.leaderElection.resourceName }}
2727 resources :
2828 - leases
2929 verbs :
3030 - get
3131 - watch
3232 - update
3333{{- end -}}
34+ {{- end -}}
Original file line number Diff line number Diff line change 1- {{- if and (.Values.updater.enabled) .Values.rbac.create -}}
1+ {{- if and .Values.updater.enabled .Values.rbac.create -}}
2+ {{- /* Smart auto-enable: if enabled is null, auto-enable when replicas > 1 */ -}}
3+ {{- $leaderElectionEnabled := .Values.updater.leaderElection.enabled }}
4+ {{- if eq $leaderElectionEnabled nil }}
5+ {{- $leaderElectionEnabled = gt (int .Values.updater.replicas) 1 }}
6+ {{- end }}
7+ {{- if $leaderElectionEnabled }}
28apiVersion : rbac.authorization.k8s.io/v1
39kind : RoleBinding
410metadata :
@@ -13,3 +19,4 @@ subjects:
1319 name : {{ include "vertical-pod-autoscaler.updater.fullname" . }}
1420 namespace : {{ .Release.Namespace }}
1521{{- end -}}
22+ {{- end -}}
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ updater:
191191 pullPolicy : IfNotPresent
192192
193193 # Number of Updater replicas to create.
194- replicas : 1
194+ replicas : 2
195195
196196 # Labels to add to the Updater pod.
197197 podLabels : {}
@@ -205,3 +205,19 @@ updater:
205205 labels : {}
206206 # Annotations to add to the Updater service account.
207207 annotations : {}
208+
209+ # Leader election configuration for the Updater.
210+ # When running multiple replicas, leader election ensures only one instance is actively processing.
211+ leaderElection :
212+ # Enable leader election. If not set (null), automatically enabled when replicas > 1
213+ enabled :
214+ # Namespace for the lease resource. Defaults to Release.Namespace if not set.
215+ resourceNamespace : " "
216+ # Name of the lease resource.
217+ resourceName : vpa-updater-lease
218+ # Duration that non-leader candidates will wait after observing a leadership renewal.
219+ leaseDuration : 15s
220+ # Interval between attempts by the acting master to renew a leadership slot.
221+ renewDeadline : 10s
222+ # Duration the clients should wait between attempting acquisition and renewal of a leadership.
223+ retryPeriod : 2s
You can’t perform that action at this time.
0 commit comments