github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/cert-manager/templates/_helpers.tpl (about) 1 {{/* vim: set filetype=mustache: */}} 2 {{/* 3 Expand the name of the chart. 4 */}} 5 {{- define "cert-manager.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 */}} 13 {{- define "cert-manager.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 the name of the service account to use 28 */}} 29 {{- define "cert-manager.serviceAccountName" -}} 30 {{- if .Values.serviceAccount.create -}} 31 {{ default (include "cert-manager.fullname" .) .Values.serviceAccount.name }} 32 {{- else -}} 33 {{ default "default" .Values.serviceAccount.name }} 34 {{- end -}} 35 {{- end -}} 36 37 {{/* 38 Webhook templates 39 */}} 40 41 {{/* 42 Expand the name of the chart. 43 Manually fix the 'app' and 'name' labels to 'webhook' to maintain 44 compatibility with the v0.9 deployment selector. 45 */}} 46 {{- define "webhook.name" -}} 47 {{- printf "webhook" -}} 48 {{- end -}} 49 50 {{/* 51 Create a default fully qualified app name. 52 We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 53 If release name contains chart name it will be used as a full name. 54 */}} 55 {{- define "webhook.fullname" -}} 56 {{- $trimmedName := printf "%s" (include "cert-manager.fullname" .) | trunc 55 | trimSuffix "-" -}} 57 {{- printf "%s-webhook" $trimmedName | trunc 63 | trimSuffix "-" -}} 58 {{- end -}} 59 60 {{- define "webhook.caRef" -}} 61 {{- template "cert-manager.namespace" }}/{{ template "webhook.fullname" . }}-ca 62 {{- end -}} 63 64 {{/* 65 Create the name of the service account to use 66 */}} 67 {{- define "webhook.serviceAccountName" -}} 68 {{- if .Values.webhook.serviceAccount.create -}} 69 {{ default (include "webhook.fullname" .) .Values.webhook.serviceAccount.name }} 70 {{- else -}} 71 {{ default "default" .Values.webhook.serviceAccount.name }} 72 {{- end -}} 73 {{- end -}} 74 75 {{/* 76 cainjector templates 77 */}} 78 79 {{/* 80 Expand the name of the chart. 81 Manually fix the 'app' and 'name' labels to 'cainjector' to maintain 82 compatibility with the v0.9 deployment selector. 83 */}} 84 {{- define "cainjector.name" -}} 85 {{- printf "cainjector" -}} 86 {{- end -}} 87 88 {{/* 89 Create a default fully qualified app name. 90 We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 91 If release name contains chart name it will be used as a full name. 92 */}} 93 {{- define "cainjector.fullname" -}} 94 {{- $trimmedName := printf "%s" (include "cert-manager.fullname" .) | trunc 52 | trimSuffix "-" -}} 95 {{- printf "%s-cainjector" $trimmedName | trunc 63 | trimSuffix "-" -}} 96 {{- end -}} 97 98 {{/* 99 Create the name of the service account to use 100 */}} 101 {{- define "cainjector.serviceAccountName" -}} 102 {{- if .Values.cainjector.serviceAccount.create -}} 103 {{ default (include "cainjector.fullname" .) .Values.cainjector.serviceAccount.name }} 104 {{- else -}} 105 {{ default "default" .Values.cainjector.serviceAccount.name }} 106 {{- end -}} 107 {{- end -}} 108 109 {{/* 110 startupapicheck templates 111 */}} 112 113 {{/* 114 Expand the name of the chart. 115 Manually fix the 'app' and 'name' labels to 'startupapicheck' to maintain 116 compatibility with the v0.9 deployment selector. 117 */}} 118 {{- define "startupapicheck.name" -}} 119 {{- printf "startupapicheck" -}} 120 {{- end -}} 121 122 {{/* 123 Create a default fully qualified app name. 124 We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 125 If release name contains chart name it will be used as a full name. 126 */}} 127 {{- define "startupapicheck.fullname" -}} 128 {{- $trimmedName := printf "%s" (include "cert-manager.fullname" .) | trunc 52 | trimSuffix "-" -}} 129 {{- printf "%s-startupapicheck" $trimmedName | trunc 63 | trimSuffix "-" -}} 130 {{- end -}} 131 132 {{/* 133 Create the name of the service account to use 134 */}} 135 {{- define "startupapicheck.serviceAccountName" -}} 136 {{- if .Values.startupapicheck.serviceAccount.create -}} 137 {{ default (include "startupapicheck.fullname" .) .Values.startupapicheck.serviceAccount.name }} 138 {{- else -}} 139 {{ default "default" .Values.startupapicheck.serviceAccount.name }} 140 {{- end -}} 141 {{- end -}} 142 143 {{/* 144 Create chart name and version as used by the chart label. 145 */}} 146 {{- define "chartName" -}} 147 {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 148 {{- end -}} 149 150 {{/* 151 Labels that should be added on each resource 152 */}} 153 {{- define "labels" -}} 154 app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} 155 {{- if eq (default "helm" .Values.creator) "helm" }} 156 app.kubernetes.io/managed-by: {{ .Release.Service }} 157 helm.sh/chart: {{ include "chartName" . }} 158 {{- end -}} 159 {{- end -}} 160 161 {{/* 162 Namespace for all resources to be installed into 163 If not defined in values file then the helm release namespace is used 164 By default this is not set so the helm release namespace will be used 165 166 This gets around an problem within helm discussed here 167 https://github.com/helm/helm/issues/5358 168 */}} 169 {{- define "cert-manager.namespace" -}} 170 {{ .Values.namespace | default .Release.Namespace }} 171 {{- end -}}