From 4e8cd8a73d21838566346db618950277c3b95f1d Mon Sep 17 00:00:00 2001 From: Oz Ben Simhon Date: Sun, 25 Jan 2026 11:22:58 +0200 Subject: [PATCH 1/2] wip --- helm/templates/hpa.yaml | 38 ++++++++++++++++++++++++++++++++++++++ helm/values.yaml | 12 ++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 helm/templates/hpa.yaml diff --git a/helm/templates/hpa.yaml b/helm/templates/hpa.yaml new file mode 100644 index 0000000..f5fb25c --- /dev/null +++ b/helm/templates/hpa.yaml @@ -0,0 +1,38 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "app.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "app.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "app.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.cpu.enabled }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.cpu.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.memory.enabled }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.memory.targetMemoryUtilizationPercentage }} + {{- end }} + {{- with .Values.autoscaling.behavior }} + behavior: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} + diff --git a/helm/values.yaml b/helm/values.yaml index 99b0d66..0af7939 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -64,6 +64,18 @@ tolerations: [] affinity: {} +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 2 + cpu: + enabled: true + targetCPUUtilizationPercentage: 70 + memory: + enabled: false + targetMemoryUtilizationPercentage: 80 + behavior: {} + # Environment variables to pass to the hub container env: [] # - name: DEBUG From d09fc5184e7713fd626db5f98f91e4af996ad2a5 Mon Sep 17 00:00:00 2001 From: Oz Ben Simhon Date: Sun, 25 Jan 2026 16:04:44 +0200 Subject: [PATCH 2/2] wip --- helm/templates/hpa.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/templates/hpa.yaml b/helm/templates/hpa.yaml index f5fb25c..dd2c56a 100644 --- a/helm/templates/hpa.yaml +++ b/helm/templates/hpa.yaml @@ -1,4 +1,4 @@ -{{- if .Values.autoscaling.enabled }} +{{- if and .Values.autoscaling.enabled (or .Values.autoscaling.cpu.enabled .Values.autoscaling.memory.enabled) }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: