pudelkoM | 3f0efb1 | 2021-01-12 13:55:48 -0800 | [diff] [blame] | 1 | {{/* |
| 2 | Copyright 2020-present Open Networking Foundation |
Scott Baker | 4cad5ee | 2022-06-09 14:17:35 -0700 | [diff] [blame^] | 3 | SPDX-License-Identifier: Apache-2.0 |
pudelkoM | 3f0efb1 | 2021-01-12 13:55:48 -0800 | [diff] [blame] | 4 | */}} |
| 5 | |
| 6 | {{- define "extraParams" -}} |
| 7 | {{- join "," . -}} |
| 8 | {{- end -}} |
| 9 | |
| 10 | {{/* |
| 11 | Expand the name of the chart. |
| 12 | */}} |
| 13 | {{- define "dbuf.name" -}} |
| 14 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} |
| 15 | {{- end }} |
| 16 | |
| 17 | {{/* |
| 18 | Create a default fully qualified app name. |
| 19 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 20 | If release name contains chart name it will be used as a full name. |
| 21 | */}} |
| 22 | {{- define "dbuf.fullname" -}} |
| 23 | {{- if .Values.fullnameOverride }} |
| 24 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} |
| 25 | {{- else }} |
| 26 | {{- $name := default .Chart.Name .Values.nameOverride }} |
| 27 | {{- if contains $name .Release.Name }} |
| 28 | {{- .Release.Name | trunc 63 | trimSuffix "-" }} |
| 29 | {{- else }} |
| 30 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} |
| 31 | {{- end }} |
| 32 | {{- end }} |
| 33 | {{- end }} |
| 34 | |
| 35 | {{/* |
| 36 | Create chart name and version as used by the chart label. |
| 37 | */}} |
| 38 | {{- define "dbuf.chart" -}} |
| 39 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} |
| 40 | {{- end }} |
| 41 | |
| 42 | {{/* |
| 43 | Common labels |
| 44 | */}} |
| 45 | {{- define "dbuf.labels" -}} |
| 46 | helm.sh/chart: {{ include "dbuf.chart" . }} |
| 47 | {{ include "dbuf.selectorLabels" . }} |
| 48 | {{- if .Chart.AppVersion }} |
| 49 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} |
| 50 | {{- end }} |
| 51 | app.kubernetes.io/managed-by: {{ .Release.Service }} |
| 52 | {{- end }} |
| 53 | |
| 54 | {{/* |
| 55 | Selector labels |
| 56 | */}} |
| 57 | {{- define "dbuf.selectorLabels" -}} |
| 58 | app.kubernetes.io/name: {{ include "dbuf.name" . }} |
| 59 | app.kubernetes.io/instance: {{ .Release.Name }} |
| 60 | {{- end }} |
| 61 | |
| 62 | {{/* |
| 63 | Create the name of the service account to use |
| 64 | */}} |
| 65 | {{- define "dbuf.serviceAccountName" -}} |
| 66 | {{- if .Values.serviceAccount.create }} |
| 67 | {{- default (include "dbuf.fullname" .) .Values.serviceAccount.name }} |
| 68 | {{- else }} |
| 69 | {{- default "default" .Values.serviceAccount.name }} |
| 70 | {{- end }} |
| 71 | {{- end }} |