{{- if .Values.web.autoscaling.enabled -}} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: {{ template "django.fullname" . }}-web labels: {{- include "django.labels" . | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: {{ template "django.fullname" . }}-web minReplicas: {{ .Values.web.autoscaling.minReplicas }} maxReplicas: {{ .Values.web.autoscaling.maxReplicas }} metrics: {{- if .Values.web.autoscaling.targetCPU }} - type: Resource resource: name: cpu target: type: "Utilization" averageUtilization: {{ .Values.web.autoscaling.targetCPU }} {{- end }} {{- if .Values.web.autoscaling.targetMemory }} - type: Resource resource: name: memory target: type: "Utilization" averageUtilization: {{ .Values.web.autoscaling.targetMemory }} {{- end }} {{- end }}