Dominic Lunanuova | 50aafc5 | 2018-03-30 02:29:23 +0000 | [diff] [blame] | 1 | {{/* vim: set filetype=mustache: */}} |
| 2 | {{/* |
| 3 | Expand the name of the chart. |
| 4 | */}} |
| 5 | {{- define "postgresql.name" -}} |
| 6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} |
| 7 | {{- end -}} |
| 8 | |
| 9 | {{/* |
| 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). |
| 12 | If release name contains chart name it will be used as a full name. |
| 13 | */}} |
| 14 | {{- define "postgresql.fullname" -}} |
| 15 | {{- if .Values.fullnameOverride -}} |
| 16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} |
| 17 | {{- else -}} |
| 18 | {{- $name := default .Chart.Name .Values.nameOverride -}} |
| 19 | {{- if contains $name .Release.Name -}} |
| 20 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} |
| 21 | {{- else -}} |
| 22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} |
| 23 | {{- end -}} |
| 24 | {{- end -}} |
| 25 | {{- end -}} |
| 26 | |
| 27 | {{/* |
| 28 | Return the appropriate apiVersion for networkpolicy. |
| 29 | */}} |
| 30 | {{- define "postgresql.networkPolicy.apiVersion" -}} |
| 31 | {{- if and (ge .Capabilities.KubeVersion.Minor "4") (le .Capabilities.KubeVersion.Minor "6") -}} |
| 32 | "extensions/v1beta1" |
| 33 | {{- else if ge .Capabilities.KubeVersion.Minor "7" -}} |
| 34 | "networking.k8s.io/v1" |
| 35 | {{- end -}} |
| 36 | {{- end -}} |