From 19d6ce648845c7a23507146dc6d86074f72134df Mon Sep 17 00:00:00 2001 From: Thomas O'Neill Date: Fri, 20 Aug 2021 20:22:50 -0400 Subject: [PATCH] Add Support for imagePullSecrets (#140) Fixes #125 ### Motivation The default images in the values.yaml are in docker hub. This PR allows us to provide image pull secrets for the containers which will allow us to get around Docker Hub's rate limiting if the nodes are not logged into Docker Hub. ### Modifications Added a new template to generate `imagePullSecrets`, and included them in the deployments and statefulsets. This will only add them if they are specified under `images.imagePullSecrets` ### Verifying this change - [] Make sure that the change passes the CI checks. --- charts/pulsar/templates/_helpers.tpl | 12 ++++++++++++ .../pulsar/templates/autorecovery-statefulset.yaml | 1 + charts/pulsar/templates/bookkeeper-statefulset.yaml | 1 + charts/pulsar/templates/broker-statefulset.yaml | 1 + charts/pulsar/templates/grafana-deployment.yaml | 1 + charts/pulsar/templates/prometheus-deployment.yaml | 1 + charts/pulsar/templates/proxy-statefulset.yaml | 1 + .../pulsar/templates/pulsar-manager-deployment.yaml | 1 + charts/pulsar/templates/toolset-statefulset.yaml | 1 + 9 files changed, 20 insertions(+) diff --git a/charts/pulsar/templates/_helpers.tpl b/charts/pulsar/templates/_helpers.tpl index ebc0409..0ad71f9 100644 --- a/charts/pulsar/templates/_helpers.tpl +++ b/charts/pulsar/templates/_helpers.tpl @@ -84,3 +84,15 @@ Create the match labels. app: {{ template "pulsar.name" . }} release: {{ .Release.Name }} {{- end }} + +{{/* +Create ImagePullSecrets +*/}} +{{- define "pulsar.imagePullSecrets" -}} +{{- if .Values.images.imagePullSecrets -}} +imagePullSecrets: +{{- range .Values.images.imagePullSecrets }} +- name: {{ . }} +{{- end }} +{{- end -}} +{{- end }} diff --git a/charts/pulsar/templates/autorecovery-statefulset.yaml b/charts/pulsar/templates/autorecovery-statefulset.yaml index 0d942b0..3f90a05 100644 --- a/charts/pulsar/templates/autorecovery-statefulset.yaml +++ b/charts/pulsar/templates/autorecovery-statefulset.yaml @@ -150,5 +150,6 @@ spec: {{- include "pulsar.autorecovery.certs.volumeMounts" . | nindent 8 }} volumes: {{- include "pulsar.autorecovery.certs.volumes" . | nindent 6 }} + {{- include "pulsar.imagePullSecrets" . | nindent 6}} {{- end }} diff --git a/charts/pulsar/templates/bookkeeper-statefulset.yaml b/charts/pulsar/templates/bookkeeper-statefulset.yaml index e05f9f1..e364cd9 100644 --- a/charts/pulsar/templates/bookkeeper-statefulset.yaml +++ b/charts/pulsar/templates/bookkeeper-statefulset.yaml @@ -196,6 +196,7 @@ spec: emptyDir: {} {{- end }} {{- include "pulsar.bookkeeper.certs.volumes" . | nindent 6 }} + {{- include "pulsar.imagePullSecrets" . | nindent 6}} {{- if and (and .Values.persistence .Values.volumes.persistence) .Values.bookkeeper.volumes.persistence}} volumeClaimTemplates: {{- if .Values.bookkeeper.volumes.useSingleCommonVolume }} diff --git a/charts/pulsar/templates/broker-statefulset.yaml b/charts/pulsar/templates/broker-statefulset.yaml index c85e747..7785d06 100644 --- a/charts/pulsar/templates/broker-statefulset.yaml +++ b/charts/pulsar/templates/broker-statefulset.yaml @@ -268,4 +268,5 @@ spec: {{- end}} {{- end}} {{- include "pulsar.broker.certs.volumes" . | nindent 6 }} + {{- include "pulsar.imagePullSecrets" . | nindent 6}} {{- end }} diff --git a/charts/pulsar/templates/grafana-deployment.yaml b/charts/pulsar/templates/grafana-deployment.yaml index d2c4e49..86787d9 100644 --- a/charts/pulsar/templates/grafana-deployment.yaml +++ b/charts/pulsar/templates/grafana-deployment.yaml @@ -87,4 +87,5 @@ spec: secretKeyRef: name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}-secret" key: GRAFANA_ADMIN_PASSWORD + {{- include "pulsar.imagePullSecrets" . | nindent 6}} {{- end }} diff --git a/charts/pulsar/templates/prometheus-deployment.yaml b/charts/pulsar/templates/prometheus-deployment.yaml index abd8bc4..f294b2a 100644 --- a/charts/pulsar/templates/prometheus-deployment.yaml +++ b/charts/pulsar/templates/prometheus-deployment.yaml @@ -93,4 +93,5 @@ spec: persistentVolumeClaim: claimName: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}" {{- end }} + {{- include "pulsar.imagePullSecrets" . | nindent 6}} {{- end }} diff --git a/charts/pulsar/templates/proxy-statefulset.yaml b/charts/pulsar/templates/proxy-statefulset.yaml index 6a02bf5..8b92c4f 100644 --- a/charts/pulsar/templates/proxy-statefulset.yaml +++ b/charts/pulsar/templates/proxy-statefulset.yaml @@ -222,6 +222,7 @@ spec: readOnly: true {{- end}} {{- end}} + {{- include "pulsar.imagePullSecrets" . | nindent 6}} {{- if or .Values.auth.authentication.enabled (and .Values.tls.enabled .Values.tls.proxy.enabled) }} volumes: {{- if .Values.auth.authentication.enabled }} diff --git a/charts/pulsar/templates/pulsar-manager-deployment.yaml b/charts/pulsar/templates/pulsar-manager-deployment.yaml index f7f10c0..7dead79 100644 --- a/charts/pulsar/templates/pulsar-manager-deployment.yaml +++ b/charts/pulsar/templates/pulsar-manager-deployment.yaml @@ -89,6 +89,7 @@ spec: {{- else }} name: "{{ template "pulsar.fullname" . }}-{{ .Values.pulsar_manager.component }}-secret" {{- end }} + {{- include "pulsar.imagePullSecrets" . | nindent 6}} volumes: - name: pulsar-manager-data emptyDir: {} diff --git a/charts/pulsar/templates/toolset-statefulset.yaml b/charts/pulsar/templates/toolset-statefulset.yaml index e2fc4c4..7dfc3eb 100644 --- a/charts/pulsar/templates/toolset-statefulset.yaml +++ b/charts/pulsar/templates/toolset-statefulset.yaml @@ -115,4 +115,5 @@ spec: path: ca.crt {{- end}} {{- include "pulsar.toolset.certs.volumes" . | nindent 6 }} + {{- include "pulsar.imagePullSecrets" . | nindent 6}} {{- end }}