From c6a3616ed0d640ca4a74b5226ff4567a2c49daba Mon Sep 17 00:00:00 2001 From: Ben White Date: Thu, 18 Jan 2024 13:09:43 +0100 Subject: [PATCH] feat: Added consumer specific hpa (#786) --- charts/posthog/Chart.yaml | 2 +- charts/posthog/templates/worker-hpa.yaml | 4 ++-- charts/posthog/tests/worker-hpa.yaml | 25 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/charts/posthog/Chart.yaml b/charts/posthog/Chart.yaml index 45af85f7..460ee1cf 100644 --- a/charts/posthog/Chart.yaml +++ b/charts/posthog/Chart.yaml @@ -11,7 +11,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 30.40.0 +version: 30.41.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. diff --git a/charts/posthog/templates/worker-hpa.yaml b/charts/posthog/templates/worker-hpa.yaml index e2938003..8747649d 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 | default dict ).minpods | default $.Values.worker.hpa.minpods }} + maxReplicas: {{ ( .hpa | default dict ).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..7c5fd29b 100644 --- a/charts/posthog/tests/worker-hpa.yaml +++ b/charts/posthog/tests/worker-hpa.yaml @@ -79,3 +79,28 @@ 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.minReplicas + value: 5 + - equal: + path: spec.maxReplicas + value: 50