From 0b199f413602b86924d5d3ce48975c7ff4ad252a Mon Sep 17 00:00:00 2001 From: Tom OBrien Date: Thu, 13 Jan 2022 12:52:56 +0100 Subject: [PATCH] fix: modify jobs.image.tag for eks EKS sometimes has a '+' in kubernetes minor version This results in invalid image tag for jobs --- charts/capsule/Chart.yaml | 2 +- charts/capsule/templates/_helpers.tpl | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/charts/capsule/Chart.yaml b/charts/capsule/Chart.yaml index 52e50c9d..46a1fa7c 100644 --- a/charts/capsule/Chart.yaml +++ b/charts/capsule/Chart.yaml @@ -21,7 +21,7 @@ sources: # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 0.1.5 +version: 0.1.6 # This is the version number of the application being deployed. # This version number should be incremented each time you make changes to the application. diff --git a/charts/capsule/templates/_helpers.tpl b/charts/capsule/templates/_helpers.tpl index 38b52e37..bd472c7f 100644 --- a/charts/capsule/templates/_helpers.tpl +++ b/charts/capsule/templates/_helpers.tpl @@ -91,6 +91,17 @@ Create the proxy fully-qualified Docker image to use {{- printf "%s:%s" .Values.proxy.image.repository .Values.proxy.image.tag -}} {{- end }} +{{/* +Determine the Kubernetes version to use for jobsFullyQualifiedDockerImage tag +*/}} +{{- define "capsule.jobsTagKubeVersion" -}} +{{- if contains "-eks-" .Capabilities.KubeVersion.GitVersion }} +{{- print "v" .Capabilities.KubeVersion.Major "." (.Capabilities.KubeVersion.Minor | replace "+" "") -}} +{{- else }} +{{- print "v" .Capabilities.KubeVersion.Major "." .Capabilities.KubeVersion.Minor -}} +{{- end }} +{{- end }} + {{/* Create the jobs fully-qualified Docker image to use */}} @@ -98,8 +109,7 @@ Create the jobs fully-qualified Docker image to use {{- if .Values.jobs.image.tag }} {{- printf "%s:%s" .Values.jobs.image.repository .Values.jobs.image.tag -}} {{- else }} -{{- $kubeversion := print "v" .Capabilities.KubeVersion.Major "." .Capabilities.KubeVersion.Minor -}} -{{- printf "%s:%s" .Values.jobs.image.repository $kubeversion -}} +{{- printf "%s:%s" .Values.jobs.image.repository (include "capsule.jobsTagKubeVersion" .) -}} {{- end }} {{- end }}