Skip to content

Commit 2a6e851

Browse files
committed
Added sane defaults for HPA to stabilize the scaling behavior
1 parent 7643431 commit 2a6e851

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

wiz-admission-controller/templates/_helpers.tpl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,18 @@ requests:
234234
false
235235
{{- end }}
236236
{{- end }}
237+
238+
{{- define "wiz-admission-controller.hpaBehavior" -}}
239+
{{- if hasKey .Values.hpa "behavior" }}
240+
{{- toYaml .Values.hpa.behavior }}
241+
{{- else -}}
242+
scaleUp:
243+
stabilizationWindowSeconds: 300
244+
scaleDown:
245+
stabilizationWindowSeconds: 300
246+
policies:
247+
- type: Pods
248+
value: 1
249+
periodSeconds: 300
250+
{{- end -}}
251+
{{- end -}}

wiz-admission-controller/templates/hpa.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ spec:
3535
{{- with .Values.hpa.customMetrics }}
3636
{{- toYaml . | nindent 4 }}
3737
{{- end }}
38-
{{- if hasKey .Values.hpa "behavior" }}
39-
behavior:
40-
{{- toYaml .Values.hpa.behavior | nindent 4 }}
41-
{{- end }}
38+
behavior: {{ include "wiz-admission-controller.hpaBehavior" . | nindent 4 }}
4239
---
4340
{{- end }}
4441
{{ if .Values.kubernetesAuditLogsWebhook.enabled -}}
@@ -76,9 +73,6 @@ spec:
7673
{{- with .Values.hpa.customMetrics }}
7774
{{- toYaml . | nindent 4 }}
7875
{{- end }}
79-
{{- if hasKey .Values.hpa "behavior" }}
80-
behavior:
81-
{{- toYaml .Values.hpa.behavior | nindent 4 }}
82-
{{- end }}
76+
behavior: {{ include "wiz-admission-controller.hpaBehavior" . | nindent 4 }}
8377
{{- end }}
8478
{{- end }}

wiz-admission-controller/values.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,17 @@ hpa:
447447
enableMemory: false
448448
targetMemoryUtilizationPercentage: 50
449449
customMetrics: []
450-
# Uncomment to customize the behavior.
451-
# If not set, the default HPAScalingRules for scale up and scale down are used.
452-
#behavior: {}
450+
# Uncomment the `behavior` section below to specify custom scaling policies and behavior.
451+
# If left blank, the following is applied:
452+
# behavior:
453+
# scaleUp:
454+
# stabilizationWindowSeconds: 300
455+
# scaleDown:
456+
# stabilizationWindowSeconds: 300
457+
# policies:
458+
# - type: Pods
459+
# value: 1
460+
# periodSeconds: 300
453461

454462
# Global values to override chart values.
455463
global:

0 commit comments

Comments
 (0)