port most recent changes from KAH (#478)

* port most recent changes from KAH

* add general shizzle

* add rests of go tests

* whoops

* hmm

* make pre-release wait more

* try another synthaxis

* okey...

* test-> tests

* Make unittests a bit more usefull
This commit is contained in:
Kjeld Schouten-Lebbing
2021-05-19 20:51:35 +02:00
committed by GitHub
parent fd43d79929
commit d3033f71fb
59 changed files with 2792 additions and 3956 deletions
+40 -26
View File
@@ -1,34 +1,48 @@
{{/*
Renders the Ingress objects required by the chart by returning a concatinated list
of the main Ingress and any additionalIngresses.
*/}}
{{/* Renders the Ingress objects required by the chart */}}
{{- define "common.ingress" -}}
{{- /* Generate named ingresses as required */ -}}
{{- range $name, $ingress := .Values.ingress }}
{{- if $ingress.enabled -}}
{{- print ("---\n") | nindent 0 -}}
{{- $ingressValues := $ingress -}}
{{- /* Generate named ingresses as required */ -}}
{{- range $name, $ingress := .Values.ingress }}
{{- if $ingress.enabled -}}
{{- $ingressValues := $ingress -}}
{{/* set defaults */}}
{{- if not $ingressValues.nameSuffix -}}
{{- $_ := set $ingressValues "nameSuffix" $name -}}
{{ end -}}
{{/* set defaults */}}
{{- if and (not $ingressValues.nameOverride) (ne $name (include "common.ingress.primary" $)) -}}
{{- $_ := set $ingressValues "nameOverride" $name -}}
{{- end -}}
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
{{- include "common.classes.ingress" $ }}
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
{{- include "common.classes.ingress" $ }}
{{- range $index, $tlsValues := $ingressValues.tls }}
{{- if .scaleCert }}
{{- $nameSuffix := ( printf "%v-%v-%v" $ingressValues.nameSuffix "tls" $index ) -}}
{{- $_ := set $tlsValues "nameSuffix" $nameSuffix -}}
{{- $_ := set $ "ObjectValues" (dict "certHolder" $tlsValues) -}}
{{- print ("---\n") | nindent 0 -}}
{{- include "common.cert.secret" $ -}}
{{- end }}
{{- range $name, $tlsValues := $ingressValues.tls }}
{{- if .scaleCert }}
{{- $nameOverride := ( printf "%v-%v-%v" $ingressValues.nameOverride "tls" $name ) -}}
{{- $_ := set $tlsValues "nameOverride" $nameOverride -}}
{{- $_ := set $ "ObjectValues" (dict "certHolder" $tlsValues) -}}
{{- include "common.cert.secret" $ -}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{/* Return the name of the primary ingress object */}}
{{- define "common.ingress.primary" -}}
{{- $enabledIngresses := dict -}}
{{- range $name, $ingress := .Values.ingress -}}
{{- if $ingress.enabled -}}
{{- $_ := set $enabledIngresses $name . -}}
{{- end -}}
{{- end -}}
{{- $result := "" -}}
{{- range $name, $ingress := $enabledIngresses -}}
{{- if and (hasKey $ingress "primary") $ingress.primary -}}
{{- $result = $name -}}
{{- end -}}
{{- end -}}
{{- if not $result -}}
{{- $result = keys $enabledIngresses | first -}}
{{- end -}}
{{- $result -}}
{{- end -}}