From ffde8c748250ec159440f3dfd7f5d2421bce7591 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sat, 4 Sep 2021 00:01:55 +0200 Subject: [PATCH] update portal configmap code (#889) * update portal configmap code * remove accidental common-test change --- charts/library/common/Chart.yaml | 2 +- .../common/templates/configmaps/_portal.tpl | 43 ++++++++++++------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index d9b459f5346..c1294f726b2 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -18,4 +18,4 @@ maintainers: name: common sources: null type: library -version: 6.13.4 +version: 6.13.5 diff --git a/charts/library/common/templates/configmaps/_portal.tpl b/charts/library/common/templates/configmaps/_portal.tpl index 3f776988e79..b1b90e78e06 100644 --- a/charts/library/common/templates/configmaps/_portal.tpl +++ b/charts/library/common/templates/configmaps/_portal.tpl @@ -8,13 +8,15 @@ {{- $host := "$node_ip" }} {{- $port := 443 }} {{- $protocol := "https" }} -{{- $portProtocol := "" }} {{- $path := "/" }} {{- $ingressport := 443 }} +{{- $test := "" }} {{- if $ingr }} {{- if $ingr.enabled }} + {{- $test = "blabla" }} {{- range $ingr.hosts }} + {{- if .hostTpl }} {{ $host = ( tpl .hostTpl $ ) }} {{- else if .host }} @@ -29,34 +31,44 @@ {{- end }} {{- end }} -{{- $traefikportalhook := lookup "v1" "ConfigMap" "traefikmiddlewares" "portalhook" }} +{{- $namespace := "traefikmiddlewares" }} + +{{- if $ingr.ingressClassName }} +{{- $namespace := ( printf "ix-%s" $ingr.ingressClassName ) }} +{{- end }} +{{- $traefikportalhook := lookup "v1" "ConfigMap" $namespace "portalhook" }} + +{{- $entrypoint := "websecure" }} +{{- if $ingr.entrypoint }} + {{- $entrypoint = $ingr.entrypoint }} +{{- end }} + {{- if .Values.portal.ingressPort }} {{- $ingressport = .Values.portal.ingressPort }} {{- else if $traefikportalhook }} - {{- if $traefikportalhook.data.websecureport }} - {{- $ingressport = ( index $traefikportalhook.data "websecureport" ) }} + {{- if ( index $traefikportalhook.data $entrypoint ) }} + {{- $ingressport = ( index $traefikportalhook.data $entrypoint ) }} {{- end }} {{- end }} -{{- if ne $host "$node_ip" }} - {{- $port = $ingressport }} -{{- else if eq $host "$node_ip" }} +{{- if eq $host "$node_ip" }} {{- if eq $primaryService.type "NodePort" }} {{- $port = $primaryPort.nodePort }} - {{- if or ( eq $primaryPort.protocol "HTTP" ) ( eq $primaryPort.protocol "HTTPS" ) }} - {{- $portProtocol = $primaryPort.protocol }} - {{- end }} {{- end }} -{{- end }} - -{{- if and ( $portProtocol ) ( eq $host "$node_ip" ) }} - {{- $protocol = $portProtocol }} -{{- else if and ( ne $host "$node_ip" ) }} + {{- if eq $primaryService.type "LoadBalancer" }} + {{- $port = $primaryPort.port }} + {{- end }} + {{- if eq $primaryPort.protocol "HTTP" }} + {{- $protocol = "http" }} + {{- end }} +{{- else }} + {{- $port = $ingressport }} {{- if $ingr.tls }} {{- $protocol = "https" }} {{- end }} {{- end }} + {{- if and ( .Values.portal.host ) ( eq $host "$node_ip" ) }} {{- $host = .Values.portal.host }} {{- end }} @@ -76,6 +88,7 @@ metadata: annotations: rollme: {{ randAlphaNum 5 | quote }} data: + test: {{ $test | quote }} protocol: {{ $protocol }} host: {{ $host | quote }} port: {{ $port | quote }}