1- {{- if and .Values.autoscaling.enabled (eq .Values.autoscaling.type "scaledobject" ) }}
1+ {{- if and (and .Values.autoscaling.enabled (eq .Values.autoscaling.type "scaledobject" )) (coalesce .Values.autoscaling.targetMemoryUtilizationPercentage .Values.autoscaling.targetCPUUtilizationPercentage .Values.autoscaling.triggers .Values.autoscaling.kafka .Values.autoscaling.prometheus .Values.autoscaling.cron ) }}
22{{- $fullName := include "application-core.fullname" . -}}
33apiVersion : keda.sh/v1alpha1
44kind : ScaledObject
@@ -16,18 +16,19 @@ spec:
1616 apiVersion : apps/v1
1717 kind : Deployment
1818 name : {{ include "application-core.fullname" . }}
19- pollingInterval : 30
20- cooldownPeriod : 300
19+ pollingInterval : {{ default 30 .Values.autoscaling.pollingInterval }}
20+ cooldownPeriod : {{ default 300 .Values.autoscaling.cooldownPeriod }}
2121 minReplicaCount : {{ .Values.autoscaling.minReplicas }}
2222 maxReplicaCount : {{ .Values.autoscaling.maxReplicas }}
2323 triggers :
24- {{- if and .Values.autoscaling.targetCPUUtilizationPercentage (not .Values.autoscaling.kafka )}}
24+ {{- if not .Values.autoscaling.triggers -}}
25+ {{- if .Values.autoscaling.targetCPUUtilizationPercentage}}
2526 - type : cpu
2627 metricType : Utilization
2728 metadata :
2829 value : {{ .Values.autoscaling.targetCPUUtilizationPercentage | quote }}
2930 {{- end }}
30- {{- if and .Values.autoscaling.targetMemoryUtilizationPercentage (not .Values.autoscaling.kafka ) }}
31+ {{- if .Values.autoscaling.targetMemoryUtilizationPercentage}}
3132 - type : memory
3233 metricType : Utilization
3334 metadata :
5253 kind : {{ default "ClusterTriggerAuthentication" .authenticationRefKind }}
5354 {{- end }}
5455 {{- end }}
56+ {{- if .Values.autoscaling.prometheus }}
57+ - type : prometheus
58+ metadata :
59+ {{- with .Values.autoscaling.prometheus }}
60+ serverAddress : {{ .serverAddress }}
61+ query : {{ .query }}
62+ threshold : {{ .threshold }}
63+ activationThreshold : {{ default 0 .activationThreshold | quote }}
64+ ignoreNullValues : {{ default "true" .ignoreNullValues | quote }}
65+ unsafeSsl : " false"
66+ authenticationRef :
67+ name : {{ default "keda-prom-creds" .authenticationRef }}
68+ kind : {{ default "ClusterTriggerAuthentication" .authenticationRefKind }}
69+ {{- end }}
70+ {{- end }}
71+ {{- if .Values.autoscaling.cron }}
72+ - type : cron
73+ metadata :
74+ {{- with .Values.autoscaling.cron }}
75+ timezone : {{ default "UTC" .timezone }}
76+ start : {{ .start }}
77+ end : {{ .end }}
78+ desiredReplicas : {{ .desiredReplicas }}
79+ {{- end }}
80+ {{- end }}
81+ {{- end }}
82+ {{- if .Values.autoscaling.triggers }}
83+ {{- toYaml .Values.autoscaling.triggers | nindent 4 }}
84+ {{- end }}
5585{{- end }}
0 commit comments