From a63fa37d71b9a79234f114dafeec3bd629bacfc1 Mon Sep 17 00:00:00 2001 From: Maksim Nabokikh Date: Tue, 20 Aug 2019 00:18:33 +0400 Subject: [PATCH] rook: Add image pull secrets option Allow to specify imagePullSecrets to pull operator images from private registry Signed-off-by: Maksim Nabokikh --- PendingReleaseNotes.md | 1 + cluster/charts/rook-ceph/templates/_helpers.tpl | 10 ++++++++++ cluster/charts/rook-ceph/templates/serviceaccount.yaml | 8 ++++++++ cluster/charts/rook-ceph/values.yaml | 4 ++++ cluster/examples/kubernetes/ceph/common.yaml | 9 +++++++++ 5 files changed, 32 insertions(+) diff --git a/PendingReleaseNotes.md b/PendingReleaseNotes.md index 13c4870bb..9d78d3f63 100644 --- a/PendingReleaseNotes.md +++ b/PendingReleaseNotes.md @@ -60,6 +60,7 @@ an example usage - The CSI driver is enabled by default. Documentation has been changed significantly for block and filesystem to use the CSI driver instead of flex. While the flex driver is still supported, it is anticipated to be deprecated soon. - The `Mon.PreferredCount` setting has been removed. +- imagePullSecrets option added to helm-chart ## Known Issues diff --git a/cluster/charts/rook-ceph/templates/_helpers.tpl b/cluster/charts/rook-ceph/templates/_helpers.tpl index f0d83d2ed..529b49017 100644 --- a/cluster/charts/rook-ceph/templates/_helpers.tpl +++ b/cluster/charts/rook-ceph/templates/_helpers.tpl @@ -14,3 +14,13 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Define imagePullSecrets option to pass to all service accounts +*/}} +{{- define "imagePullSecrets" }} +{{- if .Values.imagePullSecrets -}} +imagePullSecrets: +{{ toYaml .Values.imagePullSecrets }} +{{- end -}} +{{- end -}} diff --git a/cluster/charts/rook-ceph/templates/serviceaccount.yaml b/cluster/charts/rook-ceph/templates/serviceaccount.yaml index e6948a091..6bbe75988 100644 --- a/cluster/charts/rook-ceph/templates/serviceaccount.yaml +++ b/cluster/charts/rook-ceph/templates/serviceaccount.yaml @@ -7,6 +7,7 @@ metadata: operator: rook storage-backend: ceph chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" +{{ template "imagePullSecrets" . }} --- # Service account for the Ceph OSDs. Must exist and cannot be renamed. apiVersion: v1 @@ -17,6 +18,7 @@ metadata: operator: rook storage-backend: ceph chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" +{{ template "imagePullSecrets" . }} --- # Service account for the Ceph Mgr. Must exist and cannot be renamed. apiVersion: v1 @@ -27,6 +29,7 @@ metadata: operator: rook storage-backend: ceph chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" +{{ template "imagePullSecrets" . }} --- apiVersion: v1 kind: ServiceAccount @@ -36,27 +39,32 @@ metadata: operator: rook storage-backend: ceph chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" +{{ template "imagePullSecrets" . }} --- # Service account for the cephfs csi driver apiVersion: v1 kind: ServiceAccount metadata: name: rook-csi-cephfs-plugin-sa +{{ template "imagePullSecrets" . }} --- # Service account for the cephfs csi provisioner apiVersion: v1 kind: ServiceAccount metadata: name: rook-csi-cephfs-provisioner-sa +{{ template "imagePullSecrets" . }} --- # Service account for the rbd csi driver apiVersion: v1 kind: ServiceAccount metadata: name: rook-csi-rbd-plugin-sa +{{ template "imagePullSecrets" . }} --- # Service account for the rbd csi provisioner apiVersion: v1 kind: ServiceAccount metadata: name: rook-csi-rbd-provisioner-sa +{{ template "imagePullSecrets" . }} diff --git a/cluster/charts/rook-ceph/values.yaml b/cluster/charts/rook-ceph/values.yaml index 9e8b8f938..95ff13bca 100644 --- a/cluster/charts/rook-ceph/values.yaml +++ b/cluster/charts/rook-ceph/values.yaml @@ -105,3 +105,7 @@ hostpathRequiresPrivileged: false # Disable automatic orchestration when new devices are discovered. disableDeviceHotplug: false + +# imagePullSecrets option allow to pull docker images from private docker registry. Option will be passed to all service accounts. +# imagePullSecrets: +# - name: my-registry-secret diff --git a/cluster/examples/kubernetes/ceph/common.yaml b/cluster/examples/kubernetes/ceph/common.yaml index 5d766030f..249617b03 100644 --- a/cluster/examples/kubernetes/ceph/common.yaml +++ b/cluster/examples/kubernetes/ceph/common.yaml @@ -705,6 +705,9 @@ metadata: labels: operator: rook storage-backend: ceph +# imagePullSecrets: +# - name: my-registry-secret + # OLM: END SERVICE ACCOUNT SYSTEM # OLM: BEGIN OPERATOR ROLEBINDING --- @@ -757,6 +760,9 @@ kind: ServiceAccount metadata: name: rook-ceph-osd namespace: rook-ceph +# imagePullSecrets: +# - name: my-registry-secret + # OLM: END SERVICE ACCOUNT OSD # OLM: BEGIN SERVICE ACCOUNT MGR --- @@ -766,6 +772,9 @@ kind: ServiceAccount metadata: name: rook-ceph-mgr namespace: rook-ceph +# imagePullSecrets: +# - name: my-registry-secret + # OLM: END SERVICE ACCOUNT MGR # OLM: BEGIN CMD REPORTER SERVICE ACCOUNT ---