{{- if .Values.gateway.autoscaling.enabled }} {{- if eq (include "mimir.hpa.version" .) "autoscaling/v2" }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: {{ include "mimir.resourceName" (dict "ctx" . "component" "gateway") }} labels: {{- include "mimir.labels" (dict "ctx" . "component" "gateway") | nindent 4 }} namespace: {{ .Release.Namespace | quote }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: {{ include "mimir.resourceName" (dict "ctx" . "component" "gateway") }} minReplicas: {{ .Values.gateway.autoscaling.minReplicas }} maxReplicas: {{ .Values.gateway.autoscaling.maxReplicas }} metrics: {{- with .Values.gateway.autoscaling.targetMemoryUtilizationPercentage }} - type: Resource resource: name: memory target: type: Utilization averageUtilization: {{ . }} {{- end }} {{- with .Values.gateway.autoscaling.targetCPUUtilizationPercentage }} - type: Resource resource: name: cpu target: type: Utilization averageUtilization: {{ . }} {{- end }} {{- end -}} {{- end -}}