[vFW_CNF_CDS] Update of python-sdk for vFW_CNF use case
[demo.git] / tutorials / ApacheCNF / templates / cba / Templates / k8s-configs / deployment-config / charts / common / templates / _secrets.tpl
1 {{/* vim: set filetype=mustache: */}}
2 {{/*
3 Generate secret name.
4
5 Usage:
6 {{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }}
7
8 Params:
9   - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user
10     to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility.
11     +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret
12   - defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment.
13   - context - Dict - Required. The context for the template evaluation.
14 */}}
15 {{- define "common.secrets.name" -}}
16 {{- $name := (include "common.names.fullname" .context) -}}
17
18 {{- if .defaultNameSuffix -}}
19 {{- $name = printf "%s-%s" $name .defaultNameSuffix | trunc 63 | trimSuffix "-" -}}
20 {{- end -}}
21
22 {{- with .existingSecret -}}
23 {{- if not (typeIs "string" .) -}}
24 {{- $name = .name -}}
25 {{- else -}}
26 {{- $name = . -}}
27 {{- end -}}
28 {{- end -}}
29
30 {{- printf "%s" $name -}}
31 {{- end -}}
32
33 {{/*
34 Generate secret key.
35
36 Usage:
37 {{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }}
38
39 Params:
40   - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user
41     to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility.
42     +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret
43   - key - String - Required. Name of the key in the secret.
44 */}}
45 {{- define "common.secrets.key" -}}
46 {{- $key := .key -}}
47
48 {{- if .existingSecret -}}
49   {{- if not (typeIs "string" .existingSecret) -}}
50     {{- if .existingSecret.keyMapping -}}
51       {{- $key = index .existingSecret.keyMapping $.key -}}
52     {{- end -}}
53   {{- end }}
54 {{- end -}}
55
56 {{- printf "%s" $key -}}
57 {{- end -}}