blob: d1e78bdfc615b925ebdf4aea870d1c5cac360185 [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
Giorgi Lekveishvilicccf72f2023-05-19 16:13:22 +04004apiVersion: {{ .Values.controller.autoscaling.apiVersion }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +04005kind: 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
Giorgi Lekveishvilicccf72f2023-05-19 16:13:22 +040014 {{- with .Values.controller.labels }}
15 {{- toYaml . | nindent 4 }}
16 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040017 name: {{ include "ingress-nginx.controller.fullname" . }}
18 namespace: {{ .Release.Namespace }}
19spec:
20 scaleTargetRef:
21 apiVersion: apps/v1
22 kind: Deployment
23 name: {{ include "ingress-nginx.controller.fullname" . }}
24 minReplicas: {{ .Values.controller.autoscaling.minReplicas }}
25 maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }}
26 metrics:
27 {{- with .Values.controller.autoscaling.targetMemoryUtilizationPercentage }}
28 - type: Resource
29 resource:
30 name: memory
31 target:
32 type: Utilization
33 averageUtilization: {{ . }}
34 {{- end }}
35 {{- with .Values.controller.autoscaling.targetCPUUtilizationPercentage }}
36 - type: Resource
37 resource:
38 name: cpu
39 target:
40 type: Utilization
41 averageUtilization: {{ . }}
42 {{- end }}
43 {{- with .Values.controller.autoscalingTemplate }}
44 {{- toYaml . | nindent 2 }}
45 {{- end }}
46 {{- with .Values.controller.autoscaling.behavior }}
47 behavior:
48 {{- toYaml . | nindent 4 }}
49 {{- end }}
50{{- end }}
51{{- end }}
52