|
| 1 | +{{/* |
| 2 | + Expand the name of the chart. |
| 3 | +*/}} |
| 4 | +{{- define "django-app.name" -}} |
| 5 | + {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} |
| 6 | +{{- end -}} |
| 7 | + |
| 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 | + https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names |
| 13 | +*/}} |
| 14 | +{{- define "django-app.fullname" -}} |
| 15 | + {{- if .Values.fullnameOverride -}} |
| 16 | + {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} |
| 17 | + {{- else -}} |
| 18 | + {{- $name := default .Chart.Name .Values.nameOverride -}} |
| 19 | + {{- if contains $name .Release.Name -}} |
| 20 | + {{- .Release.Name | trunc 63 | trimSuffix "-" -}} |
| 21 | + {{- else -}} |
| 22 | + {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} |
| 23 | + {{- end -}} |
| 24 | + {{- end -}} |
| 25 | +{{- end -}} |
| 26 | + |
| 27 | +{{/* |
| 28 | + Create chart name and version as used by the chart label. |
| 29 | +*/}} |
| 30 | +{{- define "django-app.chart" -}} |
| 31 | + {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} |
| 32 | +{{- end -}} |
| 33 | + |
| 34 | +{{/* |
| 35 | +Create the name of the secret to be used by the django-app |
| 36 | +*/}} |
| 37 | +{{- define "django-app.secretname" -}} |
| 38 | +{{- if .Values.secretsName }} |
| 39 | + {{- .Values.secretsName -}} |
| 40 | +{{- else }} |
| 41 | + {{- printf "%s-secret" (include "django-app.fullname" .) -}} |
| 42 | +{{- end -}} |
| 43 | +{{- end -}} |
| 44 | + |
| 45 | +{{/* |
| 46 | +Create the name of the configmap to be used by the django-app |
| 47 | +*/}} |
| 48 | +{{- define "django-app.envConfigMapName" -}} |
| 49 | +{{- if .Values.envConfigMapName }} |
| 50 | + {{- .Values.envConfigMapName -}} |
| 51 | +{{- else }} |
| 52 | + {{- printf "%s-env-name" (include "django-app.fullname" .) -}} |
| 53 | +{{- end -}} |
| 54 | +{{- end -}} |
0 commit comments