_helpers.tpl 2.99 KB
Newer Older
Sandro Mathys's avatar
Sandro Mathys committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
91
92
93
94
95
96
97
98
99
{{/*
Expand the name of the chart.
*/}}
{{- define "shibboleth-sp.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- 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 }}
{{- .Values.fullnameOverride | trunc 54 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- 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 }}

{{/*
Create the name of the service account to use
*/}}
{{- define "shibboleth-sp.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "shibboleth-sp.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}