|
| 1 | +{{/* |
| 2 | +Expand the name of the chart. |
| 3 | +*/}} |
| 4 | +{{- define "terraform.name" -}} |
| 5 | +{{- default .Release.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} |
| 6 | +{{- end }} |
| 7 | + |
| 8 | +{{/* |
| 9 | +Create a default fully qualified app name. |
| 10 | +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 11 | +If release name contains chart name it will be used as a full name. |
| 12 | +*/}} |
| 13 | +{{- define "terraform.fullname" -}} |
| 14 | +{{- if .Values.fullnameOverride }} |
| 15 | +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} |
| 16 | +{{- else }} |
| 17 | +{{- $name := default .Chart.Name .Values.nameOverride }} |
| 18 | +{{- if contains $name .Release.Name }} |
| 19 | +{{- .Release.Name | trunc 63 | trimSuffix "-" }} |
| 20 | +{{- else }} |
| 21 | +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} |
| 22 | +{{- end }} |
| 23 | +{{- end }} |
| 24 | +{{- end }} |
| 25 | + |
| 26 | +{{/* |
| 27 | +Create chart name and version as used by the chart label. |
| 28 | +*/}} |
| 29 | +{{- define "terraform.chart" -}} |
| 30 | +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} |
| 31 | +{{- end }} |
| 32 | + |
| 33 | +{{/* |
| 34 | +Common labels |
| 35 | +*/}} |
| 36 | +{{- define "terraform.labels" -}} |
| 37 | +helm.sh/chart: {{ include "terraform.chart" . }} |
| 38 | +{{ include "terraform.selectorLabels" . }} |
| 39 | +{{- if .Chart.AppVersion }} |
| 40 | +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} |
| 41 | +{{- end }} |
| 42 | +app.kubernetes.io/managed-by: {{ .Release.Service }} |
| 43 | +{{- end }} |
| 44 | + |
| 45 | +{{/* |
| 46 | +Selector labels |
| 47 | +*/}} |
| 48 | +{{- define "terraform.selectorLabels" -}} |
| 49 | +app.kubernetes.io/name: {{ include "terraform.name" . }} |
| 50 | +app.kubernetes.io/instance: {{ .Release.Name }} |
| 51 | +{{- end }} |
| 52 | + |
| 53 | +{{/* |
| 54 | +Create the name of the service account to use |
| 55 | +*/}} |
| 56 | +{{- define "terraform.serviceAccountName" -}} |
| 57 | +{{- if .Values.serviceAccount.create }} |
| 58 | +{{- default (include "terraform.fullname" .) .Values.serviceAccount.name }} |
| 59 | +{{- else }} |
| 60 | +{{- default "default" .Values.serviceAccount.name }} |
| 61 | +{{- end }} |
| 62 | +{{- end }} |
| 63 | + |
| 64 | +{{/* vim: set filetype=mustache: */}} |
| 65 | +{{/* |
| 66 | +Expand the name of the chart. |
| 67 | +*/}} |
| 68 | +{{- define ".Chart.Name .name" -}} |
| 69 | +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} |
| 70 | +{{- end -}} |
| 71 | + |
| 72 | +{{/* |
| 73 | +Create a default fully qualified app name. |
| 74 | +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 75 | +If release name contains chart name it will be used as a full name. |
| 76 | +*/}} |
| 77 | +{{- define ".Chart.Name .fullname" -}} |
| 78 | +{{- if .Values.fullnameOverride -}} |
| 79 | +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} |
| 80 | +{{- else -}} |
| 81 | +{{- $name := default .Chart.Name .Values.nameOverride -}} |
| 82 | +{{- if contains $name .Release.Name -}} |
| 83 | +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} |
| 84 | +{{- else -}} |
| 85 | +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} |
| 86 | +{{- end -}} |
| 87 | +{{- end -}} |
| 88 | +{{- end -}} |
| 89 | + |
| 90 | +{{/* |
| 91 | +Create chart name and version as used by the chart label. |
| 92 | +*/}} |
| 93 | +{{- define ".Chart.Name .chart" -}} |
| 94 | +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} |
| 95 | +{{- end -}} |
| 96 | + |
| 97 | +{{- define ".Chart.Name .color" -}} |
| 98 | +{{- $active0 := (index .Values.server.deployment 0).enabled -}} |
| 99 | +{{/* |
| 100 | +{{- $active1 := (index .Values.server.deployment 1).enabled -}} |
| 101 | +*/}} |
| 102 | +{{- $active1 := include "safeenabledcheck" . -}} |
| 103 | +{{- $active := and $active0 $active1 -}} |
| 104 | +{{- $active -}} |
| 105 | +{{- end -}} |
0 commit comments