{{- if or (eq .Values.controller.kind "Deployment") (eq .Values.controller.kind "Both") }} {{- if .Values.controller.autoscaling.enabled }} apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: labels: app: {{ template "nginx-ingress.name" . }} chart: {{ template "nginx-ingress.chart" . }} component: "{{ .Values.controller.name }}" heritage: {{ .Release.Service }} release: {{ .Release.Name }} name: {{ template "nginx-ingress.controller.fullname" . }} spec: scaleTargetRef: apiVersion: {{ template "deployment.apiVersion" . }} kind: Deployment name: {{ template "nginx-ingress.controller.fullname" . }} minReplicas: {{ .Values.controller.autoscaling.minReplicas }} maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }} metrics: {{- with .Values.controller.autoscaling.targetCPUUtilizationPercentage }} - type: Resource resource: name: cpu targetAverageUtilization: {{ . }} {{- end }} {{- with .Values.controller.autoscaling.targetMemoryUtilizationPercentage }} - type: Resource resource: name: memory targetAverageUtilization: {{ . }} {{- end }} {{- end }} {{- end }}