{{- if .Values.frontend.autoscaling.hpa.enabled }} apiVersion: {{ include "common.capabilities.hpa.apiVersion" . }} kind: HorizontalPodAutoscaler metadata: name: {{ include "shuffle.frontend.name" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "shuffle.frontend.labels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} spec: scaleTargetRef: apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} kind: Deployment name: {{ include "shuffle.frontend.name" . }} minReplicas: {{ .Values.frontend.autoscaling.hpa.minReplicas }} maxReplicas: {{ .Values.frontend.autoscaling.hpa.maxReplicas }} metrics: {{- if .Values.frontend.autoscaling.hpa.targetMemory }} - type: Resource resource: name: memory {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }} targetAverageUtilization: {{ .Values.frontend.autoscaling.hpa.targetMemory }} {{- else }} target: type: Utilization averageUtilization: {{ .Values.worker.autoscaling.hpa.targetMemory }} {{- end }} {{- end }} {{- if .Values.frontend.autoscaling.hpa.targetCPU }} - type: Resource resource: name: cpu {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }} targetAverageUtilization: {{ .Values.frontend.autoscaling.hpa.targetCPU }} {{- else }} target: type: Utilization averageUtilization: {{ .Values.worker.autoscaling.hpa.targetCPU }} {{- end }} {{- end }} {{- end }}