Skip to content

Commit d55edd8

Browse files
committed
add vpa
1 parent d059eb3 commit d55edd8

3 files changed

Lines changed: 66 additions & 0 deletions

File tree

‎charts/etcd-operator/templates/workload/deployment.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ spec:
4545
readinessProbe:
4646
{{- toYaml . | nindent 12 }}
4747
{{- end }}
48+
{{- if not .Values.etcdOperator.vpa.enabled }}
4849
{{- with .Values.etcdOperator.resources }}
4950
resources:
5051
{{- toYaml . | nindent 12 }}
5152
{{- end }}
53+
{{- end }}
5254
{{- with .Values.etcdOperator.securityContext }}
5355
securityContext:
5456
{{- toYaml . | nindent 12 }}
@@ -87,10 +89,12 @@ spec:
8789
readinessProbe:
8890
{{- toYaml . | nindent 12 }}
8991
{{- end }}
92+
{{- if not .Values.kubeRbacProxy.vpa.enabled }}
9093
{{- with .Values.kubeRbacProxy.resources }}
9194
resources:
9295
{{- toYaml . | nindent 12 }}
9396
{{- end }}
97+
{{- end }}
9498
{{- with .Values.kubeRbacProxy.securityContext }}
9599
securityContext:
96100
{{- toYaml . | nindent 12 }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{- if or .Values.etcdOperator.vpa.enabled .Values.kubeRbacProxy.vpa.enabled }}
2+
apiVersion: autoscaling.k8s.io/v1
3+
kind: VerticalPodAutoscaler
4+
metadata:
5+
name: {{ include "etcd-operator.fullname" . }}-controller-manager
6+
labels:
7+
{{- include "etcd-operator.labels" . | nindent 4 }}
8+
spec:
9+
targetRef:
10+
apiVersion: "apps/v1"
11+
kind: Deployment
12+
name: {{ include "etcd-operator.fullname" . }}-controller-manager
13+
updatePolicy:
14+
updateMode: {{ .Values.vpa.updatePolicy | default "Auto" | quote }}
15+
resourcePolicy:
16+
containerPolicies:
17+
{{- if .Values.etcdOperator.vpa.enabled }}
18+
- containerName: etcd-operator
19+
{{- with .Values.etcdOperator.vpa.minAllowed }}
20+
minAllowed:
21+
{{- toYaml . | nindent 10 }}
22+
{{- end }}
23+
{{- with .Values.etcdOperator.vpa.maxAllowed }}
24+
maxAllowed:
25+
{{- toYaml . | nindent 10 }}
26+
{{- end }}
27+
controlledResources: ["cpu", "memory"]
28+
{{- end }}
29+
{{- if .Values.kubeRbacProxy.vpa.enabled }}
30+
- containerName: kube-rbac-proxy
31+
{{- with .Values.kubeRbacProxy.vpa.minAllowed }}
32+
minAllowed:
33+
{{- toYaml . | nindent 10 }}
34+
{{- end }}
35+
{{- with .Values.kubeRbacProxy.vpa.maxAllowed }}
36+
maxAllowed:
37+
{{- toYaml . | nindent 10 }}
38+
{{- end }}
39+
controlledResources: ["cpu", "memory"]
40+
{{- end }}
41+
{{- end }}

‎charts/etcd-operator/values.yaml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ etcdOperator:
8484
drop:
8585
- ALL
8686

87+
vpa:
88+
enabled: true
89+
minAllowed:
90+
cpu: 100m
91+
memory: 128Mi
92+
maxAllowed:
93+
cpu: 1
94+
memory: 1Gi
95+
8796
kubeRbacProxy:
8897

8998
image:
@@ -142,6 +151,15 @@ kubeRbacProxy:
142151
drop:
143152
- ALL
144153

154+
vpa:
155+
enabled: true
156+
minAllowed:
157+
cpu: 50m
158+
memory: 64Mi
159+
maxAllowed:
160+
cpu: 500m
161+
memory: 256Mi
162+
145163
# -- Kubernetes cluster domain prefix
146164
kubernetesClusterDomain: cluster.local
147165

@@ -182,3 +200,6 @@ tolerations: []
182200

183201
# -- ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity
184202
affinity: {}
203+
204+
vpa:
205+
updatePolicy: "Auto"

0 commit comments

Comments
 (0)