Files
booklore/example-chart/templates/_helpers.tpl
Adam Compton ae24cca0e3 Adding a Helm chart to install in Kubernetes (#1010)
* first pass at a helm chart

* more cleanup

* adding more stuff

* trying to generate the DB password

* more fixes and hardening

* Don't need to bake this in

* switching these back to the defaults

* more cleanup

* bumping the app version to match release

* some fixes

* updating volumeMounts too

* and disabling the PVCs if we aren't using them

* fixing the spacing

---------

Co-authored-by: Aditya Chandel <8075870+adityachandelgit@users.noreply.github.com>
2025-09-07 09:27:13 -06:00

63 lines
1.8 KiB
Smarty

{{/*
Expand the name of the chart.
*/}}
{{- define "booklore.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "booklore.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "booklore.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "booklore.labels" -}}
helm.sh/chart: {{ include "booklore.chart" . }}
{{ include "booklore.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "booklore.selectorLabels" -}}
app.kubernetes.io/name: {{ include "booklore.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "booklore.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "booklore.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}