blob: 08d81cb5903bf30e7d8285ce12597b32ff5a1306 [file] [log] [blame]
Mohammed Naser65cda132024-05-02 14:34:08 -04001{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
2{{- if and $isDistributed .Values.querier.autoscaling.enabled }}
3{{- $apiVersion := include "loki.hpa.apiVersion" . -}}
4apiVersion: {{ $apiVersion }}
5kind: HorizontalPodAutoscaler
6metadata:
7 name: {{ include "loki.querierFullname" . }}
8 namespace: {{ .Release.Namespace }}
9 labels:
10 {{- include "loki.querierLabels" . | nindent 4 }}
11spec:
12 scaleTargetRef:
13 apiVersion: apps/v1
14 kind: Deployment
15 name: {{ include "loki.querierFullname" . }}
16 minReplicas: {{ .Values.querier.autoscaling.minReplicas }}
17 maxReplicas: {{ .Values.querier.autoscaling.maxReplicas }}
18 metrics:
19 {{- with .Values.querier.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.querier.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.querier.autoscaling.customMetrics }}
44 {{- toYaml . | nindent 4 }}
45 {{- end }}
46 {{- if .Values.querier.autoscaling.behavior.enabled }}
47 behavior:
48 {{- with .Values.querier.autoscaling.behavior.scaleDown }}
49 scaleDown: {{ toYaml . | nindent 6 }}
50 {{- end }}
51 {{- with .Values.querier.autoscaling.behavior.scaleUp }}
52 scaleUp: {{ toYaml . | nindent 6 }}
53 {{- end }}
54 {{- end }}
55{{- end }}