more ingress validation

This commit is contained in:
Stavros kois
2023-12-08 02:28:09 +02:00
parent 2e203f8eb9
commit 205e4ca335
2 changed files with 10 additions and 5 deletions

View File

@@ -584,10 +584,10 @@ tests:
- hosts:
- test-host
secretName: test-secret
scaleCert: "1"
clusterCertificate: some-cert
asserts:
- failedTemplate:
errorMessage: Ingress - Expected only one of [scaleCert, secretName] to be set, but got [scaleCert, secretName]
errorMessage: Ingress - Expected only one of [scaleCert, secretName, certificateIssuer, clusterCertificate] to be set, but got [secretName, clusterCertificate]
- it: should fail with scaleCert outside of SCALE
set:
@@ -604,4 +604,4 @@ tests:
scaleCert: "1"
asserts:
- failedTemplate:
errorMessage: Ingress - [tls.scalecert] can only be used in TrueNAS SCALE
errorMessage: Ingress - [tls.scaleCert] can only be used in TrueNAS SCALE

View File

@@ -96,6 +96,12 @@ objectData:
{{- end -}}
{{- range $t := $objectData.tls -}}
{{- if $t.scaleCert -}}
{{- if not $rootCtx.Values.global.ixChartContext -}}
{{- fail "Ingress - [tls.scaleCert] can only be used in TrueNAS SCALE" -}}
{{- end -}}
{{- end -}}
{{- if not $t.hosts -}}
{{- fail "Ingress - Expected non-empty [tls.hosts]" -}}
{{- end -}}
@@ -121,8 +127,7 @@ objectData:
{{- end -}}
{{- end -}}
{{/* TODO: Add the rest of the options?! */}}
{{- $certOptions := (list "scaleCert" "secretName") -}}
{{- $certOptions := (list "scaleCert" "secretName" "certificateIssuer" "clusterCertificate") -}}
{{- $optsSet := list -}}
{{- range $opt := $certOptions -}}
{{- if (get $t $opt) -}}