1- {{- /*
2- jupyterhub-cost-monitoring.chart-version-to-git-ref:
3- Renders a valid git reference from a chartpress generated version string.
4- In practice, either a git tag or a git commit hash will be returned.
1+ {{/*
2+ Expand the name of the chart.
3+ */ }}
4+ {{- define " jupyterhub-cost-monitoring.name" -}}
5+ {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix " -" }}
6+ {{- end }}
57
6- - The version string will follow a chartpress pattern,
7- like "0.1.0-0.dev.git.17.h8368bc0", see
8- https://github.com/jupyterhub/chartpress#examples-chart-versions-and-image-tags.
8+ {{/*
9+ Create a default fully qualified app name.
10+ We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+ If release name contains chart name it will be used as a full name.
12+ */ }}
13+ {{- define " jupyterhub-cost-monitoring.fullname" -}}
14+ {{- if .Values.fullnameOverride }}
15+ {{- .Values.fullnameOverride | trunc 63 | trimSuffix " -" }}
16+ {{- else }}
17+ {{- $name := default .Chart.Name .Values.nameOverride }}
18+ {{- if contains $name .Release.Name }}
19+ {{- .Release.Name | trunc 63 | trimSuffix " -" }}
20+ {{- else }}
21+ {{- printf " %s -%s " .Release.Name $name | trunc 63 | trimSuffix " -" }}
22+ {{- end }}
23+ {{- end }}
24+ {{- end }}
925
10- - The regexReplaceAll function is a sprig library function, see
11- https://masterminds.github.io/sprig/strings.html.
26+ {{- define " jupyterhub-cost-monitoring.resourceName" -}}
27+ {{- include " jupyterhub-cost-monitoring.name" . -}}
28+ {{- end }}
1229
13- - The regular expression is in golang syntax, but \d had to become \\d for
14- example .
30+ {{ /*
31+ Create chart name and version as used by the chart label .
1532*/ }}
16- {{- define " jupyterhub-cost-monitoring.chart-version-to-git-ref " -}}
17- {{- regexReplaceAll " .* \\ .git \\ . \\ d+ \\ .h(.*) " . " ${1} " }}
33+ {{- define " jupyterhub-cost-monitoring.chart" -}}
34+ {{- printf " %s - %s " .Chart.Name .Chart.Version | replace " + " " _ " | trunc 63 | trimSuffix " - " }}
1835{{- end }}
36+
37+ {{/*
38+ Common labels
39+ */ }}
40+ {{- define " jupyterhub-cost-monitoring.labels" -}}
41+ helm.sh /chart: {{ include " jupyterhub-cost-monitoring.chart" . }}
42+ {{ include " jupyterhub-cost-monitoring.selectorLabels" . }}
43+ {{- if .Chart.AppVersion }}
44+ app.kubernetes.io /version: {{ .Chart.AppVersion | quote }}
45+ {{- end }}
46+ app.kubernetes.io /managed-by: {{ .Release.Service }}
47+ {{- end }}
48+
49+ {{/*
50+ Selector labels
51+ */ }}
52+ {{- define " jupyterhub-cost-monitoring.selectorLabels" -}}
53+ app.kubernetes.io /name: {{ include " jupyterhub-cost-monitoring.name" . }}
54+ app.kubernetes.io /instance: {{ .Release.Name }}
55+ {{- end }}
0 commit comments