| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 1 | {{- if and (or (eq .Values.controller.kind "Deployment") (eq .Values.controller.kind "Both")) .Values.controller.autoscaling.enabled (not .Values.controller.keda.enabled) -}} |
| 2 | apiVersion: {{ ternary "autoscaling/v2" "autoscaling/v2beta2" (.Capabilities.APIVersions.Has "autoscaling/v2") }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 3 | kind: HorizontalPodAutoscaler |
| 4 | metadata: |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 5 | {{- with .Values.controller.autoscaling.annotations }} |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 6 | annotations: {{ toYaml . | nindent 4 }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 7 | {{- end }} |
| 8 | labels: |
| 9 | {{- include "ingress-nginx.labels" . | nindent 4 }} |
| 10 | app.kubernetes.io/component: controller |
| Giorgi Lekveishvili | cccf72f | 2023-05-19 16:13:22 +0400 | [diff] [blame] | 11 | {{- with .Values.controller.labels }} |
| 12 | {{- toYaml . | nindent 4 }} |
| 13 | {{- end }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 14 | name: {{ include "ingress-nginx.controller.fullname" . }} |
| 15 | namespace: {{ .Release.Namespace }} |
| 16 | spec: |
| 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: |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 24 | {{- with .Values.controller.autoscaling.targetCPUUtilizationPercentage }} |
| 25 | - type: Resource |
| 26 | resource: |
| 27 | name: cpu |
| 28 | target: |
| 29 | type: Utilization |
| 30 | averageUtilization: {{ . }} |
| 31 | {{- end }} |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 32 | {{- with .Values.controller.autoscaling.targetMemoryUtilizationPercentage }} |
| 33 | - type: Resource |
| 34 | resource: |
| 35 | name: memory |
| 36 | target: |
| 37 | type: Utilization |
| 38 | averageUtilization: {{ . }} |
| 39 | {{- end }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 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 }} |