From c59f73ab2d53793f30e662a130c0dc493c34d1a9 Mon Sep 17 00:00:00 2001 From: vonhutrong Date: Sun, 17 Dec 2023 00:08:16 +0700 Subject: [PATCH] chart: add possibility for defining image pull secrets in daemonset when users overwrite image repository, image pull secrets may be required to have access --- chart/kube-flannel/templates/daemonset.yaml | 3 +++ chart/kube-flannel/tests/daemonset_test.yaml | 10 ++++++++++ chart/kube-flannel/values.yaml | 3 +++ 3 files changed, 16 insertions(+) diff --git a/chart/kube-flannel/templates/daemonset.yaml b/chart/kube-flannel/templates/daemonset.yaml index af7226db2e..e038afeb91 100644 --- a/chart/kube-flannel/templates/daemonset.yaml +++ b/chart/kube-flannel/templates/daemonset.yaml @@ -107,3 +107,6 @@ spec: hostPath: path: /run/xtables.lock type: FileOrCreate + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: {{ toYaml .Values.global.imagePullSecrets | nindent 6 }} + {{- end }} diff --git a/chart/kube-flannel/tests/daemonset_test.yaml b/chart/kube-flannel/tests/daemonset_test.yaml index 561e8f9cae..69655ad62a 100644 --- a/chart/kube-flannel/tests/daemonset_test.yaml +++ b/chart/kube-flannel/tests/daemonset_test.yaml @@ -45,3 +45,13 @@ tests: - "/opt/bin/flanneld" - "--ip-masq" - "--kube-subnet-mgr" + + - it: should have the correct image pull secrets + set: + global.imagePullSecrets: + - name: "a-test-secret" + asserts: + - equal: + path: spec.template.spec.imagePullSecrets + value: + - name: "a-test-secret" diff --git a/chart/kube-flannel/values.yaml b/chart/kube-flannel/values.yaml index aa5225558e..62d6eb3c0e 100644 --- a/chart/kube-flannel/values.yaml +++ b/chart/kube-flannel/values.yaml @@ -1,4 +1,7 @@ --- +global: + imagePullSecrets: +# - name: "a-secret-name" # The IPv4 cidr pool to create on startup if none exists. Pod IPs will be # chosen from this range.