Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm : add hpa for the ingesters #7843

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions operations/helm/charts/mimir-distributed/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Entries should include a reference to the Pull Request that introduced the chang

## main / unreleased

* [FEATURE] Add hpa for the ingester.

## 5.3.0-rc.0

* [CHANGE] Do not render resource blocks for `initContainers`, `nodeSelector`, `affinity` and `tolerations` if they are empty.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{- $autoscalingv2 := .Capabilities.APIVersions.Has "autoscaling/v2" -}}
{{- if .Values.ingester.horizontalPodAutoscaling.enabled }}
{{- if $autoscalingv2 }}
apiVersion: autoscaling/v2
{{- else }}
apiVersion: autoscaling/v2beta1
{{- end }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "ingester") }}
labels:
{{- include "mimir.labels" (dict "ctx" . "component" "distributor") | nindent 4 }}
spec:
scaleTargetRef:
{{- if .Values.ingester.statefulSet.enabled }}
apiVersion: apps/v1
kind: StatefulSet
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "ingester") }}
{{- end }}
minReplicas: {{ .Values.ingester.horizontalPodAutoscaling.minReplicas }}
maxReplicas: {{ .Values.ingester.horizontalPodAutoscaling.maxReplicas }}
{{- with .Values.ingester.horizontalPodAutoscaling.behavior }}
behavior:
{{- toYaml . | nindent 4 }}
{{- end }}
metrics:
{{- with .Values.ingester.horizontalPodAutoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
{{- if $autoscalingv2 }}
target:
type: Utilization
averageUtilization: {{ . }}
{{- else }}
targetAverageUtilization: {{ . }}
{{- end }}
{{- end }}
{{- with .Values.ingester.horizontalPodAutoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
{{- if $autoscalingv2 }}
target:
type: Utilization
averageUtilization: {{ . }}
{{- else }}
targetAverageUtilization: {{ . }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ spec:
{{- toYaml .Values.ingester.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.ingester.readinessProbe | nindent 12 }}
{{- if .Values.ingester.horizontalPodAutoscaling.enabled }}
lifecycle:
preStop:
httpGet:
path: "/ingester/flush"
port: http-metrics
{{- end }}
resources:
{{- toYaml .Values.ingester.resources | nindent 12 }}
securityContext:
Expand Down
14 changes: 14 additions & 0 deletions operations/helm/charts/mimir-distributed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,20 @@ ingester:
# E.g. if 'replicas' is set to 4 and there are 3 zones, then 4/3=1.33 and after rounding up it means 2 pods per zone are started.
replicas: 3

horizontalPodAutoscaling:
enabled: false
minReplicas: 3
maxReplicas: 10
targetCPUUtilizationPercentage: 95
targetMemoryUtilizationPercentage: 95
behavior:
scaleDown:
policies:
- type: Pods
value: 1
periodSeconds: 1800
stabilizationWindowSeconds: 3600

statefulSet:
enabled: true

Expand Down
Loading