From 78a1bd30a4198a34b65cc74e8e844efafd002811 Mon Sep 17 00:00:00 2001 From: Bryan Brancotte <bryan.brancotte@pasteur.fr> Date: Tue, 30 Jan 2024 16:08:57 +0100 Subject: [PATCH] put maxReplicas to 1 when present and autoscaling become disabled, fixed #11 --- shiny-server/templates/hpa.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shiny-server/templates/hpa.yaml b/shiny-server/templates/hpa.yaml index a91f61b..97bee0e 100644 --- a/shiny-server/templates/hpa.yaml +++ b/shiny-server/templates/hpa.yaml @@ -1,4 +1,4 @@ -{{- if .Values.autoscaling.enabled }} +{{- if or (.Values.autoscaling.enabled) (lookup "autoscaling/v2" "HorizontalPodAutoscaler" .Release.Namespace (include "chart.fullname" .)) }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: @@ -10,8 +10,13 @@ spec: apiVersion: apps/v1 kind: Deployment name: {{ include "chart.fullname" . }} + {{ if $.Values.autoscaling.enabled }} minReplicas: {{ .Values.autoscaling.minReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }} + {{ else }} + minReplicas: 1 + maxReplicas: 1 + {{ end }} metrics: {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - type: Resource -- GitLab