forked from spotfiresoftware/spotfire-cloud-deployment-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeda-autoscaling.yaml
37 lines (37 loc) · 1.62 KB
/
keda-autoscaling.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{{- if .Values.kedaAutoscaling.enabled -}}
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: {{ printf "%s-%s-keda" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "spotfire-common.spotfire-service.fullname" . }}
pollingInterval: {{ .Values.kedaAutoscaling.pollingInterval }}
cooldownPeriod: {{ .Values.kedaAutoscaling.cooldownPeriod }}
minReplicaCount: {{ .Values.kedaAutoscaling.minReplicas }}
maxReplicaCount: {{ .Values.kedaAutoscaling.maxReplicas }}
{{- if .Values.kedaAutoscaling.fallback }}
fallback:
{{- toYaml .Values.kedaAutoscaling.fallback | nindent 4 }}
{{- end }}
{{- if .Values.kedaAutoscaling.advanced }}
advanced:
{{- toYaml .Values.kedaAutoscaling.advanced | nindent 4 }}
{{- end }}
triggers:
{{- if empty .Values.kedaAutoscaling.triggers }}
- type: prometheus
metadata:
serverAddress: {{ required "The prometheus server address must be set for KEDA autoscaling configuration" .Values.kedaAutoscaling.spotfireConfig.prometheusServerAddress }}
metricName: spotfire_service_queue_engines_inUse
threshold: {{ required "The target threshold when to scale out must be specified" .Values.kedaAutoscaling.threshold | quote }}
query: {{ printf "sum(spotfire_service_queue_engines_inUse{capability=\"R\", app_kubernetes_io_instance=\"%s\"})" .Release.Name | quote }}
namespace: {{ .Release.Namespace }}
{{- else }}
{{- with .Values.kedaAutoscaling.triggers }}
{{- tpl (. | toYaml ) $ | nindent 4 }}
{{- end }}
{{- end }}
{{- end -}}