From daedf8af042b939d3b0832cbc9669b0305ca263b Mon Sep 17 00:00:00 2001 From: Vojtech Mares Date: Tue, 25 Jun 2024 07:33:35 +0200 Subject: [PATCH] refactor(deploy): use external (hand-made) image pull secret --- deploy/templates/_helpers.tpl | 5 ----- deploy/templates/deployment.yaml | 4 +++- deploy/templates/image-pull-secret.yaml | 11 ----------- deploy/values.staging.yaml | 4 ++++ deploy/values.yaml | 7 +------ 5 files changed, 8 insertions(+), 23 deletions(-) delete mode 100644 deploy/templates/_helpers.tpl delete mode 100644 deploy/templates/image-pull-secret.yaml diff --git a/deploy/templates/_helpers.tpl b/deploy/templates/_helpers.tpl deleted file mode 100644 index 86678f3..0000000 --- a/deploy/templates/_helpers.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{{- define "imagePullSecret" }} -{{- with .Values.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/deploy/templates/deployment.yaml b/deploy/templates/deployment.yaml index 17b5873..e9cd028 100644 --- a/deploy/templates/deployment.yaml +++ b/deploy/templates/deployment.yaml @@ -29,8 +29,10 @@ spec: app.kubernetes.io/component: "backend-api" spec: automountServiceAccountToken: false + {{- with .Values.image.pullSecrets }} imagePullSecrets: - - name: {{ .Release.Name }}-pull-secret + {{ toYaml . | nindent 8 }} + {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" diff --git a/deploy/templates/image-pull-secret.yaml b/deploy/templates/image-pull-secret.yaml deleted file mode 100644 index cf9ee50..0000000 --- a/deploy/templates/image-pull-secret.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: {{ .Release.Name }}-pull-secret - annotations: - "helm.sh/hook": pre-install - "helm.sh/hook-weight": "-99" - "helm.sh/hook-delete-policy": before-hook-creation -type: kubernetes.io/dockerconfigjson -data: - .dockerconfigjson: {{ template "imagePullSecret" . }} diff --git a/deploy/values.staging.yaml b/deploy/values.staging.yaml index 61b13cb..2fa7bba 100644 --- a/deploy/values.staging.yaml +++ b/deploy/values.staging.yaml @@ -5,3 +5,7 @@ ingress: cert-manager.io/cluster-issuer: letsencrypt-dns-production replicas: 2 + +image: + pullSecrets: + - name: mareshq-gitlab-registry diff --git a/deploy/values.yaml b/deploy/values.yaml index 60e0dc8..d445df3 100644 --- a/deploy/values.yaml +++ b/deploy/values.yaml @@ -1,15 +1,10 @@ replicas: 1 image: + pullSecrets: [] repository: registry.mareshq.com/hq/yggdrasil/httpserver tag: latest -imageCredentials: - registry: registry.mareshq.com - email: nobody@mareshq.com - username: someone - password: sillyness - ingress: enabled: false host: example.com