|
| 1 | +{{/* |
| 2 | +Expand the name of the chart. |
| 3 | +*/}} |
| 4 | +{{- define "understack.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 | +*/}} |
| 13 | +{{- define "understack.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 }} |
| 25 | + |
| 26 | +{{/* |
| 27 | +Create chart name and version as used by the chart label. |
| 28 | +*/}} |
| 29 | +{{- define "understack.chart" -}} |
| 30 | +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} |
| 31 | +{{- end }} |
| 32 | + |
| 33 | +{{/* |
| 34 | +Common labels |
| 35 | +*/}} |
| 36 | +{{- define "understack.labels" -}} |
| 37 | +helm.sh/chart: {{ include "understack.chart" . }} |
| 38 | +{{ include "understack.selectorLabels" . }} |
| 39 | +{{- if .Chart.AppVersion }} |
| 40 | +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} |
| 41 | +{{- end }} |
| 42 | +app.kubernetes.io/managed-by: {{ .Release.Service }} |
| 43 | +{{- end }} |
| 44 | + |
| 45 | +{{/* |
| 46 | +Selector labels |
| 47 | +*/}} |
| 48 | +{{- define "understack.selectorLabels" -}} |
| 49 | +app.kubernetes.io/name: {{ include "understack.name" . }} |
| 50 | +app.kubernetes.io/instance: {{ .Release.Name }} |
| 51 | +{{- end }} |
| 52 | + |
| 53 | +{{/* |
| 54 | +Create the name of the service account to use |
| 55 | +*/}} |
| 56 | +{{- define "understack.serviceAccountName" -}} |
| 57 | +{{- if .Values.serviceAccount.create }} |
| 58 | +{{- default (include "understack.fullname" .) .Values.serviceAccount.name }} |
| 59 | +{{- else }} |
| 60 | +{{- default "default" .Values.serviceAccount.name }} |
| 61 | +{{- end }} |
| 62 | +{{- end }} |
| 63 | + |
| 64 | +{{/* |
| 65 | +Create a valid ArgoCD Application name |
| 66 | +*/}} |
| 67 | +{{- define "understack.argocdAppName" -}} |
| 68 | +{{- $root := index . 0 }} |
| 69 | +{{- $appName := index . 1 }} |
| 70 | +{{- printf "%s-%s" $root.Release.Name $appName }} |
| 71 | +{{- end }} |
| 72 | + |
| 73 | +{{/* |
| 74 | +Get the UnderStack repository URL |
| 75 | +*/}} |
| 76 | +{{- define "understack.understack_url" -}} |
| 77 | +{{- .Values.understack_url }} |
| 78 | +{{- end }} |
| 79 | + |
| 80 | +{{/* |
| 81 | +Get the UnderStack repository git reference |
| 82 | +*/}} |
| 83 | +{{- define "understack.understack_ref" -}} |
| 84 | +{{- .Values.understack_ref }} |
| 85 | +{{- end }} |
| 86 | + |
| 87 | +{{/* |
| 88 | +Get the deployment repository URL |
| 89 | +*/}} |
| 90 | +{{- define "understack.deploy_url" -}} |
| 91 | +{{- required "deploy_url is required. Please set it in your values file" .Values.deploy_url }} |
| 92 | +{{- end }} |
| 93 | + |
| 94 | +{{/* |
| 95 | +Get the deployment repository git reference |
| 96 | +*/}} |
| 97 | +{{- define "understack.deploy_ref" -}} |
| 98 | +{{- .Values.deploy_ref }} |
| 99 | +{{- end }} |
0 commit comments