update portal configmap code (#889)

* update portal configmap code

* remove accidental common-test change
This commit is contained in:
Kjeld Schouten-Lebbing
2021-09-04 00:01:55 +02:00
committed by GitHub
parent 1f42aa9e91
commit ffde8c7482
2 changed files with 29 additions and 16 deletions
+1 -1
View File
@@ -18,4 +18,4 @@ maintainers:
name: common name: common
sources: null sources: null
type: library type: library
version: 6.13.4 version: 6.13.5
@@ -8,13 +8,15 @@
{{- $host := "$node_ip" }} {{- $host := "$node_ip" }}
{{- $port := 443 }} {{- $port := 443 }}
{{- $protocol := "https" }} {{- $protocol := "https" }}
{{- $portProtocol := "" }}
{{- $path := "/" }} {{- $path := "/" }}
{{- $ingressport := 443 }} {{- $ingressport := 443 }}
{{- $test := "" }}
{{- if $ingr }} {{- if $ingr }}
{{- if $ingr.enabled }} {{- if $ingr.enabled }}
{{- $test = "blabla" }}
{{- range $ingr.hosts }} {{- range $ingr.hosts }}
{{- if .hostTpl }} {{- if .hostTpl }}
{{ $host = ( tpl .hostTpl $ ) }} {{ $host = ( tpl .hostTpl $ ) }}
{{- else if .host }} {{- else if .host }}
@@ -29,34 +31,44 @@
{{- end }} {{- end }}
{{- 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 }} {{- if .Values.portal.ingressPort }}
{{- $ingressport = .Values.portal.ingressPort }} {{- $ingressport = .Values.portal.ingressPort }}
{{- else if $traefikportalhook }} {{- else if $traefikportalhook }}
{{- if $traefikportalhook.data.websecureport }} {{- if ( index $traefikportalhook.data $entrypoint ) }}
{{- $ingressport = ( index $traefikportalhook.data "websecureport" ) }} {{- $ingressport = ( index $traefikportalhook.data $entrypoint ) }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if ne $host "$node_ip" }} {{- if eq $host "$node_ip" }}
{{- $port = $ingressport }}
{{- else if eq $host "$node_ip" }}
{{- if eq $primaryService.type "NodePort" }} {{- if eq $primaryService.type "NodePort" }}
{{- $port = $primaryPort.nodePort }} {{- $port = $primaryPort.nodePort }}
{{- if or ( eq $primaryPort.protocol "HTTP" ) ( eq $primaryPort.protocol "HTTPS" ) }}
{{- $portProtocol = $primaryPort.protocol }}
{{- end }} {{- end }}
{{- if eq $primaryService.type "LoadBalancer" }}
{{- $port = $primaryPort.port }}
{{- end }} {{- end }}
{{- if eq $primaryPort.protocol "HTTP" }}
{{- $protocol = "http" }}
{{- end }} {{- end }}
{{- else }}
{{- if and ( $portProtocol ) ( eq $host "$node_ip" ) }} {{- $port = $ingressport }}
{{- $protocol = $portProtocol }}
{{- else if and ( ne $host "$node_ip" ) }}
{{- if $ingr.tls }} {{- if $ingr.tls }}
{{- $protocol = "https" }} {{- $protocol = "https" }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if and ( .Values.portal.host ) ( eq $host "$node_ip" ) }} {{- if and ( .Values.portal.host ) ( eq $host "$node_ip" ) }}
{{- $host = .Values.portal.host }} {{- $host = .Values.portal.host }}
{{- end }} {{- end }}
@@ -76,6 +88,7 @@ metadata:
annotations: annotations:
rollme: {{ randAlphaNum 5 | quote }} rollme: {{ randAlphaNum 5 | quote }}
data: data:
test: {{ $test | quote }}
protocol: {{ $protocol }} protocol: {{ $protocol }}
host: {{ $host | quote }} host: {{ $host | quote }}
port: {{ $port | quote }} port: {{ $port | quote }}