blob: faaf4fa75043dfa522f7ccf82b2b7c7b71ccf7c4 [file] [log] [blame]
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +04001{{- if and .Values.defaultBackend.enabled .Values.defaultBackend.autoscaling.enabled }}
Giorgi Lekveishvili0048a782023-06-20 18:32:21 +04002apiVersion: {{ ternary "autoscaling/v2" "autoscaling/v2beta2" (.Capabilities.APIVersions.Has "autoscaling/v2") }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +04003kind: HorizontalPodAutoscaler
4metadata:
Giorgi Lekveishvili0048a782023-06-20 18:32:21 +04005 {{- with .Values.defaultBackend.autoscaling.annotations }}
6 annotations: {{ toYaml . | nindent 4 }}
7 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +04008 labels:
9 {{- include "ingress-nginx.labels" . | nindent 4 }}
10 app.kubernetes.io/component: default-backend
Giorgi Lekveishvilicccf72f2023-05-19 16:13:22 +040011 {{- with .Values.defaultBackend.labels }}
12 {{- toYaml . | nindent 4 }}
13 {{- end }}
Giorgi Lekveishvili0048a782023-06-20 18:32:21 +040014 name: {{ include "ingress-nginx.defaultBackend.fullname" . }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040015 namespace: {{ .Release.Namespace }}
16spec:
17 scaleTargetRef:
18 apiVersion: apps/v1
19 kind: Deployment
Giorgi Lekveishvili0048a782023-06-20 18:32:21 +040020 name: {{ include "ingress-nginx.defaultBackend.fullname" . }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040021 minReplicas: {{ .Values.defaultBackend.autoscaling.minReplicas }}
22 maxReplicas: {{ .Values.defaultBackend.autoscaling.maxReplicas }}
23 metrics:
Giorgi Lekveishvili0048a782023-06-20 18:32:21 +040024 {{- with .Values.defaultBackend.autoscaling.targetCPUUtilizationPercentage }}
25 - type: Resource
26 resource:
27 name: cpu
28 target:
29 type: Utilization
30 averageUtilization: {{ . }}
31 {{- end }}
32 {{- with .Values.defaultBackend.autoscaling.targetMemoryUtilizationPercentage }}
33 - type: Resource
34 resource:
35 name: memory
36 target:
37 type: Utilization
38 averageUtilization: {{ . }}
39 {{- end }}
Giorgi Lekveishvili725bb392023-05-05 18:24:27 +040040{{- end }}