1 {{/* vim: set filetype=mustache: */}}
3 Expand the name of the chart.
5 {{- define "postgresql.name" -}}
6 {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
10 Create a default fully qualified app name.
11 We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
13 {{- define "postgresql.fullname" -}}
14 {{- if .Values.fullnameOverride -}}
15 {{- printf .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17 {{- $name := default .Chart.Name .Values.nameOverride -}}
18 {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23 Create a default fully qualified app name.
24 We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
26 {{- define "postgresql.master.fullname" -}}
27 {{- $name := default .Chart.Name .Values.nameOverride -}}
28 {{- $fullname := default (printf "%s-%s" .Release.Name $name) .Values.fullnameOverride -}}
29 {{- if .Values.replication.enabled -}}
30 {{- printf "%s-%s" $fullname "master" | trunc 63 | trimSuffix "-" -}}
32 {{- printf "%s" $fullname | trunc 63 | trimSuffix "-" -}}
37 Return the appropriate apiVersion for networkpolicy.
39 {{- define "postgresql.networkPolicy.apiVersion" -}}
40 {{- if semverCompare ">=1.4-0, <1.7-0" .Capabilities.KubeVersion.GitVersion -}}
42 {{- else if semverCompare "^1.7-0" .Capabilities.KubeVersion.GitVersion -}}
43 "networking.k8s.io/v1"
48 Create chart name and version as used by the chart label.
50 {{- define "postgresql.chart" -}}
51 {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
55 Return the proper PostgreSQL image name
57 {{- define "postgresql.image" -}}
58 {{- $registryName := .Values.image.registry -}}
59 {{- $repositoryName := .Values.image.repository -}}
60 {{- $tag := .Values.image.tag | toString -}}
62 Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
63 but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
64 Also, we can't use a single if because lazy evaluation is not an option
66 {{- if .Values.global }}
67 {{- if .Values.global.imageRegistry }}
68 {{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
70 {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
73 {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
78 Return the proper image name to change the volume permissions
80 {{- define "postgresql.volumePermissions.image" -}}
81 {{- $registryName := .Values.volumePermissions.image.registry -}}
82 {{- $repositoryName := .Values.volumePermissions.image.repository -}}
83 {{- $tag := .Values.volumePermissions.image.tag | toString -}}
85 Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
86 but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
87 Also, we can't use a single if because lazy evaluation is not an option
89 {{- if .Values.global }}
90 {{- if .Values.global.imageRegistry }}
91 {{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
93 {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
96 {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
102 Return the proper PostgreSQL metrics image name
104 {{- define "metrics.image" -}}
105 {{- $registryName := default "docker.io" .Values.metrics.image.registry -}}
106 {{- $tag := default "latest" .Values.metrics.image.tag | toString -}}
107 {{- printf "%s/%s:%s" $registryName .Values.metrics.image.repository $tag -}}
111 Get the password secret.
113 {{- define "postgresql.secretName" -}}
114 {{- if .Values.existingSecret -}}
115 {{- printf "%s" .Values.existingSecret -}}
117 {{- printf "%s" (include "postgresql.fullname" .) -}}
122 Get the configuration ConfigMap name.
124 {{- define "postgresql.configurationCM" -}}
125 {{- if .Values.configurationConfigMap -}}
126 {{- printf "%s" .Values.configurationConfigMap -}}
128 {{- printf "%s-configuration" (include "postgresql.fullname" .) -}}
133 Get the extended configuration ConfigMap name.
135 {{- define "postgresql.extendedConfigurationCM" -}}
136 {{- if .Values.extendedConfConfigMap -}}
137 {{- printf "%s" .Values.extendedConfConfigMap -}}
139 {{- printf "%s-extended-configuration" (include "postgresql.fullname" .) -}}
144 Get the initialization scripts ConfigMap name.
146 {{- define "postgresql.initdbScriptsCM" -}}
147 {{- if .Values.initdbScriptsConfigMap -}}
148 {{- printf "%s" .Values.initdbScriptsConfigMap -}}
150 {{- printf "%s-init-scripts" (include "postgresql.fullname" .) -}}