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