|
| 1 | +{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} |
| 2 | +{{- if and .Values.querier.kedaAutoscaling.enabled .Values.querier.autoscaling.enabled}} |
| 3 | +{{- fail "Cannot enable both HPA and Keda based autoscaling at the same time."}} |
| 4 | +{{- end }} |
| 5 | +{{- if and $isDistributed .Values.querier.kedaAutoscaling.enabled }} |
| 6 | +apiVersion: keda.sh/v1alpha1 |
| 7 | +kind: ScaledObject |
| 8 | +metadata: |
| 9 | + name: {{ include "loki.querierFullname" . }} |
| 10 | + namespace: {{ .Release.Namespace }} |
| 11 | + labels: |
| 12 | + {{- include "loki.querierLabels" . | nindent 4 }} |
| 13 | +spec: |
| 14 | + advanced: |
| 15 | + horizontalPodAutoscalerConfig: |
| 16 | + {{- with .Values.querier.kedaAutoscaling.behavior }} |
| 17 | + behavior: |
| 18 | + {{- toYaml . | nindent 8 }} |
| 19 | + {{- end }} |
| 20 | + pollingInterval: {{ .Values.kedaAutoscaling.pollingInterval }} |
| 21 | + scaleTargetRef: |
| 22 | + apiVersion: apps/v1 |
| 23 | + kind: Deployment |
| 24 | + name: {{ include "loki.querierFullname" . }} |
| 25 | + minReplicas: {{ .Values.querier.kedaAutoscaling.minReplicas }} |
| 26 | + maxReplicas: {{ .Values.querier.kedaAutoscaling.maxReplicas }} |
| 27 | + triggers: |
| 28 | + - metadata: |
| 29 | + {{- if .Values.kedaAutoscaling.authentication.enabled }} |
| 30 | + authModes: "{{ .Values.kedaAutoscaling.authentication.authModes }}" |
| 31 | + {{- end }} |
| 32 | + query: sum(max_over_time(loki_query_scheduler_inflight_requests{namespace="{{ .Release.Namespace }}", quantile="0.75"}[2m])) |
| 33 | + serverAddress: {{ .Values.kedaAutoscaling.prometheusAddress }} |
| 34 | + threshold: {{ .Values.querier.kedaAutoscaling.querySchedulerInflightRequestsThreshold | quote }} |
| 35 | + ignoreNullValues: "{{ .Values.kedaAutoscaling.ignoreNullValues }}" |
| 36 | + unsafeSsl: "{{ .Values.kedaAutoscaling.unsafeSsl }}" |
| 37 | + name: querier_autoscaling_metric |
| 38 | + type: prometheus |
| 39 | + {{- if .Values.kedaAutoscaling.authentication.enabled }} |
| 40 | + authenticationRef: |
| 41 | + name: "keda-triggger-auth" |
| 42 | + {{- end }} |
| 43 | +{{- end }} |
0 commit comments