Co-authored-by: Michael Marshall <mmarshall@apache.org> ### Motivation There was a suggestion [in a dev mailing list discussion](https://lists.apache.org/thread/bgkvcyt1qq6h67p2k8xwp89xlncbqn3d) that the Helm chart's appVersion should be used as the default image tag. ### Additional context There are some limitations in Helm. It is not possible to set "appVersion" from the command line. There's in an open feature request https://github.com/helm/helm/issues/8194 to add such a feature to Helm. ### Modifications - change default values.yaml and set the tags for the images that use the Pulsar image to an empty value - add "defaultPulsarImageTag" to values.yaml - add a helper template "pulsar.imageFullName" that contains the logic to fall back to .Values.defaultPulsarImageTag and if it's not set, falling back to .Chart.AppVersion - use the helper template in all other templates that require the logic
112 lines
2.6 KiB
Smarty
112 lines
2.6 KiB
Smarty
{{/* vim: set filetype=mustache: */}}
|
|
|
|
{{/*
|
|
pulsar home
|
|
*/}}
|
|
{{- define "pulsar.home" -}}
|
|
{{- print "/pulsar" -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Expand the name of the chart.
|
|
*/}}
|
|
{{- define "pulsar.name" -}}
|
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Expand the namespace of the chart.
|
|
*/}}
|
|
{{- define "pulsar.namespace" -}}
|
|
{{- default .Release.Namespace .Values.namespace -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
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).
|
|
If release name contains chart name it will be used as a full name.
|
|
*/}}
|
|
{{- define "pulsar.fullname" -}}
|
|
{{- if .Values.fullnameOverride -}}
|
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
|
{{- else -}}
|
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
|
{{- if contains $name .Release.Name -}}
|
|
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
|
{{- else -}}
|
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Define cluster's name
|
|
*/}}
|
|
{{- define "pulsar.cluster.name" -}}
|
|
{{- if .Values.clusterName }}
|
|
{{- .Values.clusterName }}
|
|
{{- else -}}
|
|
{{- template "pulsar.fullname" .}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create chart name and version as used by the chart label.
|
|
*/}}
|
|
{{- define "pulsar.chart" -}}
|
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Create the common labels.
|
|
*/}}
|
|
{{- define "pulsar.standardLabels" -}}
|
|
app: {{ template "pulsar.name" . }}
|
|
chart: {{ template "pulsar.chart" . }}
|
|
release: {{ .Release.Name }}
|
|
heritage: {{ .Release.Service }}
|
|
cluster: {{ template "pulsar.cluster.name" . }}
|
|
{{- if .Values.labels }}
|
|
{{ .Values.labels | toYaml | trim }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create the template labels.
|
|
*/}}
|
|
{{- define "pulsar.template.labels" -}}
|
|
app: {{ template "pulsar.name" . }}
|
|
release: {{ .Release.Name }}
|
|
cluster: {{ template "pulsar.cluster.name" . }}
|
|
{{- if .Values.labels }}
|
|
{{ .Values.labels | toYaml | trim }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create the match labels.
|
|
*/}}
|
|
{{- define "pulsar.matchLabels" -}}
|
|
app: {{ template "pulsar.name" . }}
|
|
release: {{ .Release.Name }}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create ImagePullSecrets
|
|
*/}}
|
|
{{- define "pulsar.imagePullSecrets" -}}
|
|
{{- if .Values.images.imagePullSecrets -}}
|
|
imagePullSecrets:
|
|
{{- range .Values.images.imagePullSecrets }}
|
|
- name: {{ . }}
|
|
{{- end }}
|
|
{{- end -}}
|
|
{{- end }}
|
|
|
|
{{/*
|
|
Create full image name
|
|
*/}}
|
|
{{- define "pulsar.imageFullName" -}}
|
|
{{- printf "%s:%s" .image.repository (.image.tag | default .root.Values.defaultPulsarImageTag | default .root.Chart.AppVersion) -}}
|
|
{{- end -}}
|