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