56 lines
1.9 KiB
YAML
56 lines
1.9 KiB
YAML
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
|
|
{{- if and $isDistributed .Values.ingester.autoscaling.enabled (or (not .Values.ingester.zoneAwareReplication.enabled) .Values.ingester.zoneAwareReplication.migration.enabled) }}
|
|
{{- $apiVersion := include "loki.hpa.apiVersion" . -}}
|
|
apiVersion: {{ $apiVersion }}
|
|
kind: HorizontalPodAutoscaler
|
|
metadata:
|
|
name: {{ include "loki.ingesterFullname" . }}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels:
|
|
{{- include "loki.ingesterLabels" . | nindent 4 }}
|
|
spec:
|
|
scaleTargetRef:
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
name: {{ include "loki.ingesterFullname" . }}
|
|
minReplicas: {{ .Values.ingester.autoscaling.minReplicas }}
|
|
maxReplicas: {{ .Values.ingester.autoscaling.maxReplicas }}
|
|
metrics:
|
|
{{- with .Values.ingester.autoscaling.targetMemoryUtilizationPercentage }}
|
|
- type: Resource
|
|
resource:
|
|
name: memory
|
|
{{- if (eq $apiVersion "autoscaling/v2") }}
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: {{ . }}
|
|
{{- else }}
|
|
targetAverageUtilization: {{ . }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.ingester.autoscaling.targetCPUUtilizationPercentage }}
|
|
- type: Resource
|
|
resource:
|
|
name: cpu
|
|
{{- if (eq $apiVersion "autoscaling/v2") }}
|
|
target:
|
|
type: Utilization
|
|
averageUtilization: {{ . }}
|
|
{{- else }}
|
|
targetAverageUtilization: {{ . }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.ingester.autoscaling.customMetrics }}
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
{{- if .Values.ingester.autoscaling.behavior.enabled }}
|
|
behavior:
|
|
{{- with .Values.ingester.autoscaling.behavior.scaleDown }}
|
|
scaleDown: {{ toYaml . | nindent 6 }}
|
|
{{- end }}
|
|
{{- with .Values.ingester.autoscaling.behavior.scaleUp }}
|
|
scaleUp: {{ toYaml . | nindent 6 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|