fix(helm): Split ingester HPA when zoneAwareReplication is enabled (#14565)

pull/15174/head
Kellen275 6 months ago committed by GitHub
parent 52a8ef8a50
commit 80e46f7cd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 55
      production/helm/loki/templates/ingester/hpa-zone-a.yaml
  2. 55
      production/helm/loki/templates/ingester/hpa-zone-b.yaml
  3. 55
      production/helm/loki/templates/ingester/hpa-zone-c.yaml
  4. 2
      production/helm/loki/templates/ingester/hpa.yaml

@ -0,0 +1,55 @@
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
{{- if and $isDistributed .Values.ingester.autoscaling.enabled .Values.ingester.zoneAwareReplication.enabled }}
{{- $apiVersion := include "loki.hpa.apiVersion" . -}}
apiVersion: {{ $apiVersion }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "loki.ingesterFullname" . }}-zone-a
namespace: {{ .Release.Namespace }}
labels:
{{- include "loki.ingesterLabels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: StatefulSet
name: {{ include "loki.ingesterFullname" . }}-zone-a
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 }}

@ -0,0 +1,55 @@
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
{{- if and $isDistributed .Values.ingester.autoscaling.enabled .Values.ingester.zoneAwareReplication.enabled }}
{{- $apiVersion := include "loki.hpa.apiVersion" . -}}
apiVersion: {{ $apiVersion }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "loki.ingesterFullname" . }}-zone-b
namespace: {{ .Release.Namespace }}
labels:
{{- include "loki.ingesterLabels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: StatefulSet
name: {{ include "loki.ingesterFullname" . }}-zone-b
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 }}

@ -0,0 +1,55 @@
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
{{- if and $isDistributed .Values.ingester.autoscaling.enabled .Values.ingester.zoneAwareReplication.enabled }}
{{- $apiVersion := include "loki.hpa.apiVersion" . -}}
apiVersion: {{ $apiVersion }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "loki.ingesterFullname" . }}-zone-c
namespace: {{ .Release.Namespace }}
labels:
{{- include "loki.ingesterLabels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: StatefulSet
name: {{ include "loki.ingesterFullname" . }}-zone-c
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 }}

@ -1,5 +1,5 @@
{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
{{- if and $isDistributed .Values.ingester.autoscaling.enabled }}
{{- 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

Loading…
Cancel
Save