diff --git a/charts/mercure/templates/hpa.yaml b/charts/mercure/templates/hpa.yaml index 60fd9ee4..a1edc9f5 100644 --- a/charts/mercure/templates/hpa.yaml +++ b/charts/mercure/templates/hpa.yaml @@ -21,12 +21,24 @@ spec: - type: Resource resource: name: cpu + {{- if .Capabilities.APIVersions.Has "autoscaling/v2" }} + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- else }} targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} {{- end }} {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - type: Resource resource: name: memory + {{- if .Capabilities.APIVersions.Has "autoscaling/v2" }} + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- else }} targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} {{- end }} {{- end }}