From 0a510a29adba442e4b14ba1cc60f9647cdaafd80 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 14 Aug 2020 13:10:15 +0200 Subject: [PATCH 1/4] fix: Add missing HPA fields to the apm-server chart --- apm-server/templates/hpa.yaml | 9 +++++++++ apm-server/values.yaml | 3 +++ 2 files changed, 12 insertions(+) diff --git a/apm-server/templates/hpa.yaml b/apm-server/templates/hpa.yaml index 928f25789..c31b26c7c 100644 --- a/apm-server/templates/hpa.yaml +++ b/apm-server/templates/hpa.yaml @@ -14,4 +14,13 @@ spec: apiVersion: apps/v1 kind: Deployment name: {{ template "apm.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.averageCpuUtilization }} {{- end }} diff --git a/apm-server/values.yaml b/apm-server/values.yaml index 55b3d06a5..64faef311 100755 --- a/apm-server/values.yaml +++ b/apm-server/values.yaml @@ -142,6 +142,9 @@ fullnameOverride: "" autoscaling: enabled: false + minReplicas: 1 + maxReplicas: 3 + averageCpuUtilization: 50 ingress: enabled: false From 05383d6cff1f64be124fe1641731aa10be938d6f Mon Sep 17 00:00:00 2001 From: David Date: Fri, 14 Aug 2020 13:36:17 +0200 Subject: [PATCH 2/4] feat: Update autoscaling section in README for apm-server --- apm-server/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm-server/README.md b/apm-server/README.md index 8d1b65d63..58d63a793 100644 --- a/apm-server/README.md +++ b/apm-server/README.md @@ -86,7 +86,7 @@ as a reference. They are also used in the automated testing of this chart. |--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------| | `affinity` | Configurable [affinity][] | `{}` | | `apmConfig` | Allows you to add any config files in `/usr/share/apm-server/config` such as `apm-server.yml` | see [values.yaml][] | -| `autoscaling` | Enable the [horizontal pod autoscaler][] | `enabled: false` | +| `autoscaling` | Enable and configure the [horizontal pod autoscaler][] | see [values.yaml][] | | | `envFrom` | Templatable string to be passed to the [environment from variables][] which will be appended to the `envFrom:` definition for the container | `[]` | | `extraContainers` | Templatable string of additional containers to be passed to the `tpl` function | `""` | | `extraEnvs` | Extra [environment variables][] which will be appended to the `env:` definition for the container | `[]` | From 441e43ba960e4c2ec8613bc9aa38f87f4f7fc163 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 14 Aug 2020 13:36:49 +0200 Subject: [PATCH 3/4] feat: Add tests to autoscaling section in apm-server --- apm-server/tests/apmserver_test.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apm-server/tests/apmserver_test.py b/apm-server/tests/apmserver_test.py index 2ce3b70b1..435f4db03 100644 --- a/apm-server/tests/apmserver_test.py +++ b/apm-server/tests/apmserver_test.py @@ -341,3 +341,12 @@ def test_setting_fullnameOverride(): ] == project ) + +def test_enabling_horizontal_pod_autoscaler(): + config = """ +autoscaling: + enabled: true +""" + r = helm_template(config) + + assert "horizontalpodautoscaler" in r From 957e24dde96acde5d8fdb4ef92218c1e6dd73d5a Mon Sep 17 00:00:00 2001 From: David Luengo Date: Tue, 1 Dec 2020 16:05:31 +0100 Subject: [PATCH 4/4] style: Apply black formatting --- apm-server/tests/apmserver_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/apm-server/tests/apmserver_test.py b/apm-server/tests/apmserver_test.py index 435f4db03..a3b1419df 100644 --- a/apm-server/tests/apmserver_test.py +++ b/apm-server/tests/apmserver_test.py @@ -342,6 +342,7 @@ def test_setting_fullnameOverride(): == project ) + def test_enabling_horizontal_pod_autoscaler(): config = """ autoscaling: