fix: correctly redirect http traffic to https when using scheduler-k3s

This commit is contained in:
Martin Jantošovič authored and Jose Diaz-Gonzalez committed 2026-05-24 16:23:13 -04:00
1 parent 3c8cba08e5
commit caa60fa1ef
2 files changed
+197 -7

No files matched your search

@@ -13,6 +13,10 @@
{{- if and (eq $port_map.scheme "https") (hasKey $mappings (printf "http-80-%.0f" $port_map.container_port)) }}
{{- continue }}
{{- end }}
{{- range $rdx, $entryPoint := list "web" "websecure" }}
{{- if and (eq $entryPoint "websecure") (not $config.web.tls.enabled) }}
{{- continue }}
{{- end }}
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
@@ -27,19 +31,16 @@ metadata:
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
{{ include "print.labels" (dict "config" $.Values.global "key" "traefik_ingressroute") | indent 4 }}
{{ include "print.labels" (dict "config" $config "key" "traefik_ingressroute") | indent 4 }}
name: {{ $.Values.global.app_name }}-{{ $processName }}-{{ $port_map.name }}
name: {{ $.Values.global.app_name }}-{{ $processName }}-{{ $port_map.name }}{{- if eq $entryPoint "websecure" }}-{{ $entryPoint }}{{- end }}
namespace: {{ $.Values.global.namespace }}
spec:
entryPoints:
{{- if $config.web.tls.enabled }}
- websecure
{{- end }}
- web
- {{ $entryPoint }}
routes:
{{- range $ddx, $domain := $config.web.domains }}
- kind: Rule
match: Host(`{{ $domain.name }}`)
{{- if $config.web.tls.enabled }}
{{- if and (eq $entryPoint "web") $config.web.tls.enabled }}
middlewares:
- name: {{ $.Values.global.app_name}}-{{ $processName }}-redirect-to-https
namespace: {{ $.Values.global.namespace }}
@@ -51,7 +52,7 @@ spec:
port: {{ $port_map.name }}
scheme: http
{{- end }}
{{- if $config.web.tls.enabled }}
{{- if eq $entryPoint "websecure" }}
tls:
{{- if $config.web.tls.use_imported_cert }}
secretName: tls-{{ $.Values.global.app_name }}
@@ -62,3 +63,4 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end }}