Skip to content

Commit 2396fc8

Browse files
author
Mike Ludwig
committed
docker login on invoker pods when using private registry
1 parent f58729b commit 2396fc8

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker login $RUNTIMES_REGISTRY -u $RUNTIMES_REGISTRY_USERNAME -p $RUNTIMES_REGISTRY_PASSWORD

helm/openwhisk/templates/_helpers.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,11 @@ imagePullSecrets:
310310
mountPath: "/invoker-scripts/configureDNS.sh"
311311
subPath: "configureDNS.sh"
312312
{{- end }}
313+
{{- if ne .Values.docker.registry.name "" }}
314+
- name: scripts-dir
315+
mountPath: "/invoker-scripts/dockerLogin.sh"
316+
subPath: "dockerLogin.sh"
317+
{{- end }}
313318
{{- end }}
314319
{{- end }}
315320

helm/openwhisk/templates/invoker-cm.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ metadata:
2424
data:
2525
{{ (.Files.Glob "configMapFiles/dockerPullRuntimes/playbook.yml").AsConfig | indent 2 }}
2626
{{ (.Files.Glob "configMapFiles/configureDNS/configureDNS.sh").AsConfig | indent 2 }}
27+
{{ (.Files.Glob "configMapFiles/dockerLogin/dockerLogin.sh").AsConfig | indent 2 }}

helm/openwhisk/templates/invoker-pod.yaml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,17 @@ spec:
8383
- name: invoker
8484
image: "{{- .Values.docker.registry.name -}}{{- .Values.invoker.imageName -}}:{{- .Values.invoker.imageTag -}}"
8585
imagePullPolicy: {{ .Values.invoker.imagePullPolicy | quote }}
86+
command:
87+
- /bin/bash
88+
- -c
89+
-
90+
{{- if ne .Values.docker.registry.name "" }}
91+
. /invoker-scripts/dockerLogin.sh &&
92+
{{- end }}
8693
{{- if and (eq .Values.invoker.containerFactory.impl "docker") .Values.invoker.containerFactory.networkConfig.dns.inheritInvokerConfig }}
87-
command: [ "/bin/bash", "-c", ". /invoker-scripts/configureDNS.sh && /init.sh --uniqueName $INVOKER_NAME" ]
88-
{{- else }}
89-
command: [ "/bin/bash", "-c", "/init.sh --uniqueName $INVOKER_NAME" ]
94+
. /invoker-scripts/configureDNS.sh &&
9095
{{- end }}
96+
/init.sh --uniqueName $INVOKER_NAME
9197
env:
9298
- name: "PORT"
9399
value: {{ .Values.invoker.port | quote }}
@@ -207,6 +213,20 @@ spec:
207213
{{- end }}
208214
- name: "CONFIG_whisk_helm_release"
209215
value: "{{ .Release.Name }}"
216+
{{- if ne .Values.docker.registry.name "" }}
217+
- name: "RUNTIMES_REGISTRY"
218+
value: "{{- .Values.docker.registry.name -}}"
219+
- name: "RUNTIMES_REGISTRY_USERNAME"
220+
valueFrom:
221+
secretKeyRef:
222+
name: {{ .Release.Name }}-docker.registry.auth
223+
key: docker_registry_username
224+
- name: "RUNTIMES_REGISTRY_PASSWORD"
225+
valueFrom:
226+
secretKeyRef:
227+
name: {{ .Release.Name }}-docker.registry.auth
228+
key: docker_registry_password
229+
{{- end }}
210230
ports:
211231
- name: invoker
212232
containerPort: {{ .Values.invoker.port }}

0 commit comments

Comments
 (0)