From 5bbe4fcd01c44fd345db2f267cc6fc73b8715b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Thu, 16 Feb 2023 14:17:15 +0100 Subject: [PATCH] fix: fix autoscaling version detection (#752) --- charts/kong/CHANGELOG.md | 4 +++- charts/kong/Chart.yaml | 2 +- charts/kong/templates/hpa.yaml | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/charts/kong/CHANGELOG.md b/charts/kong/CHANGELOG.md index cd1ad58f0..00b7bf4a8 100644 --- a/charts/kong/CHANGELOG.md +++ b/charts/kong/CHANGELOG.md @@ -1,7 +1,9 @@ # Changelog -## Unreleased +## 2.16.5 +* Fix autoscaling version detection. + [#744](https://github.com/Kong/charts/pull/744) * Don't include a clear-stale-pid initContainer when kong gateway is not enabled in the deployment. [#744](https://github.com/Kong/charts/pull/744) diff --git a/charts/kong/Chart.yaml b/charts/kong/Chart.yaml index b0f824d96..0f3835c25 100644 --- a/charts/kong/Chart.yaml +++ b/charts/kong/Chart.yaml @@ -11,7 +11,7 @@ maintainers: name: kong sources: - https://github.com/Kong/charts/tree/main/charts/kong -version: 2.16.4 +version: 2.16.5 appVersion: "3.1" dependencies: - name: postgresql diff --git a/charts/kong/templates/hpa.yaml b/charts/kong/templates/hpa.yaml index 5350660d2..922ade82d 100644 --- a/charts/kong/templates/hpa.yaml +++ b/charts/kong/templates/hpa.yaml @@ -17,10 +17,10 @@ spec: behavior: {{- toYaml .Values.autoscaling.behavior | nindent 4 }} {{- end }} - {{- if not (.Capabilities.APIVersions.Has "autoscaling/v2beta2") }} - targetCPUUtilizationPercentage: {{ .Values.autoscaling.targetCPUUtilizationPercentage | default 80 }} - {{- else }} + {{- if contains "autoscaling/v2" (include "kong.autoscalingVersion" . ) }} metrics: {{- toYaml .Values.autoscaling.metrics | nindent 4 }} + {{- else }} + targetCPUUtilizationPercentage: {{ .Values.autoscaling.targetCPUUtilizationPercentage | default 80 }} {{- end }} {{- end }}