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

This commit is contained in:
Jose Diaz-Gonzalez committed 2025-07-23 20:16:49 -04:00
1 parent 78bde7f817
commit 68f909b91d
9 files changed
+24 -24

No files matched your search

@@ -1,6 +1,6 @@
{{- range $processName, $config := .Values.processes }} {{- range $processName, $config := .Values.processes }}
# Skip cron jobs # Skip processes that don't have a web section
{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} {{- if not (hasKey $config "web") }}
{{- continue }} {{- continue }}
{{- end }} {{- end }}
@@ -1,11 +1,11 @@
{{- range $processName, $config := .Values.processes }} {{- range $processName, $config := .Values.processes }}
# Skip cron jobs # Skip processes that don't have a web section
{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} {{- if not (hasKey $config "web") }}
{{- continue }} {{- continue }}
{{- end }} {{- end }}
{{- $mappings := dict }} {{- $mappings := dict }}
{{- if eq $processName "web" }} {{- if hasKey $config "web" }}
{{- range $pdx, $port_map := $config.web.port_maps }} {{- range $pdx, $port_map := $config.web.port_maps }}
{{- $mappings := set $mappings $port_map.name "true" }} {{- $mappings := set $mappings $port_map.name "true" }}
{{- end }} {{- end }}
@@ -61,7 +61,7 @@ spec:
{{- range $config.args }} {{- range $config.args }}
- {{ . }} - {{ . }}
{{- end }} {{- end }}
{{- if eq $processName "web" }} {{- if hasKey $config "web" }}
env: env:
- name: PORT - name: PORT
value: "{{ $.Values.global.network.primary_port }}" value: "{{ $.Values.global.network.primary_port }}"
@@ -73,7 +73,7 @@ spec:
image: {{ $.Values.global.image.name }} image: {{ $.Values.global.image.name }}
imagePullPolicy: Always imagePullPolicy: Always
name: {{ $.Values.global.app_name }}-{{ $processName }} name: {{ $.Values.global.app_name }}-{{ $processName }}
{{- if eq $processName "web" }} {{- if hasKey $config "web" }}
ports: ports:
{{- range $pdx, $port_map := $config.web.port_maps }} {{- 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)) }} {{- if and (eq $port_map.scheme "https") (hasKey $mappings (printf "http-80-%.0f" $port_map.container_port)) }}
@@ -1,6 +1,6 @@
{{- range $processName, $config := .Values.processes }} {{- range $processName, $config := .Values.processes }}
# Skip cron jobs # Skip processes that don't have a web section
{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} {{- if not (hasKey $config "web") }}
{{- continue }} {{- continue }}
{{- end }} {{- end }}
@@ -1,6 +1,6 @@
{{- range $processName, $config := .Values.processes }} {{- range $processName, $config := .Values.processes }}
# Skip cron jobs # Skip processes that don't have a web section
{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} {{- if not (hasKey $config "web") }}
{{- continue }} {{- continue }}
{{- end }} {{- end }}
@@ -1,11 +1,11 @@
{{- range $processName, $config := .Values.processes }} {{- range $processName, $config := .Values.processes }}
# Skip cron jobs # Skip processes that don't have a web section
{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} {{- if not (hasKey $config "web") }}
{{- continue }} {{- continue }}
{{- end }} {{- end }}
{{- $routeToKeda := false }} {{- $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")) }} {{- if and ($.Capabilities.APIVersions.Has "http.keda.sh/v1alpha1") (and $config.autoscaling.http_trigger (eq $config.autoscaling.http_trigger.type "http")) }}
{{- $routeToKeda = true }} {{- $routeToKeda = true }}
{{- end }} {{- end }}
@@ -1,11 +1,11 @@
{{- if .Capabilities.APIVersions.Has "http.keda.sh/v1alpha1" -}} {{- if .Capabilities.APIVersions.Has "http.keda.sh/v1alpha1" -}}
{{- range $processName, $config := .Values.processes }} {{- range $processName, $config := .Values.processes }}
# Skip cron jobs # Skip processes that don't have a web section
{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} {{- if not (hasKey $config "web") }}
{{- continue }} {{- continue }}
{{- end }} {{- 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") }} {{- if and $config.autoscaling.http_trigger (eq $config.autoscaling.http_trigger.type "http") }}
{{- $mappings := dict }} {{- $mappings := dict }}
{{- range $pdx, $port_map := $config.web.port_maps }} {{- range $pdx, $port_map := $config.web.port_maps }}
@@ -1,11 +1,11 @@
{{- if .Capabilities.APIVersions.Has "http.keda.sh/v1alpha1" -}} {{- if .Capabilities.APIVersions.Has "http.keda.sh/v1alpha1" -}}
{{- range $processName, $config := .Values.processes }} {{- range $processName, $config := .Values.processes }}
# Skip cron jobs # Skip processes that don't have a web section
{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} {{- if not (hasKey $config "web") }}
{{- continue }} {{- continue }}
{{- end }} {{- 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 kind: Service
apiVersion: v1 apiVersion: v1
@@ -1,7 +1,7 @@
{{- if .Capabilities.APIVersions.Has "keda.sh/v1alpha1" -}} {{- if .Capabilities.APIVersions.Has "keda.sh/v1alpha1" -}}
{{- range $processName, $config := .Values.processes }} {{- range $processName, $config := .Values.processes }}
# Skip cron jobs # Skip processes that don't have a web section
{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} {{- if not (hasKey $config "web") }}
{{- continue }} {{- continue }}
{{- end }} {{- end }}
@@ -1,6 +1,6 @@
{{- range $processName, $config := .Values.processes }} {{- range $processName, $config := .Values.processes }}
# Skip cron jobs # Skip processes that don't have a web section
{{- if and (hasKey $config "cron") (hasKey $config.cron "id") }} {{- if not (hasKey $config "web") }}
{{- continue }} {{- continue }}
{{- end }} {{- end }}