| {{/* vim: set filetype=mustache: */}} |
| {{/* |
| Expand the name of the chart. |
| */}} |
| {{- define "dubbo-admin.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 "dubbo-admin.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 "dubbo-admin.chart" -}} |
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} |
| {{- end }} |
| |
| |
| {{/* |
| Allow the release namespace to be overridden for multi-namespace deployments in combined charts |
| */}} |
| {{- define "dubbo-admin.namespace" -}} |
| {{- if .Values.namespaceOverride }} |
| {{- .Values.namespaceOverride }} |
| {{- else }} |
| {{- .Release.Namespace }} |
| {{- end }} |
| {{- end }} |
| {{/* |
| Common labels |
| */}} |
| |
| |
| {{- define "dubbo-admin.labels" -}} |
| helm.sh/chart: {{ include "dubbo-admin.chart" . }} |
| {{ include "dubbo-admin.selectorLabels" . }} |
| {{- if .Chart.AppVersion }} |
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} |
| {{- end }} |
| app.kubernetes.io/managed-by: {{ .Release.Service }} |
| {{- end }} |
| |
| {{/* |
| Return the appropriate apiVersion for rbac. |
| */}} |
| {{- define "dubbo-admin.rbac.apiVersion" -}} |
| {{- if $.Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1" }} |
| {{- print "rbac.authorization.k8s.io/v1" }} |
| {{- else }} |
| {{- print "rbac.authorization.k8s.io/v1beta1" }} |
| {{- end }} |
| {{- end }} |
| |
| |
| {{/* |
| Selector labels |
| */}} |
| {{- define "dubbo-admin.selectorLabels" -}} |
| app.kubernetes.io/name: {{ include "dubbo-admin.name" . }} |
| app.kubernetes.io/instance: {{ .Release.Name }} |
| {{- end }} |
| |
| {{/* |
| Create the name of the service account to use |
| */}} |
| {{- define "dubbo-admin.serviceAccountName" -}} |
| {{- if .Values.serviceAccount.create }} |
| {{- default (include "dubbo-admin.fullname" .) .Values.serviceAccount.name }} |
| {{- else }} |
| {{- default "default" .Values.serviceAccount.name }} |
| {{- end }} |
| {{- end }} |
| |
| {{- define "dubbo-admin.serviceAccountNameTest" -}} |
| {{- if .Values.serviceAccount.create }} |
| {{- default (print (include "dubbo-admin.fullname" .) "-test") .Values.serviceAccount.nameTest }} |
| {{- else }} |
| {{- default "default" .Values.serviceAccount.nameTest }} |
| {{- end }} |
| {{- end }} |
| |
| {{/* |
| Formats imagePullSecrets. Input is (dict "root" . "imagePullSecrets" .{specific imagePullSecrets}) |
| */}} |
| {{- define "dubbo-admin.imagePullSecrets" -}} |
| {{- $root := .root }} |
| {{- range (concat .root.Values.global.imagePullSecrets .imagePullSecrets) }} |
| {{- if eq (typeOf .) "map[string]interface {}" }} |
| - {{ toYaml (dict "name" (tpl .name $root)) | trim }} |
| {{- else }} |
| - name: {{ tpl . $root }} |
| {{- end }} |
| {{- end }} |
| {{- end }} |