Use appVersion as default tag for Pulsar images (#200)

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
This commit is contained in:
Lari Hotari 2022-10-17 23:42:58 +03:00 committed by GitHub
parent 6a00845670
commit 25f355e6e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 48 additions and 30 deletions

View File

@ -102,3 +102,10 @@ imagePullSecrets:
{{- end }} {{- end }}
{{- end -}} {{- 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 -}}

View File

@ -111,7 +111,7 @@ spec:
# This initContainer will wait for bookkeeper initnewcluster to complete # This initContainer will wait for bookkeeper initnewcluster to complete
# before deploying the bookies # before deploying the bookies
- name: pulsar-bookkeeper-verify-clusterid - name: pulsar-bookkeeper-verify-clusterid
image: "{{ .Values.images.autorecovery.repository }}:{{ .Values.images.autorecovery.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.autorecovery "root" .) }}"
imagePullPolicy: {{ .Values.images.autorecovery.pullPolicy }} imagePullPolicy: {{ .Values.images.autorecovery.pullPolicy }}
command: ["sh", "-c"] command: ["sh", "-c"]
args: args:
@ -124,7 +124,7 @@ spec:
{{- include "pulsar.autorecovery.certs.volumeMounts" . | nindent 8 }} {{- include "pulsar.autorecovery.certs.volumeMounts" . | nindent 8 }}
containers: containers:
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component }}" - name: "{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component }}"
image: "{{ .Values.images.autorecovery.repository }}:{{ .Values.images.autorecovery.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.autorecovery "root" .) }}"
imagePullPolicy: {{ .Values.images.autorecovery.pullPolicy }} imagePullPolicy: {{ .Values.images.autorecovery.pullPolicy }}
{{- if .Values.autorecovery.resources }} {{- if .Values.autorecovery.resources }}
resources: resources:

View File

@ -39,7 +39,7 @@ spec:
{{- end }} {{- end }}
initContainers: initContainers:
- name: wait-zookeeper-ready - name: wait-zookeeper-ready
image: "{{ .Values.images.bookie.repository }}:{{ .Values.images.bookie.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.bookie "root" .) }}"
imagePullPolicy: {{ .Values.images.bookie.pullPolicy }} imagePullPolicy: {{ .Values.images.bookie.pullPolicy }}
command: ["sh", "-c"] command: ["sh", "-c"]
args: args:
@ -55,7 +55,7 @@ spec:
{{- end}} {{- end}}
containers: containers:
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}-init" - name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}-init"
image: "{{ .Values.images.bookie.repository }}:{{ .Values.images.bookie.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.bookie "root" .) }}"
imagePullPolicy: {{ .Values.images.bookie.pullPolicy }} imagePullPolicy: {{ .Values.images.bookie.pullPolicy }}
{{- if .Values.bookkeeper.metadata.resources }} {{- if .Values.bookkeeper.metadata.resources }}
resources: resources:

View File

@ -112,7 +112,7 @@ spec:
# This initContainer will wait for bookkeeper initnewcluster to complete # This initContainer will wait for bookkeeper initnewcluster to complete
# before deploying the bookies # before deploying the bookies
- name: pulsar-bookkeeper-verify-clusterid - name: pulsar-bookkeeper-verify-clusterid
image: "{{ .Values.images.bookie.repository }}:{{ .Values.images.bookie.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.bookie "root" .) }}"
imagePullPolicy: {{ .Values.images.bookie.pullPolicy }} imagePullPolicy: {{ .Values.images.bookie.pullPolicy }}
command: ["sh", "-c"] command: ["sh", "-c"]
args: args:
@ -130,7 +130,7 @@ spec:
{{- include "pulsar.bookkeeper.certs.volumeMounts" . | nindent 8 }} {{- include "pulsar.bookkeeper.certs.volumeMounts" . | nindent 8 }}
containers: containers:
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}" - name: "{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}"
image: "{{ .Values.images.bookie.repository }}:{{ .Values.images.bookie.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.bookie "root" .) }}"
imagePullPolicy: {{ .Values.images.bookie.pullPolicy }} imagePullPolicy: {{ .Values.images.bookie.pullPolicy }}
{{- if .Values.bookkeeper.probe.liveness.enabled }} {{- if .Values.bookkeeper.probe.liveness.enabled }}
livenessProbe: livenessProbe:

View File

@ -58,7 +58,7 @@ data:
# support version >= 2.5.0 # support version >= 2.5.0
PF_functionRuntimeFactoryConfigs_pulsarRootDir: {{ template "pulsar.home" . }} PF_functionRuntimeFactoryConfigs_pulsarRootDir: {{ template "pulsar.home" . }}
PF_kubernetesContainerFactory_pulsarRootDir: {{ template "pulsar.home" . }} PF_kubernetesContainerFactory_pulsarRootDir: {{ template "pulsar.home" . }}
PF_functionRuntimeFactoryConfigs_pulsarDockerImageName: "{{ .Values.images.functions.repository }}:{{ .Values.images.functions.tag }}" PF_functionRuntimeFactoryConfigs_pulsarDockerImageName: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.functions "root" .) }}"
PF_functionRuntimeFactoryConfigs_submittingInsidePod: "true" PF_functionRuntimeFactoryConfigs_submittingInsidePod: "true"
PF_functionRuntimeFactoryConfigs_installUserCodeDependencies: "true" PF_functionRuntimeFactoryConfigs_installUserCodeDependencies: "true"
PF_functionRuntimeFactoryConfigs_jobNamespace: {{ template "pulsar.namespace" . }} PF_functionRuntimeFactoryConfigs_jobNamespace: {{ template "pulsar.namespace" . }}
@ -74,7 +74,7 @@ data:
PF_functionRuntimeFactoryConfigs_changeConfigMap: "{{ template "pulsar.fullname" . }}-{{ .Values.functions.component }}-config" PF_functionRuntimeFactoryConfigs_changeConfigMap: "{{ template "pulsar.fullname" . }}-{{ .Values.functions.component }}-config"
PF_functionRuntimeFactoryConfigs_changeConfigMapNamespace: {{ template "pulsar.namespace" . }} PF_functionRuntimeFactoryConfigs_changeConfigMapNamespace: {{ template "pulsar.namespace" . }}
# support version < 2.5.0 # support version < 2.5.0
PF_kubernetesContainerFactory_pulsarDockerImageName: "{{ .Values.images.functions.repository }}:{{ .Values.images.functions.tag }}" PF_kubernetesContainerFactory_pulsarDockerImageName: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.functions "root" .) }}"
PF_kubernetesContainerFactory_submittingInsidePod: "true" PF_kubernetesContainerFactory_submittingInsidePod: "true"
PF_kubernetesContainerFactory_installUserCodeDependencies: "true" PF_kubernetesContainerFactory_installUserCodeDependencies: "true"
PF_kubernetesContainerFactory_jobNamespace: {{ template "pulsar.namespace" . }} PF_kubernetesContainerFactory_jobNamespace: {{ template "pulsar.namespace" . }}

View File

@ -106,7 +106,7 @@ spec:
# This init container will wait for zookeeper to be ready before # This init container will wait for zookeeper to be ready before
# deploying the bookies # deploying the bookies
- name: wait-zookeeper-ready - name: wait-zookeeper-ready
image: "{{ .Values.images.broker.repository }}:{{ .Values.images.broker.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.broker "root" .) }}"
imagePullPolicy: {{ .Values.images.broker.pullPolicy }} imagePullPolicy: {{ .Values.images.broker.pullPolicy }}
command: ["sh", "-c"] command: ["sh", "-c"]
args: args:
@ -129,7 +129,7 @@ spec:
# This init container will wait for bookkeeper to be ready before # This init container will wait for bookkeeper to be ready before
# deploying the broker # deploying the broker
- name: wait-bookkeeper-ready - name: wait-bookkeeper-ready
image: "{{ .Values.images.broker.repository }}:{{ .Values.images.broker.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.broker "root" .) }}"
imagePullPolicy: {{ .Values.images.broker.pullPolicy }} imagePullPolicy: {{ .Values.images.broker.pullPolicy }}
command: ["sh", "-c"] command: ["sh", "-c"]
args: args:
@ -159,7 +159,7 @@ spec:
{{- include "pulsar.broker.certs.volumeMounts" . | nindent 10 }} {{- include "pulsar.broker.certs.volumeMounts" . | nindent 10 }}
containers: containers:
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}" - name: "{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}"
image: "{{ .Values.images.broker.repository }}:{{ .Values.images.broker.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.broker "root" .) }}"
imagePullPolicy: {{ .Values.images.broker.pullPolicy }} imagePullPolicy: {{ .Values.images.broker.pullPolicy }}
{{- if .Values.broker.probe.liveness.enabled }} {{- if .Values.broker.probe.liveness.enabled }}
livenessProbe: livenessProbe:

View File

@ -28,5 +28,5 @@ metadata:
{{- include "pulsar.standardLabels" . | nindent 4 }} {{- include "pulsar.standardLabels" . | nindent 4 }}
component: {{ .Values.functions.component }} component: {{ .Values.functions.component }}
data: data:
pulsarDockerImageName: "{{ .Values.images.functions.repository }}:{{ .Values.images.functions.tag }}" pulsarDockerImageName: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.functions "root" .) }}"
{{- end }} {{- end }}

View File

@ -108,7 +108,7 @@ spec:
# This init container will wait for zookeeper to be ready before # This init container will wait for zookeeper to be ready before
# deploying the bookies # deploying the bookies
- name: wait-zookeeper-ready - name: wait-zookeeper-ready
image: "{{ .Values.images.proxy.repository }}:{{ .Values.images.proxy.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.proxy "root" .) }}"
imagePullPolicy: {{ .Values.images.proxy.pullPolicy }} imagePullPolicy: {{ .Values.images.proxy.pullPolicy }}
command: ["sh", "-c"] command: ["sh", "-c"]
args: args:
@ -125,7 +125,7 @@ spec:
# This init container will wait for at least one broker to be ready before # This init container will wait for at least one broker to be ready before
# deploying the proxy # deploying the proxy
- name: wait-broker-ready - name: wait-broker-ready
image: "{{ .Values.images.proxy.repository }}:{{ .Values.images.proxy.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.proxy "root" .) }}"
imagePullPolicy: {{ .Values.images.proxy.pullPolicy }} imagePullPolicy: {{ .Values.images.proxy.pullPolicy }}
command: ["sh", "-c"] command: ["sh", "-c"]
args: args:
@ -139,7 +139,7 @@ spec:
done; done;
containers: containers:
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}" - name: "{{ template "pulsar.fullname" . }}-{{ .Values.proxy.component }}"
image: "{{ .Values.images.proxy.repository }}:{{ .Values.images.proxy.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.proxy "root" .) }}"
imagePullPolicy: {{ .Values.images.proxy.pullPolicy }} imagePullPolicy: {{ .Values.images.proxy.pullPolicy }}
{{- if .Values.proxy.probe.liveness.enabled }} {{- if .Values.proxy.probe.liveness.enabled }}
livenessProbe: livenessProbe:

View File

@ -38,7 +38,7 @@ spec:
initContainers: initContainers:
{{- if .Values.pulsar_metadata.configurationStore }} {{- if .Values.pulsar_metadata.configurationStore }}
- name: wait-cs-ready - name: wait-cs-ready
image: "{{ .Values.pulsar_metadata.image.repository }}:{{ .Values.pulsar_metadata.image.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.pulsar_metadata.image "root" .) }}"
imagePullPolicy: {{ .Values.pulsar_metadata.image.pullPolicy }} imagePullPolicy: {{ .Values.pulsar_metadata.image.pullPolicy }}
command: ["sh", "-c"] command: ["sh", "-c"]
args: args:
@ -49,7 +49,7 @@ spec:
{{- end }} {{- end }}
- name: wait-zookeeper-ready - name: wait-zookeeper-ready
image: "{{ .Values.pulsar_metadata.image.repository }}:{{ .Values.pulsar_metadata.image.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.pulsar_metadata.image "root" .) }}"
imagePullPolicy: {{ .Values.pulsar_metadata.image.pullPolicy }} imagePullPolicy: {{ .Values.pulsar_metadata.image.pullPolicy }}
command: ["sh", "-c"] command: ["sh", "-c"]
args: args:
@ -66,7 +66,7 @@ spec:
# This initContainer will wait for bookkeeper initnewcluster to complete # This initContainer will wait for bookkeeper initnewcluster to complete
# before initializing pulsar metadata # before initializing pulsar metadata
- name: pulsar-bookkeeper-verify-clusterid - name: pulsar-bookkeeper-verify-clusterid
image: "{{ .Values.pulsar_metadata.image.repository }}:{{ .Values.pulsar_metadata.image.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.pulsar_metadata.image "root" .) }}"
imagePullPolicy: {{ .Values.pulsar_metadata.image.pullPolicy }} imagePullPolicy: {{ .Values.pulsar_metadata.image.pullPolicy }}
command: ["sh", "-c"] command: ["sh", "-c"]
args: args:
@ -83,7 +83,7 @@ spec:
{{- include "pulsar.toolset.certs.volumeMounts" . | nindent 8 }} {{- include "pulsar.toolset.certs.volumeMounts" . | nindent 8 }}
containers: containers:
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_metadata.component }}" - name: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_metadata.component }}"
image: "{{ .Values.pulsar_metadata.image.repository }}:{{ .Values.pulsar_metadata.image.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.pulsar_metadata.image "root" .) }}"
imagePullPolicy: {{ .Values.pulsar_metadata.image.pullPolicy }} imagePullPolicy: {{ .Values.pulsar_metadata.image.pullPolicy }}
{{- if .Values.pulsar_metadata.resources }} {{- if .Values.pulsar_metadata.resources }}
resources: resources:

View File

@ -61,7 +61,7 @@ spec:
{{- end}} {{- end}}
containers: containers:
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}" - name: "{{ template "pulsar.fullname" . }}-{{ .Values.toolset.component }}"
image: "{{ .Values.images.broker.repository }}:{{ .Values.images.broker.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.broker "root" .) }}"
imagePullPolicy: {{ .Values.images.broker.pullPolicy }} imagePullPolicy: {{ .Values.images.broker.pullPolicy }}
{{- if .Values.toolset.resources }} {{- if .Values.toolset.resources }}
resources: resources:

View File

@ -107,7 +107,7 @@ spec:
{{- end }} {{- end }}
containers: containers:
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}" - name: "{{ template "pulsar.fullname" . }}-{{ .Values.zookeeper.component }}"
image: "{{ .Values.images.zookeeper.repository }}:{{ .Values.images.zookeeper.tag }}" image: "{{ template "pulsar.imageFullName" (dict "image" .Values.images.zookeeper "root" .) }}"
imagePullPolicy: {{ .Values.images.zookeeper.pullPolicy }} imagePullPolicy: {{ .Values.images.zookeeper.pullPolicy }}
{{- if .Values.zookeeper.resources }} {{- if .Values.zookeeper.resources }}
resources: resources:

View File

@ -157,33 +157,43 @@ extra:
# Configure Kubernetes runtime for Functions # Configure Kubernetes runtime for Functions
functionsAsPods: false functionsAsPods: false
# default image tag for pulsar images
# uses chart's appVersion when unspecified
defaultPulsarImageTag:
## Images ## Images
## ##
## Control what images to use for each component ## Control what images to use for each component
images: images:
zookeeper: zookeeper:
repository: apachepulsar/pulsar-all repository: apachepulsar/pulsar-all
tag: 2.9.3 # uses defaultPulsarImageTag when unspecified
tag:
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
bookie: bookie:
repository: apachepulsar/pulsar-all repository: apachepulsar/pulsar-all
tag: 2.9.3 # uses defaultPulsarImageTag when unspecified
tag:
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
autorecovery: autorecovery:
repository: apachepulsar/pulsar-all repository: apachepulsar/pulsar-all
tag: 2.9.3 # uses defaultPulsarImageTag when unspecified
tag:
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
broker: broker:
repository: apachepulsar/pulsar-all repository: apachepulsar/pulsar-all
tag: 2.9.3 # uses defaultPulsarImageTag when unspecified
tag:
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
proxy: proxy:
repository: apachepulsar/pulsar-all repository: apachepulsar/pulsar-all
tag: 2.9.3 # uses defaultPulsarImageTag when unspecified
tag:
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
functions: functions:
repository: apachepulsar/pulsar-all repository: apachepulsar/pulsar-all
tag: 2.9.3 # uses defaultPulsarImageTag when unspecified
tag:
prometheus: prometheus:
repository: prom/prometheus repository: prom/prometheus
tag: v2.17.2 tag: v2.17.2
@ -652,7 +662,8 @@ pulsar_metadata:
image: image:
# the image used for running `pulsar-cluster-initialize` job # the image used for running `pulsar-cluster-initialize` job
repository: apachepulsar/pulsar-all repository: apachepulsar/pulsar-all
tag: 2.9.3 # uses defaultPulsarImageTag when unspecified
tag:
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
## set an existing configuration store ## set an existing configuration store
# configurationStore: # configurationStore: