Skip to content

Commit

Permalink
fix: modify jobs.image.tag for eks
Browse files Browse the repository at this point in the history
EKS sometimes has a '+' in kubernetes minor version
This results in invalid image tag for jobs
  • Loading branch information
Tom OBrien authored and prometherion committed Jan 18, 2022
1 parent 1bbaebb commit 0b199f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/capsule/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 12 additions & 2 deletions charts/capsule/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,25 @@ 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
*/}}
{{- define "capsule.jobsFullyQualifiedDockerImage" -}}
{{- 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 }}

Expand Down

0 comments on commit 0b199f4

Please sign in to comment.