Skip to content

Commit 521b79b

Browse files
committed
Remove labels helpers
2 parents bff323b + 0028060 commit 521b79b

3 files changed

Lines changed: 51 additions & 34 deletions

File tree

helm/jupyterhub-cost-monitoring/templates/_helpers-labels.tpl

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,55 @@
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 }}

helm/jupyterhub-cost-monitoring/templates/deployment.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: {{ include "jupyterhub-cost-monitoring.webserver.fullname" . }}
4+
name: {{ include "jupyterhub-cost-monitoring.resourceName" . }}-deployment
55
labels:
66
{{- include "jupyterhub-cost-monitoring.labels" . | nindent 4 }}
77
spec:
@@ -12,7 +12,6 @@ spec:
1212
template:
1313
metadata:
1414
annotations:
15-
checksum/mounted-secret: {{ include (print .Template.BasePath "/secret.yaml") . | sha256sum }}
1615
checksum/service-account: {{ include (print .Template.BasePath "/serviceaccount.yaml") . | sha256sum }}
1716
{{- with .Values.podAnnotations }}
1817
{{- . | toYaml | nindent 8 }}

0 commit comments

Comments
 (0)