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 }} |
| 9 | spec: |
| 10 | scaleTargetRef: |
| 11 | apiVersion: apps/v1 |
| 12 | {{- if (eq .Values.role "Aggregator") }} |
| 13 | kind: StatefulSet |
| 14 | {{- else if (eq .Values.role "Stateless-Aggregator") }} |
| 15 | kind: Deployment |
| 16 | {{- end }} |
| 17 | name: {{ include "vector.fullname" . }} |
| 18 | minReplicas: {{ .Values.autoscaling.minReplicas }} |
| 19 | maxReplicas: {{ .Values.autoscaling.maxReplicas }} |
| 20 | metrics: |
| 21 | {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} |
| 22 | - type: Resource |
| 23 | resource: |
| 24 | name: memory |
| 25 | target: |
| 26 | type: Utilization |
| 27 | averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} |
| 28 | {{- end }} |
| 29 | {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} |
| 30 | - type: Resource |
| 31 | resource: |
| 32 | name: cpu |
| 33 | target: |
| 34 | type: Utilization |
| 35 | averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} |
| 36 | {{- end }} |
| 37 | {{- with .Values.autoscaling.customMetric -}} |
| 38 | {{ toYaml . | nindent 4 }} |
| 39 | {{- end }} |
| 40 | {{- with .Values.autoscaling.behavior }} |
| 41 | behavior: |
| 42 | {{- toYaml . | nindent 4 }} |
| 43 | {{- end }} |
| 44 | {{- end }} |
| 45 | {{- end }} |