Ingress: make tls functions gotpl yaml safe

This PS updates the tls functions to be yaml safe for the service
name.

Change-Id: I535f38a8d92c01280d79926a1f0acd06984aabbf
Signed-off-by: Pete Birley <pete@port.direct>
This commit is contained in:
Pete Birley 2018-06-26 02:03:19 -05:00
parent 469fe37c3e
commit 326303702d
2 changed files with 4 additions and 4 deletions

View File

@ -67,12 +67,12 @@ metadata:
kubernetes.io/ingress.class: {{ index $envAll.Values.network $backendService "ingress" "classes" $ingressController | quote }}
{{ toYaml (index $envAll.Values.network $backendService "ingress" "annotations") | indent 4 }}
spec:
{{- $host := index $envAll.Values.endpoints $backendServiceType "host_fqdn_override" }}
{{- $host := index $envAll.Values.endpoints ( $backendServiceType | replace "-" "_" ) "host_fqdn_override" }}
{{- if $host.public }}
{{- if $host.public.tls }}
{{- if and $host.public.tls.key $host.public.tls.crt }}
tls:
- secretName: {{ index $envAll.Values.secrets "tls" $backendServiceType $backendService "public" }}
- secretName: {{ index $envAll.Values.secrets "tls" ( $backendServiceType | replace "-" "_" ) $backendService "public" }}
hosts:
- {{ index $hostNameFullRules "vHost" }}
{{- end }}

View File

@ -19,7 +19,7 @@ limitations under the License.
{{- $endpoint := index . "endpoint" | default "public" }}
{{- $backendServiceType := index . "backendServiceType" }}
{{- $backendService := index . "backendService" | default "api" }}
{{- $host := index $envAll.Values.endpoints $backendServiceType "host_fqdn_override" }}
{{- $host := index $envAll.Values.endpoints ( $backendServiceType | replace "-" "_" ) "host_fqdn_override" }}
{{- if $host.public }}
{{- if $host.public.tls }}
{{- if and $host.public.tls.key $host.public.tls.crt }}
@ -27,7 +27,7 @@ limitations under the License.
apiVersion: v1
kind: Secret
metadata:
name: {{ index $envAll.Values.secrets.tls $backendServiceType $backendService $endpoint }}
name: {{ index $envAll.Values.secrets.tls ( $backendServiceType | replace "-" "_" ) $backendService $endpoint }}
type: kubernetes.io/tls
data:
tls.crt: {{ $host.public.tls.crt | b64enc }}