From 8e501b431973a41c6da2b3fd70878272bf6a49e5 Mon Sep 17 00:00:00 2001 From: Pierre Besson <513471+PierreBesson@users.noreply.github.com> Date: Wed, 25 Sep 2024 10:32:26 +0200 Subject: [PATCH] add HPA custom metrics to common helm chart (#358) --- charts/common/Chart.yaml | 2 +- charts/common/README.md | 3 ++- charts/common/templates/hpa.yaml | 3 +++ charts/common/values.yaml | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index 78653d20..2d3b6408 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: common description: A generic helm chart for Kubernetes type: application -version: 0.7.2 +version: 0.8.0 maintainers: - name: Parity url: https://github.com/paritytech/helm-charts diff --git a/charts/common/README.md b/charts/common/README.md index 25f0300b..e58ba1cc 100644 --- a/charts/common/README.md +++ b/charts/common/README.md @@ -25,7 +25,8 @@ This is intended behaviour. Make sure to run `git add -A` once again to stage ch | additionalPodSpec | object | `{}` | Additional Pod Spec | | affinity | object | `{}` | Assign custom affinity rules | | args | list | `[]` | Override default container args | -| autoscaling | object | `{"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80}` | Autoscaling should be enabled for statefulsets ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ | +| autoscaling | object | `{"customMetrics":[],"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80}` | Autoscaling should be enabled for statefulsets ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ | +| autoscaling.customMetrics | list | `[]` | Custom HPA metrics | | autoscaling.enabled | bool | `false` | Enable autoscaling | | autoscaling.maxReplicas | int | `100` | Maximum number of pods | | autoscaling.minReplicas | int | `1` | Minimum number of pods | diff --git a/charts/common/templates/hpa.yaml b/charts/common/templates/hpa.yaml index b3fa15cf..b8d7a2a3 100644 --- a/charts/common/templates/hpa.yaml +++ b/charts/common/templates/hpa.yaml @@ -42,4 +42,7 @@ spec: targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} {{- end }} {{- end }} + {{- if .Values.autoscaling.customMetrics }} + {{- toYaml .Values.autoscaling.customMetrics | nindent 8 }} + {{- end }} {{- end }} diff --git a/charts/common/values.yaml b/charts/common/values.yaml index 6f8653de..9ea45488 100644 --- a/charts/common/values.yaml +++ b/charts/common/values.yaml @@ -248,6 +248,8 @@ autoscaling: # -- Target CPU utilization percentage targetCPUUtilizationPercentage: 80 # targetMemoryUtilizationPercentage: 80 + # -- Custom HPA metrics + customMetrics: [] # -- If enabled, create service monitor of Prometheus-Operator # ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md#include-servicemonitors