From fe00b2de76fe39ada2593cd7a42a7a1624c2caea Mon Sep 17 00:00:00 2001 From: Timo Notheisen <65653426+tnotheis@users.noreply.github.com> Date: Thu, 23 May 2024 10:07:23 +0200 Subject: [PATCH] Helm Chart: Scaling the event handler is not possible (#666) * feat: make replicas configurable * feat: add HorizontalPodAutoscaler --- helm/templates/eventhandler/deployment.yaml | 6 ++--- helm/templates/eventhandler/hpa.yaml | 28 +++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 helm/templates/eventhandler/hpa.yaml diff --git a/helm/templates/eventhandler/deployment.yaml b/helm/templates/eventhandler/deployment.yaml index 57c9ce8cf1..db3bcfd456 100644 --- a/helm/templates/eventhandler/deployment.yaml +++ b/helm/templates/eventhandler/deployment.yaml @@ -6,12 +6,12 @@ metadata: {{- include "global.labels" . | nindent 4 }} app: {{ .Values.eventhandler.name }} spec: - replicas: 1 + replicas: {{ .Values.eventhandler.replicas }} strategy: type: RollingUpdate rollingUpdate: - maxSurge: {{ .Values.maxSurge }} - maxUnavailable: {{ .Values.maxUnavailable }} + maxSurge: {{ .Values.eventhandler.maxSurge }} + maxUnavailable: {{ .Values.eventhandler.maxUnavailable }} selector: matchLabels: app: {{ .Values.eventhandler.name }} diff --git a/helm/templates/eventhandler/hpa.yaml b/helm/templates/eventhandler/hpa.yaml new file mode 100644 index 0000000000..61095e6efb --- /dev/null +++ b/helm/templates/eventhandler/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.eventhandler.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ .Values.eventhandler.name }} + labels: + {{- include "global.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ .Values.eventhandler.name }} + minReplicas: {{ .Values.eventhandler.autoscaling.minReplicas }} + maxReplicas: {{ .Values.eventhandler.autoscaling.maxReplicas }} + metrics: + {{- if .Values.eventhandler.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.eventhandler.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.eventhandler.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.eventhandler.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }}