{{- if .Values.backend.autoscaling.enabled }} apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: name: {{ include "hangar.fullname" . }}-backend labels: {{- include "hangar.labels" . | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: {{ include "hangar.fullname" . }}-backend minReplicas: {{ .Values.backend.autoscaling.minReplicas }} maxReplicas: {{ .Values.backend.autoscaling.maxReplicas }} metrics: {{- if .Values.backend.autoscaling.targetCPUUtilizationPercentage }} - type: Resource resource: name: cpu targetAverageUtilization: {{ .Values.backend.autoscaling.targetCPUUtilizationPercentage }} {{- end }} {{- if .Values.backend.autoscaling.targetMemoryUtilizationPercentage }} - type: Resource resource: name: memory targetAverageUtilization: {{ .Values.backend.autoscaling.targetMemoryUtilizationPercentage }} {{- end }} {{- end }}