diff --git a/charts/polkadot/templates/_helpers.tpl b/charts/polkadot/templates/_helpers.tpl index baeee8f..7b30e67 100644 --- a/charts/polkadot/templates/_helpers.tpl +++ b/charts/polkadot/templates/_helpers.tpl @@ -81,3 +81,10 @@ polkadot-custom-chainspec {{- define "polkadot-deployer.podRestarterName" -}} {{ .Release.Name }}-pod-restarter {{- end }} + +{{/* Json for private docker registry */}} +{{- define "imagePullSecret" }} +{{- with .Values.imagePullSecret.imageCredentials }} +{{- printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}}" .registry .username .password .email (printf "%s:%s" .username .password | b64enc) | b64enc }} +{{- end }} +{{- end }} diff --git a/charts/polkadot/templates/secret-docker-registry.yaml b/charts/polkadot/templates/secret-docker-registry.yaml new file mode 100644 index 0000000..1f8862a --- /dev/null +++ b/charts/polkadot/templates/secret-docker-registry.yaml @@ -0,0 +1,9 @@ +{{ if .Values.imagePullSecret }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Values.imagePullSecret.secretName | default "dockerregistrysecret" }} +type: kubernetes.io/dockerconfigjson +data: + .dockerconfigjson: {{ template "imagePullSecret" . }} +{{ end }} diff --git a/charts/polkadot/templates/statefulset.yaml b/charts/polkadot/templates/statefulset.yaml index aeed7f0..4f2351d 100644 --- a/charts/polkadot/templates/statefulset.yaml +++ b/charts/polkadot/templates/statefulset.yaml @@ -75,6 +75,10 @@ spec: subPath: custom_chainspec.json {{- end }} {{- end }} + {{- if .Values.imagePullSecret }} + imagePullSecrets: + - name: {{ .Values.imagePullSecret.secretName }} + {{- end }} containers: - name: {{ .Release.Name }} image: {{ .Values.image.repo }}:{{ .Values.image.tag }} diff --git a/charts/polkadot/values.yaml b/charts/polkadot/values.yaml index 78991e9..97f1ca9 100644 --- a/charts/polkadot/values.yaml +++ b/charts/polkadot/values.yaml @@ -84,3 +84,11 @@ serviceMonitorLabels: release: prometheus-operator inPeers: "500" + +# imagePullSecret: +# secretName: docker-registry-secret #k8s secret name +# imageCredentials: +# registry: registry.digitalocean.com #docker registry url +# username: username #registry username +# password: password #registry password +