From 68f909b91d94cfcea75703511365e09c9acfe7d2 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 23 Jul 2025 20:16:49 -0400 Subject: [PATCH] fix: only process web-related templates when there is a web section embedded in the template --- plugins/scheduler-k3s/templates/chart/certificate.yaml | 4 ++-- plugins/scheduler-k3s/templates/chart/deployment.yaml | 10 +++++----- .../templates/chart/https-redirect-middleware.yaml | 4 ++-- .../scheduler-k3s/templates/chart/ingress-route.yaml | 4 ++-- plugins/scheduler-k3s/templates/chart/ingress.yaml | 6 +++--- .../templates/chart/keda-http-scaled-object.yaml | 6 +++--- .../chart/keda-interceptor-proxy-service.yaml | 6 +++--- .../templates/chart/keda-scaled-object.yaml | 4 ++-- plugins/scheduler-k3s/templates/chart/service.yaml | 4 ++-- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/plugins/scheduler-k3s/templates/chart/certificate.yaml b/plugins/scheduler-k3s/templates/chart/certificate.yaml index a16e03a8a..5065d77f8 100644 --- a/plugins/scheduler-k3s/templates/chart/certificate.yaml +++ b/plugins/scheduler-k3s/templates/chart/certificate.yaml @@ -1,6 +1,6 @@ {{- range $processName, $config := .Values.processes }} -# Skip cron jobs -{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} +# Skip processes that don't have a web section +{{- if not (hasKey $config "web") }} {{- continue }} {{- end }} diff --git a/plugins/scheduler-k3s/templates/chart/deployment.yaml b/plugins/scheduler-k3s/templates/chart/deployment.yaml index 6d06ec008..4ffa5ba29 100644 --- a/plugins/scheduler-k3s/templates/chart/deployment.yaml +++ b/plugins/scheduler-k3s/templates/chart/deployment.yaml @@ -1,11 +1,11 @@ {{- range $processName, $config := .Values.processes }} -# Skip cron jobs -{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} +# Skip processes that don't have a web section +{{- if not (hasKey $config "web") }} {{- continue }} {{- end }} {{- $mappings := dict }} -{{- if eq $processName "web" }} +{{- if hasKey $config "web" }} {{- range $pdx, $port_map := $config.web.port_maps }} {{- $mappings := set $mappings $port_map.name "true" }} {{- end }} @@ -61,7 +61,7 @@ spec: {{- range $config.args }} - {{ . }} {{- end }} - {{- if eq $processName "web" }} + {{- if hasKey $config "web" }} env: - name: PORT value: "{{ $.Values.global.network.primary_port }}" @@ -73,7 +73,7 @@ spec: image: {{ $.Values.global.image.name }} imagePullPolicy: Always name: {{ $.Values.global.app_name }}-{{ $processName }} - {{- if eq $processName "web" }} + {{- if hasKey $config "web" }} ports: {{- range $pdx, $port_map := $config.web.port_maps }} {{- if and (eq $port_map.scheme "https") (hasKey $mappings (printf "http-80-%.0f" $port_map.container_port)) }} diff --git a/plugins/scheduler-k3s/templates/chart/https-redirect-middleware.yaml b/plugins/scheduler-k3s/templates/chart/https-redirect-middleware.yaml index d81397a53..b4b6bc810 100644 --- a/plugins/scheduler-k3s/templates/chart/https-redirect-middleware.yaml +++ b/plugins/scheduler-k3s/templates/chart/https-redirect-middleware.yaml @@ -1,6 +1,6 @@ {{- range $processName, $config := .Values.processes }} -# Skip cron jobs -{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} +# Skip processes that don't have a web section +{{- if not (hasKey $config "web") }} {{- continue }} {{- end }} diff --git a/plugins/scheduler-k3s/templates/chart/ingress-route.yaml b/plugins/scheduler-k3s/templates/chart/ingress-route.yaml index 01bf6ff76..bdf492282 100644 --- a/plugins/scheduler-k3s/templates/chart/ingress-route.yaml +++ b/plugins/scheduler-k3s/templates/chart/ingress-route.yaml @@ -1,6 +1,6 @@ {{- range $processName, $config := .Values.processes }} -# Skip cron jobs -{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} +# Skip processes that don't have a web section +{{- if not (hasKey $config "web") }} {{- continue }} {{- end }} diff --git a/plugins/scheduler-k3s/templates/chart/ingress.yaml b/plugins/scheduler-k3s/templates/chart/ingress.yaml index b416c3eab..2349d0292 100644 --- a/plugins/scheduler-k3s/templates/chart/ingress.yaml +++ b/plugins/scheduler-k3s/templates/chart/ingress.yaml @@ -1,11 +1,11 @@ {{- range $processName, $config := .Values.processes }} -# Skip cron jobs -{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} +# Skip processes that don't have a web section +{{- if not (hasKey $config "web") }} {{- continue }} {{- end }} {{- $routeToKeda := false }} -{{- if and (eq $processName "web") (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 and ($.Capabilities.APIVersions.Has "http.keda.sh/v1alpha1") (and $config.autoscaling.http_trigger (eq $config.autoscaling.http_trigger.type "http")) }} {{- $routeToKeda = true }} {{- 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 be6890a96..2e1fea6db 100644 --- a/plugins/scheduler-k3s/templates/chart/keda-http-scaled-object.yaml +++ b/plugins/scheduler-k3s/templates/chart/keda-http-scaled-object.yaml @@ -1,11 +1,11 @@ {{- if .Capabilities.APIVersions.Has "http.keda.sh/v1alpha1" -}} {{- range $processName, $config := .Values.processes }} -# Skip cron jobs -{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} +# Skip processes that don't have a web section +{{- if not (hasKey $config "web") }} {{- continue }} {{- end }} -{{- if and (eq $processName "web") (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 and $config.autoscaling.http_trigger (eq $config.autoscaling.http_trigger.type "http") }} {{- $mappings := dict }} {{- range $pdx, $port_map := $config.web.port_maps }} diff --git a/plugins/scheduler-k3s/templates/chart/keda-interceptor-proxy-service.yaml b/plugins/scheduler-k3s/templates/chart/keda-interceptor-proxy-service.yaml index 4c259c946..f7b76393b 100644 --- a/plugins/scheduler-k3s/templates/chart/keda-interceptor-proxy-service.yaml +++ b/plugins/scheduler-k3s/templates/chart/keda-interceptor-proxy-service.yaml @@ -1,11 +1,11 @@ {{- if .Capabilities.APIVersions.Has "http.keda.sh/v1alpha1" -}} {{- range $processName, $config := .Values.processes }} -# Skip cron jobs -{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} +# Skip processes that don't have a web section +{{- if not (hasKey $config "web") }} {{- continue }} {{- end }} -{{- if and (eq $processName "web") (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")) }} --- kind: Service apiVersion: v1 diff --git a/plugins/scheduler-k3s/templates/chart/keda-scaled-object.yaml b/plugins/scheduler-k3s/templates/chart/keda-scaled-object.yaml index b6633556f..e57e6a799 100644 --- a/plugins/scheduler-k3s/templates/chart/keda-scaled-object.yaml +++ b/plugins/scheduler-k3s/templates/chart/keda-scaled-object.yaml @@ -1,7 +1,7 @@ {{- if .Capabilities.APIVersions.Has "keda.sh/v1alpha1" -}} {{- range $processName, $config := .Values.processes }} -# Skip cron jobs -{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} +# Skip processes that don't have a web section +{{- if not (hasKey $config "web") }} {{- continue }} {{- end }} diff --git a/plugins/scheduler-k3s/templates/chart/service.yaml b/plugins/scheduler-k3s/templates/chart/service.yaml index 0b6a02417..f35967ab1 100644 --- a/plugins/scheduler-k3s/templates/chart/service.yaml +++ b/plugins/scheduler-k3s/templates/chart/service.yaml @@ -1,6 +1,6 @@ {{- range $processName, $config := .Values.processes }} -# Skip cron jobs -{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} +# Skip processes that don't have a web section +{{- if not (hasKey $config "web") }} {{- continue }} {{- end }}