blob: 61437655af08c4eed138dce2e532f42d38dc959f [file] [log] [blame]
Yi Tseng32561422021-10-07 15:03:21 -07001{{/*
2Copyright 2020-present Open Networking Foundation
Charles Chand1b4bf92022-02-02 16:27:10 -08003SPDX-License-Identifier: Apache-2.0
Yi Tseng32561422021-10-07 15:03:21 -07004*/}}
5
6{{- define "extraParams" -}}
7{{- join "," . -}}
8{{- end -}}
9
10{{/*
11Expand the name of the chart.
12*/}}
13{{- define "dbuf.name" -}}
14{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
15{{- end }}
16
17{{/*
18Create a default fully qualified app name.
19We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
20If 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{{/*
36Create 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{{/*
43Common labels
44*/}}
45{{- define "dbuf.labels" -}}
46helm.sh/chart: {{ include "dbuf.chart" . }}
47{{ include "dbuf.selectorLabels" . }}
48{{- if .Chart.AppVersion }}
49app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
50{{- end }}
51app.kubernetes.io/managed-by: {{ .Release.Service }}
52{{- end }}
53
54{{/*
55Selector labels
56*/}}
57{{- define "dbuf.selectorLabels" -}}
58app.kubernetes.io/name: {{ include "dbuf.name" . }}
59app.kubernetes.io/instance: {{ .Release.Name }}
60{{- end }}
61
62{{/*
63Create 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 }}