| 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 | |
| 4 | apiVersion: autoscaling/v2beta2 |
| 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 |
| 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: |
| 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 }} |
| 48 | {{- end }} |
| 49 | |