Skip to content

Instantly share code, notes, and snippets.

@matthewadams
Created February 3, 2018 03:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewadams/cfd0ee138f46d206572d3c917a5d0d58 to your computer and use it in GitHub Desktop.
Save matthewadams/cfd0ee138f46d206572d3c917a5d0d58 to your computer and use it in GitHub Desktop.
.dockercfgjson Helm template
{{- define "dockercfg" -}}
{{- $hostname := required "A Docker image registry hostname is required" .Values.image.registry.auth.hostname -}}
{{- $username := required "A Docker image registry username is required" .Values.image.registry.auth.username -}}
{{- $password := required "A Docker image registry password is required" .Values.image.registry.auth.password -}}
{{- $email := required "A Docker image registry email is required" .Values.image.registry.auth.email -}}
{{- $auth := printf "%s:%s" $username $password | b64enc -}}
{{- $cfg := printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}}" $hostname $username $password $email $auth -}}
{{- $cfg | b64enc -}}
{{- end -}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment