From a56c8bcc586a59ef67b75719c6a71194e4ca9c82 Mon Sep 17 00:00:00 2001 From: Philipp Hossner Date: Fri, 20 Dec 2024 11:25:17 +0000 Subject: [PATCH] MAJOR: kubernetes-ingress: Support to specify HPA behavior Signed-off-by: Philipp Hossner --- kubernetes-ingress/ci/deployment-hpa-values.yaml | 12 ++++++++++++ kubernetes-ingress/templates/controller-hpa.yaml | 3 +++ kubernetes-ingress/values.yaml | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/kubernetes-ingress/ci/deployment-hpa-values.yaml b/kubernetes-ingress/ci/deployment-hpa-values.yaml index f3a5701..f5da547 100644 --- a/kubernetes-ingress/ci/deployment-hpa-values.yaml +++ b/kubernetes-ingress/ci/deployment-hpa-values.yaml @@ -4,6 +4,18 @@ controller: minReplicas: 1 maxReplicas: 5 targetCPUUtilizationPercentage: 80 + behavior: + scaleUp: + policies: + - type: Percent + value: 900 + periodSeconds: 60 + scaleDown: + stabilizationWindowSeconds: 600 + policies: + - type: Pods + value: 1 + periodSeconds: 600 defaultBackend: autoscaling: diff --git a/kubernetes-ingress/templates/controller-hpa.yaml b/kubernetes-ingress/templates/controller-hpa.yaml index 3f596c0..27772df 100644 --- a/kubernetes-ingress/templates/controller-hpa.yaml +++ b/kubernetes-ingress/templates/controller-hpa.yaml @@ -44,6 +44,9 @@ spec: name: {{ include "kubernetes-ingress.fullname" . }} minReplicas: {{ .Values.controller.autoscaling.minReplicas }} maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }} + {{- if .Values.controller.autoscaling.behavior }} + behavior: {{- toYaml .Values.controller.autoscaling.behavior | nindent 4 }} + {{- end }} metrics: {{- if .Values.controller.autoscaling.targetCPUUtilizationPercentage }} - type: Resource diff --git a/kubernetes-ingress/values.yaml b/kubernetes-ingress/values.yaml index 436ffec..b2170dc 100644 --- a/kubernetes-ingress/values.yaml +++ b/kubernetes-ingress/values.yaml @@ -235,6 +235,12 @@ controller: annotations: {} # annotationKey: value + ## Behavior + ## ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior + # behavior: + # scaleDown: + # stabilizationWindowSeconds: 3600 + ## Custom metrics (example) ## ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#autoscaling-on-multiple-metrics-and-custom-metrics # custom: