_helpers.tpl 5.67 KB
Newer Older
Sandro Mathys's avatar
Sandro Mathys committed
1
2
3
4
{{/*
Expand the name of the chart.
*/}}
{{- define "shibboleth-sp.name" -}}
5
{{- default .Chart.Name (tpl .Values.nameOverride .) | trunc 63 | trimSuffix "-" }}
Sandro Mathys's avatar
Sandro Mathys committed
6
7
8
9
10
11
12
13
14
15
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 54 chars because some Kubernetes name fields are limited to 63 chars (by the DNS naming spec),
and we want to append "-backend" and "-frontend" below.
If release name contains chart name it will be used as a full name.
*/}}
{{- define "shibboleth-sp.fullname" -}}
{{- if .Values.fullnameOverride }}
16
{{- (tpl .Values.fullnameOverride .) | trunc 54 | trimSuffix "-" }}
Sandro Mathys's avatar
Sandro Mathys committed
17
{{- else }}
18
{{- $name := default .Chart.Name (tpl .Values.nameOverride .) }}
Sandro Mathys's avatar
Sandro Mathys committed
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 54 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 54 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{- define "shibboleth-sp.backend.fullname" -}}
{{- include "shibboleth-sp.fullname" . }}-backend
{{- end }}

{{- define "shibboleth-sp.frontend.fullname" -}}
{{- include "shibboleth-sp.fullname" . }}-frontend
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "shibboleth-sp.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "shibboleth-sp.labels" -}}
helm.sh/chart: {{ include "shibboleth-sp.chart" . }}
{{ include "shibboleth-sp.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "shibboleth-sp.backend.labels" -}}
helm.sh/chart: {{ include "shibboleth-sp.chart" . }}
{{ include "shibboleth-sp.backend.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "shibboleth-sp.frontend.labels" -}}
helm.sh/chart: {{ include "shibboleth-sp.chart" . }}
{{ include "shibboleth-sp.frontend.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "shibboleth-sp.selectorLabels" -}}
app.kubernetes.io/name: {{ include "shibboleth-sp.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "shibboleth-sp.backend.selectorLabels" -}}
{{ include "shibboleth-sp.selectorLabels" . }}
app.kubernetes.io/component: shibboleth
{{- end }}

{{- define "shibboleth-sp.frontend.selectorLabels" -}}
{{ include "shibboleth-sp.selectorLabels" . }}
app.kubernetes.io/component: apache
{{- end }}

{{/*
Sandro Mathys's avatar
Sandro Mathys committed
91
Create the names of the service accounts to use
Sandro Mathys's avatar
Sandro Mathys committed
92
93
94
*/}}
{{- define "shibboleth-sp.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
Sandro Mathys's avatar
Sandro Mathys committed
95
{{- .Values.serviceAccount.name | default (include "shibboleth-sp.fullname" .) }}
Sandro Mathys's avatar
Sandro Mathys committed
96
{{- else }}
Sandro Mathys's avatar
Sandro Mathys committed
97
{{- .Values.serviceAccount.name | default "default" }}
Sandro Mathys's avatar
Sandro Mathys committed
98
99
{{- end }}
{{- end }}
Sandro Mathys's avatar
Sandro Mathys committed
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

{{- define "shibboleth-sp.sealerKeys.serviceAccountName" -}}
{{- if .Values.backend.shibboleth.sessionCache.sealerKeys.serviceAccount.create }}
{{- .Values.backend.shibboleth.sessionCache.sealerKeys.serviceAccount.name | default (print (include "shibboleth-sp.fullname" .) "-sealer-keys-nanny") }}
{{- else }}
{{- .Values.backend.shibboleth.sessionCache.sealerKeys.serviceAccount.name | default "deployer" }}
{{- end }}
{{- end }}

{{/*
Create the names of the images and pull policies to use
*/}}
{{- define "shibboleth-sp.frontend.image.repository" -}}
{{- .Values.frontend.image.repository | default .Values.image.repository -}}
{{- end }}
{{- define "shibboleth-sp.frontend.image.tag" -}}
{{- .Values.frontend.image.tag | default .Values.image.tag -}}
{{- end }}
{{- define "shibboleth-sp.frontend.image" -}}
{{- printf "%s:%s" (include "shibboleth-sp.frontend.image.repository" .) (include "shibboleth-sp.frontend.image.tag" .) }}
{{- end }}
{{- define "shibboleth-sp.frontend.imagePullPolicy" -}}
{{- .Values.frontend.image.pullPolicy | default .Values.image.pullPolicy }}
{{- end }}

{{- define "shibboleth-sp.backend.image.repository" -}}
{{- .Values.backend.image.repository | default .Values.image.repository -}}
{{- end }}
{{- define "shibboleth-sp.backend.image.tag" -}}
{{- .Values.backend.image.tag | default .Values.image.tag -}}
{{- end }}
{{- define "shibboleth-sp.backend.image" -}}
{{- printf "%s:%s" (include "shibboleth-sp.backend.image.repository" .) (include "shibboleth-sp.backend.image.tag" .) }}
{{- end }}
{{- define "shibboleth-sp.backend.imagePullPolicy" -}}
{{- .Values.backend.image.pullPolicy | default .Values.image.pullPolicy }}
{{- end }}

{{- define "shibboleth-sp.sealerKeys.image.repository" -}}
{{- .Values.backend.shibboleth.sessionCache.sealerKeys.image.repository | default (include "shibboleth-sp.backend.image.repository" .) -}}
{{- end }}
{{- define "shibboleth-sp.sealerKeys.image.tag" -}}
{{- .Values.backend.shibboleth.sessionCache.sealerKeys.image.tag | default (include "shibboleth-sp.backend.image.tag" .) -}}
{{- end }}
{{- define "shibboleth-sp.sealerKeys.image" -}}
{{- printf "%s:%s" (include "shibboleth-sp.sealerKeys.image.repository" .) (include "shibboleth-sp.sealerKeys.image.tag" .) }}
{{- end }}
{{- define "shibboleth-sp.sealerKeys.imagePullPolicy" -}}
{{- .Values.backend.shibboleth.sessionCache.sealerKeys.image.pullPolicy | default (include "shibboleth-sp.backend.imagePullPolicy" .)  }}
{{- end }}

{{/*
Create the names of the secrets to use
*/}}
{{- define "shibboleth-sp.sealerKeys.secretName" -}}
{{- .Values.backend.shibboleth.sessionCache.sealerKeys.secret | default (print (include "shibboleth-sp.fullname" .) "-sealer-keys") }}
{{- end }}