| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 1 | {{- 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 Lekveishvili | cccf72f | 2023-05-19 16:13:22 +0400 | [diff] [blame^] | 4 | apiVersion: {{ .Values.controller.autoscaling.apiVersion }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 5 | kind: HorizontalPodAutoscaler |
| 6 | metadata: |
| 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 Lekveishvili | cccf72f | 2023-05-19 16:13:22 +0400 | [diff] [blame^] | 14 | {{- with .Values.controller.labels }} |
| 15 | {{- toYaml . | nindent 4 }} |
| 16 | {{- end }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 17 | name: {{ include "ingress-nginx.controller.fullname" . }} |
| 18 | namespace: {{ .Release.Namespace }} |
| 19 | spec: |
| 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 | |