From 2c7fb6a0f246198cabff23a1d789f84e2e2e9c45 Mon Sep 17 00:00:00 2001 From: Ben White Date: Thu, 18 Jan 2024 12:21:20 +0100 Subject: [PATCH] Added consumer specific hpa --- charts/posthog/templates/worker-hpa.yaml | 4 ++-- charts/posthog/tests/worker-hpa.yaml | 28 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/charts/posthog/templates/worker-hpa.yaml b/charts/posthog/templates/worker-hpa.yaml index e2938003..2ed074e8 100644 --- a/charts/posthog/templates/worker-hpa.yaml +++ b/charts/posthog/templates/worker-hpa.yaml @@ -11,8 +11,8 @@ spec: kind: Deployment apiVersion: apps/v1 name: {{ template "posthog.fullname" $ }}-worker-{{ .name }} - minReplicas: {{ $.Values.worker.hpa.minpods }} - maxReplicas: {{ $.Values.worker.hpa.maxpods }} + minReplicas: {{ .hpa.minpods | default $.Values.worker.hpa.minpods }} + maxReplicas: {{ .hpa.maxpods | default $.Values.worker.hpa.maxpods }} metrics: {{- with $.Values.worker.hpa.cputhreshold }} - type: Resource diff --git a/charts/posthog/tests/worker-hpa.yaml b/charts/posthog/tests/worker-hpa.yaml index b7737a71..87497624 100644 --- a/charts/posthog/tests/worker-hpa.yaml +++ b/charts/posthog/tests/worker-hpa.yaml @@ -79,3 +79,31 @@ tests: behavior: scaleDown: stabilizationWindowSeconds: 3600 + + - it: respects consumer overrides + set: + worker.enabled: true + worker: + consumers: + - name: default + hpa: + minpods: 5 + maxpods: 50 + hpa: + enabled: true + minpods: 2 + maxpods: 10 + cputhreshold: 70 + behavior: + scaleDown: + stabilizationWindowSeconds: 3600 + asserts: + - equal: + path: spec + value: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: RELEASE-NAME-posthog-worker-default + minReplicas: 5 + maxReplicas: 50 \ No newline at end of file