mirror of https://github.com/grafana/loki
fix(helm): Split ingester HPA when zoneAwareReplication is enabled (#14565)
parent
52a8ef8a50
commit
80e46f7cd2
@ -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 }} |
Loading…
Reference in new issue