mirror of https://github.com/grafana/loki
Helm: add hpa for read, write and backend (#8684)
**What this PR does / why we need it**: It adds missing HPA (HorizontalPodAutoscaler) templates to write, read, and backend components **Which issue(s) this PR fixes**: Fixes #7864 **Checklist** - [x] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [x] Documentation added - [ ] Tests updated - [x] `CHANGELOG.md` updated - [x] Changes that require user attention or interaction to upgrade are documented in `docs/sources/upgrading/_index.md` Co-authored-by: Oleksii Boiko <oleksii_boiko@external.mckinsey.com>pull/9502/head helm-loki-5.5.6
parent
a55404766c
commit
f9aba99455
@ -0,0 +1,49 @@ |
||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}} |
||||
{{- $autoscalingv2 := .Capabilities.APIVersions.Has "autoscaling/v2" -}} |
||||
{{- if and $isSimpleScalable (not .Values.read.legacyReadTarget ) ( .Values.backend.autoscaling.enabled ) }} |
||||
{{- if $autoscalingv2 }} |
||||
apiVersion: autoscaling/v2 |
||||
{{- else }} |
||||
apiVersion: autoscaling/v2beta1 |
||||
{{- end }} |
||||
kind: HorizontalPodAutoscaler |
||||
metadata: |
||||
name: {{ include "loki.backendFullname" . }} |
||||
labels: |
||||
{{- include "loki.backendLabels" . | nindent 4 }} |
||||
spec: |
||||
scaleTargetRef: |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
name: {{ include "loki.backendFullname" . }} |
||||
minReplicas: {{ .Values.backend.autoscaling.minReplicas }} |
||||
maxReplicas: {{ .Values.backend.autoscaling.maxReplicas }} |
||||
{{- with .Values.backend.autoscaling.behavior }} |
||||
behavior: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
{{- with .Values.backend.autoscaling.targetMemoryUtilizationPercentage }} |
||||
- type: Resource |
||||
resource: |
||||
name: memory |
||||
{{- if $autoscalingv2 }} |
||||
target: |
||||
type: Utilization |
||||
averageUtilization: {{ . }} |
||||
{{- else }} |
||||
targetAverageUtilization: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- with .Values.backend.autoscaling.targetCPUUtilizationPercentage }} |
||||
- type: Resource |
||||
resource: |
||||
name: cpu |
||||
{{- if $autoscalingv2 }} |
||||
target: |
||||
type: Utilization |
||||
averageUtilization: {{ . }} |
||||
{{- else }} |
||||
targetAverageUtilization: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
@ -0,0 +1,55 @@ |
||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}} |
||||
{{- $autoscalingv2 := .Capabilities.APIVersions.Has "autoscaling/v2" -}} |
||||
{{- if and $isSimpleScalable ( .Values.read.autoscaling.enabled ) }} |
||||
{{- if $autoscalingv2 }} |
||||
apiVersion: autoscaling/v2 |
||||
{{- else }} |
||||
apiVersion: autoscaling/v2beta1 |
||||
{{- end }} |
||||
kind: HorizontalPodAutoscaler |
||||
metadata: |
||||
name: {{ include "loki.readFullname" . }} |
||||
labels: |
||||
{{- include "loki.readLabels" . | nindent 4 }} |
||||
spec: |
||||
scaleTargetRef: |
||||
apiVersion: apps/v1 |
||||
{{- if and $isSimpleScalable (not .Values.read.legacyReadTarget ) }} |
||||
kind: Deployment |
||||
name: {{ include "loki.readFullname" . }} |
||||
{{- else }} |
||||
kind: StatefulSet |
||||
name: {{ include "loki.readFullname" . }} |
||||
{{- end }} |
||||
minReplicas: {{ .Values.read.autoscaling.minReplicas }} |
||||
maxReplicas: {{ .Values.read.autoscaling.maxReplicas }} |
||||
{{- with .Values.read.autoscaling.behavior }} |
||||
behavior: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
metrics: |
||||
{{- with .Values.read.autoscaling.targetMemoryUtilizationPercentage }} |
||||
- type: Resource |
||||
resource: |
||||
name: memory |
||||
{{- if $autoscalingv2 }} |
||||
target: |
||||
type: Utilization |
||||
averageUtilization: {{ . }} |
||||
{{- else }} |
||||
targetAverageUtilization: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- with .Values.read.autoscaling.targetCPUUtilizationPercentage }} |
||||
- type: Resource |
||||
resource: |
||||
name: cpu |
||||
{{- if $autoscalingv2 }} |
||||
target: |
||||
type: Utilization |
||||
averageUtilization: {{ . }} |
||||
{{- else }} |
||||
targetAverageUtilization: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
@ -0,0 +1,50 @@ |
||||
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}} |
||||
{{- $autoscalingv2 := .Capabilities.APIVersions.Has "autoscaling/v2" -}} |
||||
{{- if and $isSimpleScalable ( .Values.write.autoscaling.enabled ) }} |
||||
{{- if $autoscalingv2 }} |
||||
apiVersion: autoscaling/v2 |
||||
{{- else }} |
||||
apiVersion: autoscaling/v2beta1 |
||||
{{- end }} |
||||
kind: HorizontalPodAutoscaler |
||||
metadata: |
||||
name: {{ include "loki.writeFullname" . }} |
||||
labels: |
||||
{{- include "loki.writeLabels" . | nindent 4 }} |
||||
spec: |
||||
scaleTargetRef: |
||||
apiVersion: apps/v1 |
||||
kind: StatefulSet |
||||
name: {{ include "loki.writeFullname" . }} |
||||
minReplicas: {{ .Values.write.autoscaling.minReplicas }} |
||||
maxReplicas: {{ .Values.write.autoscaling.maxReplicas }} |
||||
{{- with .Values.write.autoscaling.behavior }} |
||||
behavior: |
||||
{{- toYaml . | nindent 4 }} |
||||
{{- end }} |
||||
metrics: |
||||
{{- with .Values.write.autoscaling.targetMemoryUtilizationPercentage }} |
||||
- type: Resource |
||||
resource: |
||||
name: memory |
||||
{{- if $autoscalingv2 }} |
||||
target: |
||||
type: Utilization |
||||
averageUtilization: {{ . }} |
||||
{{- else }} |
||||
targetAverageUtilization: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- with .Values.write.autoscaling.targetCPUUtilizationPercentage }} |
||||
- type: Resource |
||||
resource: |
||||
name: cpu |
||||
{{- if $autoscalingv2 }} |
||||
target: |
||||
type: Utilization |
||||
averageUtilization: {{ . }} |
||||
{{- else }} |
||||
targetAverageUtilization: {{ . }} |
||||
{{- end }} |
||||
{{- end }} |
||||
{{- end }} |
Loading…
Reference in new issue