blob: ec9ad73801604a261cf7023f9bc9681564c69efb [file] [log] [blame]
Mohammed Naser65cda132024-05-02 14:34:08 -04001{{- if and (eq .Values.controller.kind "Deployment") .Values.controller.autoscaling.enabled (not .Values.controller.keda.enabled) -}}
2apiVersion: {{ ternary "autoscaling/v2" "autoscaling/v2beta2" (.Capabilities.APIVersions.Has "autoscaling/v2") }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -05003kind: HorizontalPodAutoscaler
4metadata:
Mohammed Naser9ad0d462023-01-15 20:36:37 -05005 {{- with .Values.controller.autoscaling.annotations }}
Mohammed Naser65cda132024-05-02 14:34:08 -04006 annotations: {{ toYaml . | nindent 4 }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -05007 {{- end }}
8 labels:
9 {{- include "ingress-nginx.labels" . | nindent 4 }}
10 app.kubernetes.io/component: controller
11 {{- with .Values.controller.labels }}
12 {{- toYaml . | nindent 4 }}
13 {{- end }}
14 name: {{ include "ingress-nginx.controller.fullname" . }}
Mohammed Naser65cda132024-05-02 14:34:08 -040015 namespace: {{ include "ingress-nginx.namespace" . }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050016spec:
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 }}