{{- if .Values.ghcrAuth.enabled }}
apiVersion: v1
kind: Secret
metadata:
  name: ghcr-credentials
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "stonks.labels" . | nindent 4 }}
type: kubernetes.io/dockerconfigjson
data:
  .dockerconfigjson: {{ printf `{"auths":{"%s":{"username":"%s","password":"%s","auth":"%s"}}}` .Values.ghcrAuth.registry .Values.ghcrAuth.username .Values.ghcrAuth.password (printf "%s:%s" .Values.ghcrAuth.username .Values.ghcrAuth.password | b64enc) | b64enc }}
{{- end }}
