fix: ensure the ScaledObject resource is not created if the capability does not exist

This commit is contained in:
Jose Diaz-Gonzalez
2024-02-27 16:48:08 -05:00
parent 46f11cb239
commit 8add9b4b13

View File

@@ -1,6 +1,7 @@
{{- $processName := "PROCESS_NAME" }} {{- $processName := "PROCESS_NAME" }}
{{- $config := index .Values.processes "PROCESS_NAME" }} {{- $config := index .Values.processes "PROCESS_NAME" }}
{{- if and $config.autoscaling (and $config.autoscaling.enabled (eq $config.autoscaling.type "keda")) }} {{- if and $config.autoscaling (and $config.autoscaling.enabled (eq $config.autoscaling.type "keda")) }}
{{- if .Capabilities.APIVersions.Has "keda.sh/v1alpha1" -}}
apiVersion: keda.sh/v1alpha1 apiVersion: keda.sh/v1alpha1
kind: ScaledObject kind: ScaledObject
metadata: metadata:
@@ -40,4 +41,5 @@ spec:
replicas: {{ $config.replicas }} replicas: {{ $config.replicas }}
triggers: triggers:
{{- toYaml $config.autoscaling.triggers | nindent 4 }} {{- toYaml $config.autoscaling.triggers | nindent 4 }}
{{- end }} {{- end }}
{{- end }}