Skip to content

Commit

Permalink
add helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikDK committed Aug 31, 2022
1 parent 39820b0 commit db83fa2
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions charts/skooner-lite/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "skooner-lite.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 "skooner-lite.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 "skooner-lite.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use.
*/}}
{{- define "skooner-lite.serviceAccountName" -}}
{{- default (include "skooner-lite.fullname" .) .Values.serviceAccount.name }}
{{- end }}

0 comments on commit db83fa2

Please sign in to comment.