Skip to content

Commit 7992b5d

Browse files
authored
feat(argo-workflows): Add helper function to determine image value, minus tag (argoproj#1754)
We have a situation where we want to exclude the registry so that images can be pulled from in-network mirrors. Currently when you exclude the registry, you get stuck with a prefixing forward slash. Had to keep the tags in the manifest files because helm template requires a colon in the image value. Otherwise I'd move it into the helper function. image entries changed: server, controller, executor Signed-off-by: jmeridth <[email protected]> Signed-off-by: jmeridth <[email protected]>
1 parent 45861fa commit 7992b5d

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

charts/argo-workflows/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ appVersion: v3.4.4
33
name: argo-workflows
44
description: A Helm chart for Argo Workflows
55
type: application
6-
version: 0.22.7
6+
version: 0.22.8
77
icon: https://raw.githubusercontent.com/argoproj/argo-workflows/master/docs/assets/argo.png
88
home: https://github.com/argoproj/argo-helm
99
sources:
@@ -13,4 +13,4 @@ maintainers:
1313
url: https://argoproj.github.io/
1414
annotations:
1515
artifacthub.io/changes: |
16-
- "[Added]: Support podGCDeleteDelayDuration and podGCGracePeriodSeconds"
16+
- "[Added]: Helm helper function to allow image registry to be absent"

charts/argo-workflows/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,14 @@ Return the default Argo Workflows app version
142142
{{- define "argo-workflows.defaultTag" -}}
143143
{{- default .Chart.AppVersion .Values.images.tag }}
144144
{{- end -}}
145+
146+
{{/*
147+
Return full image name including or excluding registry based on existence
148+
*/}}
149+
{{- define "argo-workflows.image" -}}
150+
{{- if and .image.registry .image.repository -}}
151+
{{ .image.registry }}/{{ .image.repository }}
152+
{{- else -}}
153+
{{ .image.repository }}
154+
{{- end -}}
155+
{{- end -}}

charts/argo-workflows/templates/controller/workflow-controller-deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ spec:
3434
{{- end }}
3535
containers:
3636
- name: controller
37-
image: "{{ .Values.controller.image.registry }}/{{ .Values.controller.image.repository }}:{{ default (include "argo-workflows.defaultTag" .) .Values.controller.image.tag }}"
37+
image: "{{- include "argo-workflows.image" (dict "context" . "image" .Values.controller.image) }}:{{ default (include "argo-workflows.defaultTag" .) .Values.controller.image.tag }}"
3838
imagePullPolicy: {{ .Values.images.pullPolicy }}
3939
command: [ "workflow-controller" ]
4040
args:
4141
- "--configmap"
4242
- "{{ template "argo-workflows.controller.fullname" . }}-configmap"
4343
- "--executor-image"
44-
- "{{ .Values.executor.image.registry }}/{{ .Values.executor.image.repository }}:{{ default (include "argo-workflows.defaultTag" .) .Values.executor.image.tag }}"
44+
- "{{- include "argo-workflows.image" (dict "context" . "image" .Values.executor.image) }}:{{ default (include "argo-workflows.defaultTag" .) .Values.executor.image.tag }}"
4545
- "--loglevel"
4646
- "{{ .Values.controller.logging.level }}"
4747
- "--gloglevel"

charts/argo-workflows/templates/server/server-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ spec:
3535
{{- end }}
3636
containers:
3737
- name: argo-server
38-
image: "{{ .Values.server.image.registry }}/{{ .Values.server.image.repository }}:{{ default (include "argo-workflows.defaultTag" .) .Values.server.image.tag }}"
38+
image: "{{- include "argo-workflows.image" (dict "context" . "image" .Values.server.image) }}:{{ default (include "argo-workflows.defaultTag" .) .Values.server.image.tag }}"
3939
imagePullPolicy: {{ .Values.images.pullPolicy }}
4040
securityContext:
4141
{{- toYaml .Values.server.securityContext | nindent 12 }}

0 commit comments

Comments
 (0)