blob: 2e6a2d193964b9b6878650589306ef0a764af317 [file] [log] [blame]
Mohammed Naser65cda132024-05-02 14:34:08 -04001{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
2{{- if and $isDistributed .Values.ingester.autoscaling.enabled }}
3{{- $apiVersion := include "loki.hpa.apiVersion" . -}}
4apiVersion: {{ $apiVersion }}
5kind: HorizontalPodAutoscaler
6metadata:
7 name: {{ include "loki.ingesterFullname" . }}
8 namespace: {{ .Release.Namespace }}
9 labels:
10 {{- include "loki.ingesterLabels" . | nindent 4 }}
11spec:
12 scaleTargetRef:
13 apiVersion: apps/v1
14 kind: Statefulset
15 name: {{ include "loki.ingesterFullname" . }}
16 minReplicas: {{ .Values.ingester.autoscaling.minReplicas }}
17 maxReplicas: {{ .Values.ingester.autoscaling.maxReplicas }}
18 metrics:
19 {{- with .Values.ingester.autoscaling.targetMemoryUtilizationPercentage }}
20 - type: Resource
21 resource:
22 name: memory
23 {{- if (eq $apiVersion "autoscaling/v2") }}
24 target:
25 type: Utilization
26 averageUtilization: {{ . }}
27 {{- else }}
28 targetAverageUtilization: {{ . }}
29 {{- end }}
30 {{- end }}
31 {{- with .Values.ingester.autoscaling.targetCPUUtilizationPercentage }}
32 - type: Resource
33 resource:
34 name: cpu
35 {{- if (eq $apiVersion "autoscaling/v2") }}
36 target:
37 type: Utilization
38 averageUtilization: {{ . }}
39 {{- else }}
40 targetAverageUtilization: {{ . }}
41 {{- end }}
42 {{- end }}
43 {{- with .Values.ingester.autoscaling.customMetrics }}
44 {{- toYaml . | nindent 4 }}
45 {{- end }}
46 {{- if .Values.ingester.autoscaling.behavior.enabled }}
47 behavior:
48 {{- with .Values.ingester.autoscaling.behavior.scaleDown }}
49 scaleDown: {{ toYaml . | nindent 6 }}
50 {{- end }}
51 {{- with .Values.ingester.autoscaling.behavior.scaleUp }}
52 scaleUp: {{ toYaml . | nindent 6 }}
53 {{- end }}
54 {{- end }}
55{{- end }}