{{- if .Values.registryCred }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ .Release.Name }}-regcred
  labels:
    app.kubernetes.io/name: {{ .Values.appName }}
    app.kubernetes.io/instance: {{ .Release.Name }}
  annotations:
    "helm.sh/resource-policy": keep
type: kubernetes.io/dockerconfigjson
data:
  .dockerconfigjson: {{ printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.registryCred.registry (printf "%s:%s" .Values.registryCred.username .Values.registryCred.password | b64enc) | b64enc | quote }}
{{- end }}
