Pete Birley 69d310d000 Helm-Toolkit: Add basic documentation for the tls secret macro
This PS adds basic documentation for the tls secret macro.

Change-Id: I36a6b171cb5bce2d4bf6dc22c22f0a630d677497
Signed-off-by: Pete Birley <pete@port.direct>
2018-07-09 14:01:09 -05:00

79 lines
2.2 KiB
Smarty

{{/*
Copyright 2018 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{/*
abstract: |
Creates a manifest for a services public tls secret
values: |
secrets:
tls:
key_manager:
api:
public: barbican-tls-public
endpoints:
key_manager:
host_fqdn_override:
public:
tls:
crt: |
FOO-CRT
key: |
FOO-KEY
ca: |
FOO-CA_CRT
usage: |
{{- include "helm-toolkit.manifests.secret_ingress_tls" ( dict "envAll" . "backendServiceType" "key-manager" ) -}}
return: |
---
apiVersion: v1
kind: Secret
metadata:
name: barbican-tls-public
type: kubernetes.io/tls
data:
tls.crt: Rk9PLUNSVAo=
tls.key: Rk9PLUtFWQo=
ca.crt: Rk9PLUNBX0NSVAo=
*/}}
{{- define "helm-toolkit.manifests.secret_ingress_tls" }}
{{- $envAll := index . "envAll" }}
{{- $endpoint := index . "endpoint" | default "public" }}
{{- $backendServiceType := index . "backendServiceType" }}
{{- $backendService := index . "backendService" | default "api" }}
{{- $host := index $envAll.Values.endpoints ( $backendServiceType | replace "-" "_" ) "host_fqdn_override" }}
{{- if hasKey $host "public" }}
{{- if kindIs "map" $host.public }}
{{- if hasKey $host.public "tls" }}
{{- if and $host.public.tls.key $host.public.tls.crt }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ index $envAll.Values.secrets.tls ( $backendServiceType | replace "-" "_" ) $backendService $endpoint }}
type: kubernetes.io/tls
data:
tls.crt: {{ $host.public.tls.crt | b64enc }}
tls.key: {{ $host.public.tls.key | b64enc }}
{{- if $host.public.tls.ca }}
ca.crt: {{ $host.public.tls.ca | b64enc }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}