From a4bbc8091e803435353df6d37cea10c9d5a0c73a Mon Sep 17 00:00:00 2001 From: Roman Aleksejuk Date: Thu, 13 Jun 2024 12:27:15 +0300 Subject: [PATCH] Add back the horizontal pod autoscaler to zitadel --- charts/zitadel/templates/hpa.yaml | 37 +++++++++++++++++++++++++++++++ charts/zitadel/values.yaml | 9 +++++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 charts/zitadel/templates/hpa.yaml diff --git a/charts/zitadel/templates/hpa.yaml b/charts/zitadel/templates/hpa.yaml new file mode 100644 index 00000000..adfd077d --- /dev/null +++ b/charts/zitadel/templates/hpa.yaml @@ -0,0 +1,37 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "zitadel.fullname" . }} + labels: + {{- include "zitadel.labels" . | nindent 4 }} + app.kubernetes.io/component: hpa + {{- with .Values.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "zitadel.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPU }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPU }} + {{- end }} + {{- if .Values.autoscaling.targetMemory }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemory }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/zitadel/values.yaml b/charts/zitadel/values.yaml index 21aaa456..0faa24ef 100644 --- a/charts/zitadel/values.yaml +++ b/charts/zitadel/values.yaml @@ -234,4 +234,11 @@ pdb: annotations: {} networkPolicies: - enabled: true \ No newline at end of file + enabled: true + +autoscaling: + enabled: true + minReplicas: 3 + maxReplicas: 11 + targetCPU: 80 + targetMemory: 80 \ No newline at end of file