blob: 876315f333645cbd6f495fbb8c9320bf77fb8712 [file] [log] [blame]
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +04001{{- if and .Values.controller.autoscaling.enabled (or (eq .Values.controller.kind "Deployment") (eq .Values.controller.kind "Both")) -}}
2{{- if not .Values.controller.keda.enabled }}
3
4apiVersion: autoscaling/v2beta2
5kind: HorizontalPodAutoscaler
6metadata:
7 annotations:
8 {{- with .Values.controller.autoscaling.annotations }}
9 {{- toYaml . | trimSuffix "\n" | nindent 4 }}
10 {{- end }}
11 labels:
12 {{- include "ingress-nginx.labels" . | nindent 4 }}
13 app.kubernetes.io/component: controller
14 name: {{ include "ingress-nginx.controller.fullname" . }}
15 namespace: {{ .Release.Namespace }}
16spec:
17 scaleTargetRef:
18 apiVersion: apps/v1
19 kind: Deployment
20 name: {{ include "ingress-nginx.controller.fullname" . }}
21 minReplicas: {{ .Values.controller.autoscaling.minReplicas }}
22 maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }}
23 metrics:
24 {{- with .Values.controller.autoscaling.targetMemoryUtilizationPercentage }}
25 - type: Resource
26 resource:
27 name: memory
28 target:
29 type: Utilization
30 averageUtilization: {{ . }}
31 {{- end }}
32 {{- with .Values.controller.autoscaling.targetCPUUtilizationPercentage }}
33 - type: Resource
34 resource:
35 name: cpu
36 target:
37 type: Utilization
38 averageUtilization: {{ . }}
39 {{- end }}
40 {{- with .Values.controller.autoscalingTemplate }}
41 {{- toYaml . | nindent 2 }}
42 {{- end }}
43 {{- with .Values.controller.autoscaling.behavior }}
44 behavior:
45 {{- toYaml . | nindent 4 }}
46 {{- end }}
47{{- end }}
48{{- end }}
49