Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 1 | {{- if or (eq .Values.role "Aggregator") (eq .Values.role "Stateless-Aggregator") -}} |
| 2 | {{- if .Values.autoscaling.enabled }} |
| 3 | apiVersion: {{ template "autoscaling.apiVersion" . }} |
| 4 | kind: HorizontalPodAutoscaler |
| 5 | metadata: |
| 6 | name: {{ include "vector.fullname" . }} |
| 7 | labels: |
| 8 | {{- include "vector.labels" . | nindent 4 }} |
Giovanni Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 9 | annotations: |
| 10 | {{- toYaml .Values.autoscaling.annotations | nindent 4 }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 11 | spec: |
| 12 | scaleTargetRef: |
| 13 | apiVersion: apps/v1 |
| 14 | {{- if (eq .Values.role "Aggregator") }} |
| 15 | kind: StatefulSet |
| 16 | {{- else if (eq .Values.role "Stateless-Aggregator") }} |
| 17 | kind: Deployment |
| 18 | {{- end }} |
| 19 | name: {{ include "vector.fullname" . }} |
| 20 | minReplicas: {{ .Values.autoscaling.minReplicas }} |
| 21 | maxReplicas: {{ .Values.autoscaling.maxReplicas }} |
| 22 | metrics: |
| 23 | {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} |
| 24 | - type: Resource |
| 25 | resource: |
| 26 | name: memory |
| 27 | target: |
| 28 | type: Utilization |
| 29 | averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} |
| 30 | {{- end }} |
| 31 | {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} |
| 32 | - type: Resource |
| 33 | resource: |
| 34 | name: cpu |
| 35 | target: |
| 36 | type: Utilization |
| 37 | averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} |
| 38 | {{- end }} |
| 39 | {{- with .Values.autoscaling.customMetric -}} |
| 40 | {{ toYaml . | nindent 4 }} |
| 41 | {{- end }} |
| 42 | {{- with .Values.autoscaling.behavior }} |
| 43 | behavior: |
| 44 | {{- toYaml . | nindent 4 }} |
| 45 | {{- end }} |
| 46 | {{- end }} |
| 47 | {{- end }} |