From e9e3ee2e6a1f75c3a6fc851ac83799dcf15c8d12 Mon Sep 17 00:00:00 2001 From: Aaron Roydhouse Date: Tue, 22 May 2018 10:36:53 -0400 Subject: [PATCH] Update the 'fullname' template to match helm 2.8.2 The newer 'fullname' helper function automatically avoids name duplication. This change updates the function in cert-manager to include that functionality. Given there is generally only one cert-manager per cluster, if you install cert-manager and call it `cert-manager`: ``` helm upgrade --install cert-manager stable/cert-manager ``` You get deployments and pods called `cert-manager-cert-manager...` With the update version (taken from the `helm create` template for helm 2.8.2` you instead get deployments and pods called `cert-manager`. There is a workaround possible at the moment, but the automatic behavior is more intuitive for new users. ``` helm upgrade --install cert-manager stable/cert-manager --set=fullnameOverride=cert-manager ``` --- contrib/charts/cert-manager/templates/_helpers.tpl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/charts/cert-manager/templates/_helpers.tpl b/contrib/charts/cert-manager/templates/_helpers.tpl index 5883b323d..c411d7a5c 100644 --- a/contrib/charts/cert-manager/templates/_helpers.tpl +++ b/contrib/charts/cert-manager/templates/_helpers.tpl @@ -11,9 +11,16 @@ 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). */}} {{- define "cert-manager.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} {{- $name := default .Chart.Name .Values.nameOverride -}} -{{- $fullname := printf "%s-%s" $name .Release.Name -}} -{{- default $fullname .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} {{- end -}} {{/*