diff --git a/charts/portalmodelo/v0.5.0/questions.yaml b/charts/portalmodelo/v0.5.0/questions.yaml index 1ce0d56..10ed028 100644 --- a/charts/portalmodelo/v0.5.0/questions.yaml +++ b/charts/portalmodelo/v0.5.0/questions.yaml @@ -73,6 +73,17 @@ questions: - letsencrypt - aws +- variable: ingress.class + default: nginx + type: enum + description: "Qual o Ingress Controller?" + label: "Classe Ingress" + required: false + group: Ingress + options: + - nginx + - alb + # Configurações Avançadas - variable: portal.timeZone default: "America/Sao_Paulo" diff --git a/charts/portalmodelo/v0.5.0/templates/ingress.yaml b/charts/portalmodelo/v0.5.0/templates/ingress.yaml index 6787292..05cb02b 100644 --- a/charts/portalmodelo/v0.5.0/templates/ingress.yaml +++ b/charts/portalmodelo/v0.5.0/templates/ingress.yaml @@ -13,11 +13,31 @@ metadata: {{- include "portalmodelo.labels" . | nindent 4 }} annotations: {{- if .Values.ingress.tls.enabled }} + # USE TLS {{- if contains "letsencrypt" .Values.ingress.tls.provider }} cert-manager.io/cluster-issuer: "letsencrypt-prod" {{- end }} + {{- if contains "nginx" .Values.ingress.class }} nginx.ingress.kubernetes.io/rewrite-target: "/VirtualHostBase/https/www.{{ $hostName }}:443/portal/VirtualHostRoot/$1" nginx.ingress.kubernetes.io/from-to-www-redirect: "true" + {{- end }} + {{- if contains "alb" .Values.ingress.class }} + alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]' + {{- end }} + {{- else }} + # DO NOT USE TLS + {{- if contains "nginx" .Values.ingress.class }} + nginx.ingress.kubernetes.io/rewrite-target: "/VirtualHostBase/http/www.{{ $hostName }}:80/portal/VirtualHostRoot/$1" + {{- end }} + {{- if contains "alb" .Values.ingress.class }} + alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}]' + {{- end }} + {{- end }} + {{- if contains "alb" .Values.ingress.class }} + alb.ingress.kubernetes.io/group.name: pm + alb.ingress.kubernetes.io/scheme: internet-facing + alb.ingress.kubernetes.io/target-type: ip + kubernetes.io/ingress.class: alb {{- end }} spec: {{- if .Values.ingress.tls.enabled }} @@ -31,7 +51,11 @@ spec: - host: "www.{{ $hostName }}" http: paths: + {{- if contains "nginx" .Values.ingress.class }} - path: /(.*) + {{- else }} + - path: /* + {{- end }} backend: serviceName: {{ $fullName }}-plone servicePort: 8080 diff --git a/charts/portalmodelo/v0.5.0/values.yaml b/charts/portalmodelo/v0.5.0/values.yaml index 28f9abd..9a0c919 100644 --- a/charts/portalmodelo/v0.5.0/values.yaml +++ b/charts/portalmodelo/v0.5.0/values.yaml @@ -53,6 +53,9 @@ securityContext: {} ingress: enabled: true + class: nginx + # nginx - for default nginx ingress controller + # alb - for AWS ALB Load Balancer controller tls: enabled: true provider: letsencrypt