Skip to content

Commit

Permalink
feat(helm): add pull secret
Browse files Browse the repository at this point in the history
  • Loading branch information
arnediekmann committed Jul 8, 2021
1 parent f952896 commit 9d2dedc
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
13 changes: 13 additions & 0 deletions paperboy-helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions paperboy-helm/templates/paperboy-push-service.deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 11 additions & 0 deletions paperboy-helm/templates/pull-secret.secret.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
1 change: 1 addition & 0 deletions paperboy-helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ nats:
version: 2.1.7
nameOverride: ""
fullnameOverride: ""
imagePullSecret: {}
nodeSelector: {}
tolerations: []
affinity: {}

0 comments on commit 9d2dedc

Please sign in to comment.