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

View File

@@ -18,4 +18,4 @@ maintainers:
name: common
sources: null
type: library
version: 6.13.4
version: 6.13.5

View File

@@ -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 }}