fix: only process web-related templates when there is a web section embedded in the template

This commit is contained in:
Jose Diaz-Gonzalez
2025-07-23 20:16:49 -04:00
parent 78bde7f817
commit 68f909b91d
9 changed files with 24 additions and 24 deletions

View File

@@ -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 }}

View File

@@ -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)) }}

View File

@@ -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 }}

View File

@@ -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 }}

View File

@@ -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 }}

View File

@@ -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 }}

View File

@@ -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

View File

@@ -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 }}

View File

@@ -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 }}