Skip to content

Commit a8cd476

Browse files
authored
Added sane defaults for HPA to stabilize the scaling behavior (#426)
* Added sane defaults for HPA to stabilize the scaling behavior
1 parent 7643431 commit a8cd476

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
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: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,19 +437,26 @@ probes: # Probes config for the container
437437
# Horizontal Pod Autoscaling.
438438
# Prerequisites: metrics-server installed on the cluster:
439439
# https://github.com/kubernetes-sigs/metrics-server
440-
#
441440
hpa:
442441
enabled: false
443442
minReplicas: 2
444443
maxReplicas: 5
445444
enableCPU: true
446-
targetCPUUtilizationPercentage: 50
445+
targetCPUUtilizationPercentage: 80
447446
enableMemory: false
448-
targetMemoryUtilizationPercentage: 50
447+
targetMemoryUtilizationPercentage: 80
449448
customMetrics: []
450-
# Uncomment to customize the behavior.
451-
# If not set, the default HPAScalingRules for scale up and scale down are used.
452-
#behavior: {}
449+
# Uncomment the `behavior` section below to specify custom scaling policies and behavior.
450+
# If left blank, the following default settings are applied:
451+
# behavior:
452+
# scaleUp:
453+
# stabilizationWindowSeconds: 300
454+
# scaleDown:
455+
# stabilizationWindowSeconds: 300
456+
# policies:
457+
# - type: Pods
458+
# value: 1
459+
# periodSeconds: 300
453460

454461
# Global values to override chart values.
455462
global:

0 commit comments

Comments
 (0)