diff --git a/paperboy-helm/templates/_helpers.tpl b/paperboy-helm/templates/_helpers.tpl index d959249..7d4f85a 100644 --- a/paperboy-helm/templates/_helpers.tpl +++ b/paperboy-helm/templates/_helpers.tpl @@ -86,3 +86,16 @@ Create the name of the service account to use {{ default "default" .Values.serviceAccount.name }} {{- end -}} {{- end -}} + +{{/* +Create a prefix for the pull secret +*/}} +{{- define "paperboy.pull-secret-name" -}} +{{- include "paperboy.fullname" . }}-pull-secret +{{- end -}} + +{{- define "imagePullSecret" }} +{{- with .Values.imagePullSecret }} +{{- printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}}" .registry .username .password .email (printf "%s:%s" .username .password | b64enc) | b64enc }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/paperboy-helm/templates/paperboy-preview-push-service.deploy.yaml b/paperboy-helm/templates/paperboy-preview-push-service.deploy.yaml index aa42b5b..726e139 100644 --- a/paperboy-helm/templates/paperboy-preview-push-service.deploy.yaml +++ b/paperboy-helm/templates/paperboy-preview-push-service.deploy.yaml @@ -20,6 +20,10 @@ spec: app.kubernetes.io/name: {{ include "paperboy.previewPushService.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} spec: + {{- if .Values.imagePullSecret }} + imagePullSecrets: + - name: {{ include "papergirl.pull-secret-name" . }} + {{- end }} affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: diff --git a/paperboy-helm/templates/paperboy-push-service.deploy.yaml b/paperboy-helm/templates/paperboy-push-service.deploy.yaml index b377278..95ebfa3 100644 --- a/paperboy-helm/templates/paperboy-push-service.deploy.yaml +++ b/paperboy-helm/templates/paperboy-push-service.deploy.yaml @@ -19,6 +19,10 @@ spec: app.kubernetes.io/name: {{ include "paperboy.pushService.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} spec: + {{- if .Values.imagePullSecret }} + imagePullSecrets: + - name: {{ include "papergirl.pull-secret-name" . }} + {{- end }} affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: diff --git a/paperboy-helm/templates/pull-secret.secret.yaml b/paperboy-helm/templates/pull-secret.secret.yaml new file mode 100644 index 0000000..a830c04 --- /dev/null +++ b/paperboy-helm/templates/pull-secret.secret.yaml @@ -0,0 +1,11 @@ +{{- if .Values.imagePullSecret }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "paperboy.pull-secret-name" . }} + labels: +{{ include "paperboy.labels" . | indent 4 }} +type: kubernetes.io/dockerconfigjson +data: + .dockerconfigjson: {{ template "imagePullSecret" . }} +{{- end }} diff --git a/paperboy-helm/values.yaml b/paperboy-helm/values.yaml index a27d09c..f5ea0bd 100644 --- a/paperboy-helm/values.yaml +++ b/paperboy-helm/values.yaml @@ -21,6 +21,7 @@ nats: version: 2.1.7 nameOverride: "" fullnameOverride: "" +imagePullSecret: {} nodeSelector: {} tolerations: [] affinity: {}