-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add autoscaling for tempo-distributed metrics-generator
This adds autoscaling via hpa and keda for tempo-distributed metrics-generator. Implementation is analog to the already existing autoscaling options for the compactor. Signed-off-by: Marius Svechla <m.svechla@gmail.com>
- Loading branch information
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
charts/tempo-distributed/templates/metrics-generator/hpa.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{{- if and .Values.metricsGenerator.autoscaling.enabled .Values.metricsGenerator.autoscaling.hpa.enabled }} | ||
{{- $apiVersion := include "tempo.hpa.apiVersion" . -}} | ||
{{ $dict := dict "ctx" . "component" "metrics-generator" }} | ||
apiVersion: {{ $apiVersion }} | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: {{ include "tempo.resourceName" $dict }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "tempo.labels" $dict | nindent 4 }} | ||
spec: | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: {{ .Values.metricsGenerator.kind }} | ||
name: {{ include "tempo.resourceName" $dict }} | ||
minReplicas: {{ .Values.metricsGenerator.autoscaling.minReplicas }} | ||
maxReplicas: {{ .Values.metricsGenerator.autoscaling.maxReplicas }} | ||
{{- with .Values.metricsGenerator.autoscaling.hpa.behavior }} | ||
behavior: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
metrics: | ||
{{- with .Values.metricsGenerator.autoscaling.hpa.targetMemoryUtilizationPercentage }} | ||
- type: Resource | ||
resource: | ||
name: memory | ||
{{- if (eq $apiVersion "autoscaling/v2") }} | ||
target: | ||
type: Utilization | ||
averageUtilization: {{ . }} | ||
{{- else }} | ||
targetAverageUtilization: {{ . }} | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Values.metricsGenerator.autoscaling.hpa.targetCPUUtilizationPercentage }} | ||
- type: Resource | ||
resource: | ||
name: cpu | ||
{{- if (eq $apiVersion "autoscaling/v2") }} | ||
target: | ||
type: Utilization | ||
averageUtilization: {{ . }} | ||
{{- else }} | ||
targetAverageUtilization: {{ . }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
26 changes: 26 additions & 0 deletions
26
charts/tempo-distributed/templates/metrics-generator/keda-scaled-object.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{{- if and .Values.metricsGenerator.autoscaling.enabled .Values.metricsGenerator.autoscaling.keda.enabled }} | ||
{{ $dict := dict "ctx" . "component" "metrics-generator" }} | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: ScaledObject | ||
metadata: | ||
name: {{ include "tempo.resourceName" $dict }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "tempo.labels" $dict | nindent 4 }} | ||
spec: | ||
minReplicaCount: {{ .Values.metricsGenerator.autoscaling.minReplicas }} | ||
maxReplicaCount: {{ .Values.metricsGenerator.autoscaling.maxReplicas }} | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
name: {{ include "tempo.resourceName" $dict }} | ||
triggers: | ||
{{- range .Values.metricsGenerator.autoscaling.keda.triggers }} | ||
- type: {{ .type | quote }} | ||
metadata: | ||
serverAddress: {{ .metadata.serverAddress }} | ||
threshold: {{ .metadata.threshold | quote }} | ||
query: | | ||
{{- .metadata.query | nindent 8 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters