Major Common cleanup + services overhaul (#448)

* Major Common cleanup + services overhaul

* add resources test and scaleGPU support

* implement cleaner ingress, remove externalService and remove ingressRoute

* cleanup service test whoopsies

* fix some more test errors

* Fix ingress tests

* oops

* redesign ixcert system for ingress

* test multiple ixcert-secrets support

* increate tests versioning

* add test for pvc name override
This commit is contained in:
Kjeld Schouten-Lebbing
2021-05-10 14:13:17 +02:00
committed by GitHub
parent 30c996024f
commit 196d4d8327
51 changed files with 3260 additions and 2086 deletions
+12 -100
View File
@@ -5,118 +5,30 @@ of the main Ingress and any additionalIngresses.
{{- define "common.ingress" -}}
{{- /* Generate named ingresses as required */ -}}
{{- range $name, $ingress := .Values.ingress }}
{{- $certType := $ingress.certType | default "disabled" -}}
{{- $enabled := $ingress.enabled | default false -}}
{{- if or ( ne $certType "disabled" ) ( $ingress.enabled ) -}}
{{- print ("---") | nindent 0 -}}
{{- if $ingress.enabled -}}
{{- print ("---\n") | nindent 0 -}}
{{- $ingressValues := $ingress -}}
{{/* set defaults */}}
{{- if and (not $ingressValues.nameSuffix) ( ne $name "main" ) -}}
{{- if not $ingressValues.nameSuffix -}}
{{- $_ := set $ingressValues "nameSuffix" $name -}}
{{ end -}}
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
{{- if not $ingressValues.type -}}
{{- $_ := set $ingressValues "type" "HTTP" -}}
{{ end -}}
{{- if not $ingressValues.certType -}}
{{- $_ := set $ingressValues "certType" "" -}}
{{ end -}}
{{- if or ( eq $ingressValues.type "TCP" ) ( eq $ingressValues.type "UDP" ) ( eq $ingressValues.type "HTTP-IR" ) -}}
{{- include "common.classes.ingressRoute" $ -}}
{{- else -}}
{{- include "common.classes.ingress" $ -}}
{{ end -}}
{{- if eq $ingressValues.certType "ixcert" -}}
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
{{- print ("---") | nindent 0 -}}
{{- include "common.resources.cert.secret" $ }}
{{ end -}}
{{- end }}
{{- end }}
{{- include "common.classes.ingress" $ }}
{{- /* Generate additional ingresses as required */ -}}
{{- range $index, $additionalIngress := .Values.additionalIngress }}
{{- $certType := $additionalIngress.certType | default "disabled" -}}
{{- if or ( ne $certType "disabled" ) ( $additionalIngress.enabled ) -}}
{{- print ("---") | nindent 0 -}}
{{- $ingressValues := $additionalIngress -}}
{{/* set defaults */}}
{{- $name := $index -}}
{{- if $ingressValues.name -}}
{{- $name := $ingressValues.name -}}
{{- 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 }}
{{- end }}
{{- if or (not $ingressValues.nameSuffix) ( ne ( $name | quote ) "main" ) -}}
{{- $_ := set $ingressValues "nameSuffix" $name -}}
{{ end -}}
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
{{- if not $ingressValues.type -}}
{{- $_ := set $ingressValues "type" "HTTP" -}}
{{ end -}}
{{- if not $ingressValues.certType -}}
{{- $_ := set $ingressValues "certType" "" -}}
{{ end -}}
{{- if or ( eq $ingressValues.type "TCP" ) ( eq $ingressValues.type "UDP" ) ( eq $ingressValues.type "HTTP-IR" ) -}}
{{- include "common.classes.ingressRoute" $ -}}
{{- else -}}
{{- include "common.classes.ingress" $ -}}
{{ end -}}
{{- if eq $ingressValues.certType "ixcert" -}}
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
{{- print ("---") | nindent 0 -}}
{{- include "common.resources.cert.secret" $ }}
{{ end -}}
{{- end }}
{{- end }}
{{- /* Generate externalService ingresses as required */ -}}
{{- range $index, $externalService := .Values.externalServices }}
{{- $certType := $externalService.certType | default "disabled" -}}
{{- if or ( ne $certType "disabled" ) ( $externalService.enabled ) -}}
{{- print ("---") | nindent 0 -}}
{{- $ingressValues := $externalService -}}
{{/* set defaults */}}
{{- $name := $index -}}
{{- if $ingressValues.name -}}
{{- $name := $ingressValues.name -}}
{{- end }}
{{- $name = printf "%v-%v" "external" $name -}}
{{- if or (not $ingressValues.nameSuffix) -}}
{{- $_ := set $ingressValues "nameSuffix" $name -}}
{{ end -}}
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
{{- if not $ingressValues.type -}}
{{- $_ := set $ingressValues "type" "HTTP" -}}
{{ end -}}
{{- if not $ingressValues.certType -}}
{{- $_ := set $ingressValues "certType" "" -}}
{{ end -}}
{{- if or ( eq $ingressValues.type "TCP" ) ( eq $ingressValues.type "UDP" ) ( eq $ingressValues.type "HTTP-IR" ) -}}
{{- include "common.classes.ingressRoute" $ -}}
{{- else -}}
{{- include "common.classes.ingress" $ -}}
{{ end -}}
{{- print ("---") | nindent 0 -}}
{{- include "common.classes.externalService" $ }}
{{- if eq $ingressValues.certType "ixcert" -}}
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
{{- print ("---") | nindent 0 -}}
{{- include "common.resources.cert.secret" $ }}
{{ end -}}
{{- end }}
{{- end }}
{{- end }}