From 2a9d663f0ee719e08d4e9ba85cd92b534a9de7f9 Mon Sep 17 00:00:00 2001
From: Lars Seipel <ls@slrz.net>
Date: Mon, 3 Jul 2023 15:57:03 +0200
Subject: [PATCH] charts: include image pull secret template

---
 .../templates/_helpers.tpl                          | 13 +++++++++++++
 .../templates/image-pull-secret.yaml                |  9 +++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 charts/bbbatscale-support-notify/templates/image-pull-secret.yaml

diff --git a/charts/bbbatscale-support-notify/templates/_helpers.tpl b/charts/bbbatscale-support-notify/templates/_helpers.tpl
index 4b478fd..71c6be7 100644
--- a/charts/bbbatscale-support-notify/templates/_helpers.tpl
+++ b/charts/bbbatscale-support-notify/templates/_helpers.tpl
@@ -60,3 +60,16 @@ Create the name of the service account to use
 {{- default "default" .Values.serviceAccount.name }}
 {{- end }}
 {{- end }}
+
+{{- define "bbbatscale-support-notify.dockerConfig" -}}
+auths:
+  {{- $auths := .auths }}
+  {{- range (keys $auths) }}
+  {{- $auth := get $auths . }}
+  {{ quote . }}:
+    username: {{ quote $auth.username }}
+    password: {{ quote $auth.password }}
+    auth: {{ printf "%s:%s" $auth.username $auth.password | b64enc }}
+    email: {{ get $auth "email" | quote }}
+  {{- end }}
+{{- end -}}
diff --git a/charts/bbbatscale-support-notify/templates/image-pull-secret.yaml b/charts/bbbatscale-support-notify/templates/image-pull-secret.yaml
new file mode 100644
index 0000000..3b35ec3
--- /dev/null
+++ b/charts/bbbatscale-support-notify/templates/image-pull-secret.yaml
@@ -0,0 +1,9 @@
+apiVersion: v1
+kind: Secret
+metadata:
+  name: {{ include "bbbatscale-support-notify.fullname" . }}-pullsecret
+  labels:
+    {{- include "bbbatscale-support-notify.labels" . | nindent 4 }}
+type: kubernetes.io/dockerconfigjson
+data:
+  .dockerconfigjson: {{ include "bbbatscale-support-notify.dockerConfig" .Values.imagePullConfig | fromYaml | toJson | b64enc }}
-- 
GitLab