From b550ff887910e0038f53f5d04bebe0dbf11c99fb Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Fri, 18 Dec 2020 09:15:50 -0300 Subject: [PATCH] Implemented SSL redirect in AWS ALB --- charts/portalmodelo/v0.5.0/templates/ingress.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/charts/portalmodelo/v0.5.0/templates/ingress.yaml b/charts/portalmodelo/v0.5.0/templates/ingress.yaml index e8f61fb..0484d40 100644 --- a/charts/portalmodelo/v0.5.0/templates/ingress.yaml +++ b/charts/portalmodelo/v0.5.0/templates/ingress.yaml @@ -24,6 +24,7 @@ metadata: {{- end }} {{- if contains "alb" .Values.ingress.class }} alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]' + alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}' {{- end }} {{- else }} # DO NOT USE TLS @@ -52,6 +53,12 @@ spec: - host: "{{ $hostPrefix }}.{{ $hostName }}" http: paths: + {{- if and (contains "alb" .Values.ingress.class) (.Values.ingress.tls.enabled) }} + - path: /* + backend: + serviceName: ssl-redirect + servicePort: use-annotation + {{- end }} {{- if contains "nginx" .Values.ingress.class }} - path: /(.*) {{- else }}