From fee469475c509d5575339dcab4560bf0f9098602 Mon Sep 17 00:00:00 2001
From: Bryan Brancotte <bryan.brancotte@pasteur.fr>
Date: Tue, 30 Jan 2024 15:43:38 +0100
Subject: [PATCH] Update autoscaling API version to v2

---
 shiny-server/Chart.yaml         |  2 +-
 shiny-server/templates/hpa.yaml | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/shiny-server/Chart.yaml b/shiny-server/Chart.yaml
index b5a3deb..81d845a 100644
--- a/shiny-server/Chart.yaml
+++ b/shiny-server/Chart.yaml
@@ -15,7 +15,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.
 # Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 0.6.1
+version: 0.6.2
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application. Versions are not expected to
diff --git a/shiny-server/templates/hpa.yaml b/shiny-server/templates/hpa.yaml
index 548ee03..a91f61b 100644
--- a/shiny-server/templates/hpa.yaml
+++ b/shiny-server/templates/hpa.yaml
@@ -1,5 +1,5 @@
 {{- if .Values.autoscaling.enabled }}
-apiVersion: autoscaling/v2beta1
+apiVersion: autoscaling/v2
 kind: HorizontalPodAutoscaler
 metadata:
   name: {{ include "chart.fullname" . }}
@@ -17,12 +17,16 @@ spec:
     - type: Resource
       resource:
         name: cpu
-        targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
+        target:
+          type: Utilization
+          averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
     {{- end }}
     {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
     - type: Resource
       resource:
         name: memory
-        targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
+        target:
+          type: Utilization
+          averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
     {{- end }}
 {{- end }}
-- 
GitLab