From 44eab143ab7491df87a39fe6aa56007ac33ad27e Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 13 Nov 2024 17:10:41 -0500 Subject: [PATCH] fix: do not perform nil lookup --- plugins/scheduler-k3s/templates/chart/ingress.yaml | 2 +- .../templates/chart/keda-http-scaled-object.yaml | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/scheduler-k3s/templates/chart/ingress.yaml b/plugins/scheduler-k3s/templates/chart/ingress.yaml index fbe512c17..5530525f3 100644 --- a/plugins/scheduler-k3s/templates/chart/ingress.yaml +++ b/plugins/scheduler-k3s/templates/chart/ingress.yaml @@ -2,7 +2,7 @@ {{- $config := index .Values.processes "PROCESS_NAME" }} {{- $routeToKeda := false }} {{- if and (eq $processName "web") (and $config.autoscaling (and $config.autoscaling.enabled (eq $config.autoscaling.type "keda"))) }} -{{- if and (.Capabilities.APIVersions.Has "http.keda.sh/v1alpha1") $config.autoscaling.http_trigger.type }} +{{- if and (.Capabilities.APIVersions.Has "http.keda.sh/v1alpha1") (and $config.autoscaling.http_trigger (eq $config.autoscaling.http_trigger.type "http")) }} {{- $routeToKeda = true }} {{- end }} {{- end }} diff --git a/plugins/scheduler-k3s/templates/chart/keda-http-scaled-object.yaml b/plugins/scheduler-k3s/templates/chart/keda-http-scaled-object.yaml index 92a26edb4..bd761642f 100644 --- a/plugins/scheduler-k3s/templates/chart/keda-http-scaled-object.yaml +++ b/plugins/scheduler-k3s/templates/chart/keda-http-scaled-object.yaml @@ -1,8 +1,7 @@ {{- $processName := "PROCESS_NAME" }} {{- $config := index .Values.processes "PROCESS_NAME" }} {{- if and (eq $processName "web") (and $config.autoscaling (and $config.autoscaling.enabled (eq $config.autoscaling.type "keda"))) }} -{{- if .Capabilities.APIVersions.Has "http.keda.sh/v1alpha1" -}} -{{- if and $config.autoscaling.http_trigger (eq $config.autoscaling.http_trigger.type "http") }} +{{- if and (.Capabilities.APIVersions.Has "http.keda.sh/v1alpha1") (and $config.autoscaling.http_trigger (eq $config.autoscaling.http_trigger.type "http")) }} {{- $mappings := dict }} {{- range $pdx, $port_map := $config.web.port_maps }} {{- $mappings := set $mappings $port_map.name "true" }} @@ -52,4 +51,3 @@ spec: {{- end }} {{- end }} {{- end }} -{{- end }}