From 1ba271cc64dac708d89599a88fd9ab2f4bc3c98b Mon Sep 17 00:00:00 2001 From: Iulian Bacalu Date: Mon, 8 May 2023 15:48:42 +0200 Subject: [PATCH] fix(hpa): reorder metrics This change is required due to https://github.com/kubernetes/kubernetes/issues/74099. It would solve "always out-of-sync" issues. --- charts/podinfo/templates/hpa.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/charts/podinfo/templates/hpa.yaml b/charts/podinfo/templates/hpa.yaml index 6d768ae01..a6e07b76c 100644 --- a/charts/podinfo/templates/hpa.yaml +++ b/charts/podinfo/templates/hpa.yaml @@ -13,14 +13,6 @@ spec: minReplicas: {{ .Values.replicaCount }} maxReplicas: {{ .Values.hpa.maxReplicas }} metrics: - {{- if .Values.hpa.cpu }} - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: {{ .Values.hpa.cpu }} - {{- end }} {{- if .Values.hpa.memory }} - type: Resource resource: @@ -29,6 +21,14 @@ spec: type: AverageValue averageValue: {{ .Values.hpa.memory }} {{- end }} + {{- if .Values.hpa.cpu }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.hpa.cpu }} + {{- end }} {{- if .Values.hpa.requests }} - type: Pods pods: