Skip to content

Commit

Permalink
docker login on invoker pods when using private registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Ludwig committed Oct 21, 2020
1 parent f58729b commit 2396fc8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions helm/openwhisk/configMapFiles/dockerLogin/dockerLogin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker login $RUNTIMES_REGISTRY -u $RUNTIMES_REGISTRY_USERNAME -p $RUNTIMES_REGISTRY_PASSWORD
5 changes: 5 additions & 0 deletions helm/openwhisk/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ imagePullSecrets:
mountPath: "/invoker-scripts/configureDNS.sh"
subPath: "configureDNS.sh"
{{- end }}
{{- if ne .Values.docker.registry.name "" }}
- name: scripts-dir
mountPath: "/invoker-scripts/dockerLogin.sh"
subPath: "dockerLogin.sh"
{{- end }}
{{- end }}
{{- end }}

Expand Down
1 change: 1 addition & 0 deletions helm/openwhisk/templates/invoker-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ metadata:
data:
{{ (.Files.Glob "configMapFiles/dockerPullRuntimes/playbook.yml").AsConfig | indent 2 }}
{{ (.Files.Glob "configMapFiles/configureDNS/configureDNS.sh").AsConfig | indent 2 }}
{{ (.Files.Glob "configMapFiles/dockerLogin/dockerLogin.sh").AsConfig | indent 2 }}
26 changes: 23 additions & 3 deletions helm/openwhisk/templates/invoker-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,17 @@ spec:
- name: invoker
image: "{{- .Values.docker.registry.name -}}{{- .Values.invoker.imageName -}}:{{- .Values.invoker.imageTag -}}"
imagePullPolicy: {{ .Values.invoker.imagePullPolicy | quote }}
command:
- /bin/bash
- -c
-
{{- if ne .Values.docker.registry.name "" }}
. /invoker-scripts/dockerLogin.sh &&
{{- end }}
{{- if and (eq .Values.invoker.containerFactory.impl "docker") .Values.invoker.containerFactory.networkConfig.dns.inheritInvokerConfig }}
command: [ "/bin/bash", "-c", ". /invoker-scripts/configureDNS.sh && /init.sh --uniqueName $INVOKER_NAME" ]
{{- else }}
command: [ "/bin/bash", "-c", "/init.sh --uniqueName $INVOKER_NAME" ]
. /invoker-scripts/configureDNS.sh &&
{{- end }}
/init.sh --uniqueName $INVOKER_NAME
env:
- name: "PORT"
value: {{ .Values.invoker.port | quote }}
Expand Down Expand Up @@ -207,6 +213,20 @@ spec:
{{- end }}
- name: "CONFIG_whisk_helm_release"
value: "{{ .Release.Name }}"
{{- if ne .Values.docker.registry.name "" }}
- name: "RUNTIMES_REGISTRY"
value: "{{- .Values.docker.registry.name -}}"
- name: "RUNTIMES_REGISTRY_USERNAME"
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-docker.registry.auth
key: docker_registry_username
- name: "RUNTIMES_REGISTRY_PASSWORD"
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-docker.registry.auth
key: docker_registry_password
{{- end }}
ports:
- name: invoker
containerPort: {{ .Values.invoker.port }}
Expand Down

0 comments on commit 2396fc8

Please sign in to comment.