From a2db17d3be133cbf04004a8c6ff878ba9e818f97 Mon Sep 17 00:00:00 2001 From: Mihail Radkov Date: Thu, 26 Oct 2023 14:39:55 +0300 Subject: [PATCH] GDB-7983: Use Chart.AppVersion by default Templates will now use `Chart.AppVersion` by default unless `images.graphdb.tag` is specified --- CHANGELOG.md | 1 + templates/_helpers.yaml | 22 +++++++++---------- templates/graphdb-cluster-proxy.yaml | 2 +- templates/graphdb-node.yaml | 4 ++-- templates/jobs/patch-cluster-job.yaml | 2 +- templates/jobs/post-start-job.yaml | 2 +- .../jobs/provision-repositories-job.yaml | 2 +- templates/jobs/scale-down-cluster-job.yaml | 2 +- templates/jobs/scale-up-cluster-job.yaml | 2 +- values.yaml | 4 +++- 10 files changed, 23 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19f0a013..856a1c7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Updated the default ingress's path type to `ImplementationSpecific` - Updated graphdb.properties example file +- Templates will now use `Chart.AppVersion` by default unless `images.graphdb.tag` is specified. ## Version 10.4.1 diff --git a/templates/_helpers.yaml b/templates/_helpers.yaml index 175f0e20..38d4c09f 100644 --- a/templates/_helpers.yaml +++ b/templates/_helpers.yaml @@ -38,18 +38,18 @@ Otherwise it is left blank and cluster default will be used. {{- end }} {{/* -Renders full name of the graphdb pod +Render the container image for GraphDB */}} -{{- define "graphdb.renderFullImageName" -}} - {{- $fullImageName := .image.repository -}} - - {{- if or .globalRegistry .image.registry -}} - {{- $fullImageName = printf "%s/%s" ( .image.registry | default .globalRegistry) .image.repository -}} +{{- define "graphdb.image" -}} + {{- $registry := .Values.images.graphdb.registry -}} + {{- $repository := .Values.images.graphdb.repository -}} + {{- $tag := .Values.images.graphdb.tag | default .Chart.AppVersion | toString -}} + {{- if and .Values.global .Values.global.imageRegistry -}} + {{- $registry = .Values.global.imageRegistry -}} {{- end -}} - - {{- if .image.tag -}} - {{- printf "%s:%s" $fullImageName .image.tag -}} + {{- if $registry -}} + {{- printf "%s/%s:%s" $registry $repository $tag -}} {{- else -}} - {{- print $fullImageName -}} + {{- printf "%s:%s" $repository $tag -}} {{- end -}} -{{- end -}} +{{- end }} diff --git a/templates/graphdb-cluster-proxy.yaml b/templates/graphdb-cluster-proxy.yaml index 4a90dd8b..51188a51 100644 --- a/templates/graphdb-cluster-proxy.yaml +++ b/templates/graphdb-cluster-proxy.yaml @@ -64,7 +64,7 @@ spec: {{- include "graphdb.combinedImagePullSecrets" $ | nindent 8 }} containers: - name: graphdb-proxy - image: {{ include "graphdb.renderFullImageName" (dict "globalRegistry" $.Values.global.imageRegistry "image" $.Values.images.graphdb) }} + image: {{ include "graphdb.image" . }} imagePullPolicy: {{ $.Values.deployment.imagePullPolicy }} command: ["/opt/graphdb/dist/bin/cluster-proxy"] envFrom: diff --git a/templates/graphdb-node.yaml b/templates/graphdb-node.yaml index 48fdd80a..a5ba646a 100644 --- a/templates/graphdb-node.yaml +++ b/templates/graphdb-node.yaml @@ -95,7 +95,7 @@ spec: {{- include "graphdb.combinedImagePullSecrets" $ | nindent 8 }} containers: - name: graphdb-node - image: {{ include "graphdb.renderFullImageName" (dict "globalRegistry" $.Values.global.imageRegistry "image" $.Values.images.graphdb) }} + image: {{ include "graphdb.image" . }} imagePullPolicy: {{ $.Values.deployment.imagePullPolicy }} {{- with .Values.graphdb.node.command }} command: {{ toYaml . | nindent 12 }} @@ -154,7 +154,7 @@ spec: initContainers: # PROVISION SETTINGS AND SECURITY - name: provision-settings - image: {{ include "graphdb.renderFullImageName" (dict "globalRegistry" $.Values.global.imageRegistry "image" $.Values.images.busybox) }} + image: {{ include "graphdb.image" . }} imagePullPolicy: {{ $.Values.deployment.imagePullPolicy }} volumeMounts: {{- if hasKey $.Values.graphdb.node.persistence "volumeClaimTemplateSpec" }} diff --git a/templates/jobs/patch-cluster-job.yaml b/templates/jobs/patch-cluster-job.yaml index f6da030c..1a1dce9e 100644 --- a/templates/jobs/patch-cluster-job.yaml +++ b/templates/jobs/patch-cluster-job.yaml @@ -21,7 +21,7 @@ spec: {{- $.Values.graphdb.jobPodSecurityContext | toYaml | nindent 8 }} containers: - name: patch-cluster - image: {{ include "graphdb.renderFullImageName" (dict "globalRegistry" $.Values.global.imageRegistry "image" $.Values.images.graphdb) }} + image: {{ include "graphdb.image" . }} envFrom: - secretRef: name: graphdb-provision-user diff --git a/templates/jobs/post-start-job.yaml b/templates/jobs/post-start-job.yaml index 5a3f6017..6bbc4d2a 100644 --- a/templates/jobs/post-start-job.yaml +++ b/templates/jobs/post-start-job.yaml @@ -21,7 +21,7 @@ spec: {{- $.Values.graphdb.jobPodSecurityContext | toYaml | nindent 8 }} containers: - name: create-graphdb-cluster - image: {{ include "graphdb.renderFullImageName" (dict "globalRegistry" $.Values.global.imageRegistry "image" $.Values.images.graphdb) }} + image: {{ include "graphdb.image" . }} envFrom: - secretRef: name: graphdb-provision-user diff --git a/templates/jobs/provision-repositories-job.yaml b/templates/jobs/provision-repositories-job.yaml index c019e0e4..ed7cfc69 100644 --- a/templates/jobs/provision-repositories-job.yaml +++ b/templates/jobs/provision-repositories-job.yaml @@ -22,7 +22,7 @@ spec: {{- $.Values.graphdb.jobPodSecurityContext | toYaml | nindent 8 }} containers: - name: provision-repositories - image: {{ include "graphdb.renderFullImageName" (dict "globalRegistry" $.Values.global.imageRegistry "image" $.Values.images.graphdb) }} + image: {{ include "graphdb.image" . }} envFrom: - secretRef: name: graphdb-provision-user diff --git a/templates/jobs/scale-down-cluster-job.yaml b/templates/jobs/scale-down-cluster-job.yaml index bf3d1fac..f7fe85b7 100644 --- a/templates/jobs/scale-down-cluster-job.yaml +++ b/templates/jobs/scale-down-cluster-job.yaml @@ -19,7 +19,7 @@ spec: {{- $.Values.graphdb.jobPodSecurityContext | toYaml | nindent 8 }} containers: - name: scale-down-cluster - image: {{ include "graphdb.renderFullImageName" (dict "globalRegistry" $.Values.global.imageRegistry "image" $.Values.images.graphdb) }} + image: {{ include "graphdb.image" . }} envFrom: - secretRef: name: graphdb-provision-user diff --git a/templates/jobs/scale-up-cluster-job.yaml b/templates/jobs/scale-up-cluster-job.yaml index 77141068..76d4aab3 100644 --- a/templates/jobs/scale-up-cluster-job.yaml +++ b/templates/jobs/scale-up-cluster-job.yaml @@ -21,7 +21,7 @@ spec: {{- $.Values.graphdb.jobPodSecurityContext | toYaml | nindent 8 }} containers: - name: scale-up-cluster - image: {{ include "graphdb.renderFullImageName" (dict "globalRegistry" $.Values.global.imageRegistry "image" $.Values.images.graphdb) }} + image: {{ include "graphdb.image" . }} envFrom: - secretRef: name: graphdb-provision-user diff --git a/values.yaml b/values.yaml index c006ecec..e0ac5e51 100644 --- a/values.yaml +++ b/values.yaml @@ -13,8 +13,10 @@ global: # Top lvl flat for easier maintenance images: graphdb: + registry: docker.io repository: ontotext/graphdb - tag: "10.5.1" + # If specified, overrides Chart.AppVersion + tag: "" busybox: repository: busybox tag: "1.31"