74 lines
2.3 KiB
Smarty
74 lines
2.3 KiB
Smarty
{{/* vim: set filetype=mustache: */}}
|
|
{{/*
|
|
Expand the name of the chart.
|
|
*/}}
|
|
{{- define "openldap.name" -}}
|
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
{{/*
|
|
Return the appropriate apiVersion for statefulset.
|
|
*/}}
|
|
{{- define "statefulset.apiVersion" -}}
|
|
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
|
{{- print "apps/v1beta1" -}}
|
|
{{- else -}}
|
|
{{- print "apps/v1" -}}
|
|
{{- end -}}
|
|
{{- 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 "openldap.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 "openldap.chart" -}}
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
|
|
|
|
{{/*
|
|
Generate chart secret name
|
|
*/}}
|
|
{{- define "openldap.secretName" -}}
|
|
{{ default (include "openldap.fullname" .) .Values.existingSecret }}
|
|
{{- end -}}
|
|
{{/*
|
|
Generate replication services list
|
|
*/}}
|
|
{{- define "replicalist" -}}
|
|
{{- $name := (include "openldap.fullname" .) }}
|
|
{{- $namespace := .Release.Namespace }}
|
|
{{- $cluster := .Values.replication.clusterName }}
|
|
{{- $nodeCount := .Values.replicaCount | int }}
|
|
{{- range $index0 := until $nodeCount -}}
|
|
{{- $index1 := $index0 | add1 -}}
|
|
'ldap://{{ $name }}-{{ $index0 }}.{{ $name }}-headless.{{ $namespace }}.svc.{{ $cluster }}'{{ if ne $index1 $nodeCount }},{{ end }}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{/*
|
|
Renders a value that contains template.
|
|
Usage:
|
|
{{ include "openldap.tplValue" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
|
*/}}
|
|
{{- define "openldap.tplValue" -}}
|
|
{{- if typeIs "string" .value }}
|
|
{{- tpl .value .context }}
|
|
{{- else }}
|
|
{{- tpl (.value | toYaml) .context }}
|
|
{{- end }}
|
|
{{- end -}} |