mirror of https://github.com/easzlab/kubeasz.git
98 lines
3.1 KiB
Smarty
98 lines
3.1 KiB
Smarty
|
{{/* vim: set filetype=mustache: */}}
|
||
|
{{/*
|
||
|
Expand the name of the chart.
|
||
|
*/}}
|
||
|
{{- define "mariadb.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 "mariadb.fullname" -}}
|
||
|
{{- if .Values.fullnameOverride -}}
|
||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||
|
{{- else -}}
|
||
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||
|
{{- if contains $name .Release.Name -}}
|
||
|
{{- printf .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||
|
{{- else -}}
|
||
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||
|
{{- end -}}
|
||
|
{{- end -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{- define "master.fullname" -}}
|
||
|
{{- if .Values.replication.enabled -}}
|
||
|
{{- printf "%s-%s" .Release.Name "mariadb-master" | trunc 63 | trimSuffix "-" -}}
|
||
|
{{- else -}}
|
||
|
{{- printf "%s-%s" .Release.Name "mariadb" | trunc 63 | trimSuffix "-" -}}
|
||
|
{{- end -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{- define "slave.fullname" -}}
|
||
|
{{- printf "%s-%s" .Release.Name "mariadb-slave" | trunc 63 | trimSuffix "-" -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{- define "mariadb.chart" -}}
|
||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{/*
|
||
|
Return the proper MariaDB image name
|
||
|
*/}}
|
||
|
{{- define "mariadb.image" -}}
|
||
|
{{- $registryName := .Values.image.registry -}}
|
||
|
{{- $repositoryName := .Values.image.repository -}}
|
||
|
{{- $tag := .Values.image.tag | toString -}}
|
||
|
{{/*
|
||
|
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||
|
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||
|
Also, we can't use a single if because lazy evaluation is not an option
|
||
|
*/}}
|
||
|
{{- if .Values.global }}
|
||
|
{{- if .Values.global.imageRegistry }}
|
||
|
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||
|
{{- else -}}
|
||
|
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||
|
{{- end -}}
|
||
|
{{- else -}}
|
||
|
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||
|
{{- end -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{/*
|
||
|
Return the proper metrics image name
|
||
|
*/}}
|
||
|
{{- define "metrics.image" -}}
|
||
|
{{- $registryName := .Values.metrics.image.registry -}}
|
||
|
{{- $repositoryName := .Values.metrics.image.repository -}}
|
||
|
{{- $tag := .Values.metrics.image.tag | toString -}}
|
||
|
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{ template "mariadb.initdbScriptsCM" . }}
|
||
|
{{/*
|
||
|
Get the initialization scripts ConfigMap name.
|
||
|
*/}}
|
||
|
{{- define "mariadb.initdbScriptsCM" -}}
|
||
|
{{- if .Values.initdbScriptsConfigMap -}}
|
||
|
{{- printf "%s" .Values.initdbScriptsConfigMap -}}
|
||
|
{{- else -}}
|
||
|
{{- printf "%s-init-scripts" (include "mariadb.fullname" .) -}}
|
||
|
{{- end -}}
|
||
|
{{- end -}}
|
||
|
|
||
|
{{/*
|
||
|
Create the name of the service account to use
|
||
|
*/}}
|
||
|
{{- define "mariadb.serviceAccountName" -}}
|
||
|
{{- if .Values.serviceAccount.create -}}
|
||
|
{{ default (include "mariadb.fullname" .) .Values.serviceAccount.name }}
|
||
|
{{- else -}}
|
||
|
{{ default "default" .Values.serviceAccount.name }}
|
||
|
{{- end -}}
|
||
|
{{- end -}}
|