From 36fcfa18c493caa159548b76d59fa6f7605291f8 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Wed, 19 May 2021 22:08:21 +0200 Subject: [PATCH] Small common touchup --- charts/library/common/Chart.yaml | 2 +- charts/library/common/templates/_all.tpl | 2 +- .../library/common/templates/classes/_portal.tpl | 15 ++++++++------- charts/library/common/values.yaml | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index 2fbe311de89..713f3922ecd 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -19,4 +19,4 @@ name: common sources: - https://github.com/truecharts/apps/tree/master/library/common type: library -version: 4.1.0 +version: 4.1.1 diff --git a/charts/library/common/templates/_all.tpl b/charts/library/common/templates/_all.tpl index 644d7cb3b3f..89d9c92cb99 100644 --- a/charts/library/common/templates/_all.tpl +++ b/charts/library/common/templates/_all.tpl @@ -31,7 +31,7 @@ Main entrypoint for the common library chart. It will render all underlying temp {{- if .Values.secret -}} {{ include "common.secret" . | nindent 0 }} {{- end -}} - {{ include "common.classes.portal" . | nindent 0 }} + {{ include "common.class.portal" . | nindent 0 }} {{ include "common.class.mountPermissions" . | nindent 0 }} {{- end -}} diff --git a/charts/library/common/templates/classes/_portal.tpl b/charts/library/common/templates/classes/_portal.tpl index ce1919d5749..782aa36e706 100644 --- a/charts/library/common/templates/classes/_portal.tpl +++ b/charts/library/common/templates/classes/_portal.tpl @@ -1,8 +1,9 @@ -{{- define "common.classes.portal" -}} +{{- define "common.class.portal" -}} {{- if .Values.portal }} {{- if .Values.portal.enabled }} -{{- $svc := index .Values.services (keys .Values.services | first) -}} +{{- $primaryService := get .Values.service (include "common.service.primary" .) }} +{{- $primaryPort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}} {{- $ingr := index .Values.ingress (keys .Values.ingress | first) -}} {{- $host := "$node_ip" }} {{- $port := 443 }} @@ -30,10 +31,10 @@ {{- if and ( .Values.portal.ingressPort ) ( ne $host "$node_ip" ) }} {{- $port = .Values.portal.ingressPort }} {{- else if eq $host "$node_ip" }} - {{- if eq $svc.type "NodePort" }} - {{- $port = $svc.port.nodePort }} - {{- if or ( eq $svc.port.protocol "HTTP" ) ( eq $svc.port.protocol "HTTPS" ) }} - {{- $portProtocol = $svc.port.protocol }} + {{- if eq $primaryService.type "NodePort" }} + {{- $port = $primaryPort.nodePort }} + {{- if or ( eq $primaryPort.protocol "HTTP" ) ( eq $primaryPort.protocol "HTTPS" ) }} + {{- $portProtocol = $primaryPort.protocol }} {{- end }} {{- end }} {{- end }} @@ -54,7 +55,7 @@ {{- $path = .Values.portal.path }} {{- end }} -{{- print "---" | nindent 0 -}} +--- apiVersion: v1 kind: ConfigMap diff --git a/charts/library/common/values.yaml b/charts/library/common/values.yaml index 224d9dbc931..0febbb5e8f7 100644 --- a/charts/library/common/values.yaml +++ b/charts/library/common/values.yaml @@ -222,7 +222,7 @@ service: # Additional ports can be added by adding a dictionary key similar to the 'http' service. # @default -- See below ports: - http: + main: # -- Enables or disables the port enabled: true