From dea07aa18471d791ef2e0268bdd2c417e0f8f33e Mon Sep 17 00:00:00 2001 From: "BOSSER, Bastien" Date: Fri, 14 Oct 2022 16:59:09 +0200 Subject: [PATCH] deploy: add commonLabels value Signed-off-by: BOSSER, Bastien --- build.env | 2 +- charts/ceph-csi-cephfs/README.md | 1 + charts/ceph-csi-cephfs/templates/ceph-conf.yaml | 1 + charts/ceph-csi-cephfs/templates/csiplugin-configmap.yaml | 1 + charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.yaml | 2 ++ charts/ceph-csi-cephfs/templates/nodeplugin-http-service.yaml | 1 + .../ceph-csi-cephfs/templates/nodeplugin-serviceaccount.yaml | 1 + charts/ceph-csi-cephfs/templates/provisioner-clusterrole.yaml | 1 + .../templates/provisioner-clusterrolebinding.yaml | 1 + charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml | 2 ++ .../ceph-csi-cephfs/templates/provisioner-http-service.yaml | 1 + charts/ceph-csi-cephfs/templates/provisioner-role.yaml | 1 + charts/ceph-csi-cephfs/templates/provisioner-rolebinding.yaml | 1 + .../ceph-csi-cephfs/templates/provisioner-serviceaccount.yaml | 1 + charts/ceph-csi-cephfs/templates/secret.yaml | 1 + charts/ceph-csi-cephfs/templates/storageclass.yaml | 1 + charts/ceph-csi-cephfs/values.yaml | 3 +++ charts/ceph-csi-rbd/README.md | 1 + charts/ceph-csi-rbd/templates/ceph-conf.yaml | 1 + charts/ceph-csi-rbd/templates/csiplugin-configmap.yaml | 1 + charts/ceph-csi-rbd/templates/encryptionkms-configmap.yaml | 1 + charts/ceph-csi-rbd/templates/nodeplugin-clusterrole.yaml | 1 + .../ceph-csi-rbd/templates/nodeplugin-clusterrolebinding.yaml | 1 + charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml | 2 ++ charts/ceph-csi-rbd/templates/nodeplugin-http-service.yaml | 1 + charts/ceph-csi-rbd/templates/nodeplugin-serviceaccount.yaml | 1 + charts/ceph-csi-rbd/templates/provisioner-clusterrole.yaml | 1 + .../templates/provisioner-clusterrolebinding.yaml | 1 + charts/ceph-csi-rbd/templates/provisioner-deployment.yaml | 2 ++ charts/ceph-csi-rbd/templates/provisioner-http-service.yaml | 1 + charts/ceph-csi-rbd/templates/provisioner-role.yaml | 1 + charts/ceph-csi-rbd/templates/provisioner-rolebinding.yaml | 1 + charts/ceph-csi-rbd/templates/provisioner-serviceaccount.yaml | 1 + charts/ceph-csi-rbd/templates/secret.yaml | 1 + charts/ceph-csi-rbd/templates/storageclass.yaml | 1 + charts/ceph-csi-rbd/values.yaml | 3 +++ scripts/install-helm.sh | 4 ++-- 37 files changed, 46 insertions(+), 3 deletions(-) diff --git a/build.env b/build.env index ead3acf6d..0408e3982 100644 --- a/build.env +++ b/build.env @@ -35,7 +35,7 @@ SNAPSHOT_VERSION=v6.1.0 #GO_COVER_DIR=_output/ # helm chart generation, testing and publishing -HELM_VERSION=v3.9.2 +HELM_VERSION=v3.10.1 # minikube settings MINIKUBE_VERSION=v1.27.0 diff --git a/charts/ceph-csi-cephfs/README.md b/charts/ceph-csi-cephfs/README.md index c1da58988..1e543c22a 100644 --- a/charts/ceph-csi-cephfs/README.md +++ b/charts/ceph-csi-cephfs/README.md @@ -85,6 +85,7 @@ charts and their default values. | `serviceAccounts.provisioner.create` | Specifies whether a provisioner ServiceAccount should be created | `true` | | `serviceAccounts.provisioner.name` | The name of the provisioner ServiceAccount of provisioner to use. If not set and create is true, a name is generated using the fullname | "" | | `csiConfig` | Configuration for the CSI to connect to the cluster | [] | +| `commonLabels` | Labels to apply to all resources | `{}` | | `logLevel` | Set logging level for csi containers. Supported values from 0 to 5. 0 for general useful logs, 5 for trace level verbosity. | `5` | | `sidecarLogLevel` | Set logging level for csi sidecar containers. Supported values from 0 to 5. 0 for general useful logs, 5 for trace level verbosity. | `1` | | `nodeplugin.name` | Specifies the nodeplugin name | `nodeplugin` | diff --git a/charts/ceph-csi-cephfs/templates/ceph-conf.yaml b/charts/ceph-csi-cephfs/templates/ceph-conf.yaml index 3c8f8a47b..e8ca33d02 100644 --- a/charts/ceph-csi-cephfs/templates/ceph-conf.yaml +++ b/charts/ceph-csi-cephfs/templates/ceph-conf.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} data: ceph.conf: | {{ tpl .Values.cephconf . | indent 4 }} diff --git a/charts/ceph-csi-cephfs/templates/csiplugin-configmap.yaml b/charts/ceph-csi-cephfs/templates/csiplugin-configmap.yaml index 1f59b66ce..605710c25 100644 --- a/charts/ceph-csi-cephfs/templates/csiplugin-configmap.yaml +++ b/charts/ceph-csi-cephfs/templates/csiplugin-configmap.yaml @@ -10,6 +10,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} data: config.json: |- {{ toJson .Values.csiConfig | indent 4 -}} diff --git a/charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.yaml b/charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.yaml index 1a499bb60..f022ed57a 100644 --- a/charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.yaml +++ b/charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} spec: selector: matchLabels: @@ -25,6 +26,7 @@ spec: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 8 }}{{- end }} spec: serviceAccountName: {{ include "ceph-csi-cephfs.serviceAccountName.nodeplugin" . }} {{- if .Values.nodeplugin.priorityClassName }} diff --git a/charts/ceph-csi-cephfs/templates/nodeplugin-http-service.yaml b/charts/ceph-csi-cephfs/templates/nodeplugin-http-service.yaml index 95fee84f2..8aaf1260a 100644 --- a/charts/ceph-csi-cephfs/templates/nodeplugin-http-service.yaml +++ b/charts/ceph-csi-cephfs/templates/nodeplugin-http-service.yaml @@ -14,6 +14,7 @@ metadata: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} spec: {{- if .Values.nodeplugin.httpMetrics.service.clusterIP }} clusterIP: "{{ .Values.nodeplugin.httpMetrics.service.clusterIP }}" diff --git a/charts/ceph-csi-cephfs/templates/nodeplugin-serviceaccount.yaml b/charts/ceph-csi-cephfs/templates/nodeplugin-serviceaccount.yaml index 5dedaf4b0..77b5d5e83 100644 --- a/charts/ceph-csi-cephfs/templates/nodeplugin-serviceaccount.yaml +++ b/charts/ceph-csi-cephfs/templates/nodeplugin-serviceaccount.yaml @@ -10,4 +10,5 @@ metadata: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} {{- end -}} diff --git a/charts/ceph-csi-cephfs/templates/provisioner-clusterrole.yaml b/charts/ceph-csi-cephfs/templates/provisioner-clusterrole.yaml index 667e7c923..6272cf918 100644 --- a/charts/ceph-csi-cephfs/templates/provisioner-clusterrole.yaml +++ b/charts/ceph-csi-cephfs/templates/provisioner-clusterrole.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} rules: - apiGroups: [""] resources: ["secrets"] diff --git a/charts/ceph-csi-cephfs/templates/provisioner-clusterrolebinding.yaml b/charts/ceph-csi-cephfs/templates/provisioner-clusterrolebinding.yaml index 82d5d1316..7417a7491 100644 --- a/charts/ceph-csi-cephfs/templates/provisioner-clusterrolebinding.yaml +++ b/charts/ceph-csi-cephfs/templates/provisioner-clusterrolebinding.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} subjects: - kind: ServiceAccount name: {{ include "ceph-csi-cephfs.serviceAccountName.provisioner" . }} diff --git a/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml b/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml index 6d3c371cb..10feec7ea 100644 --- a/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml +++ b/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} spec: replicas: {{ .Values.provisioner.replicaCount }} strategy: @@ -30,6 +31,7 @@ spec: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 8 }}{{- end }} spec: {{- if gt (int .Values.provisioner.replicaCount) 1 }} affinity: diff --git a/charts/ceph-csi-cephfs/templates/provisioner-http-service.yaml b/charts/ceph-csi-cephfs/templates/provisioner-http-service.yaml index 548324242..92ecca3ce 100644 --- a/charts/ceph-csi-cephfs/templates/provisioner-http-service.yaml +++ b/charts/ceph-csi-cephfs/templates/provisioner-http-service.yaml @@ -14,6 +14,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} spec: {{- if .Values.provisioner.httpMetrics.service.clusterIP }} clusterIP: "{{ .Values.provisioner.httpMetrics.service.clusterIP }}" diff --git a/charts/ceph-csi-cephfs/templates/provisioner-role.yaml b/charts/ceph-csi-cephfs/templates/provisioner-role.yaml index d5cc57500..d25814c5b 100644 --- a/charts/ceph-csi-cephfs/templates/provisioner-role.yaml +++ b/charts/ceph-csi-cephfs/templates/provisioner-role.yaml @@ -10,6 +10,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} rules: - apiGroups: [""] resources: ["configmaps"] diff --git a/charts/ceph-csi-cephfs/templates/provisioner-rolebinding.yaml b/charts/ceph-csi-cephfs/templates/provisioner-rolebinding.yaml index 66fb72580..3e77e0aff 100644 --- a/charts/ceph-csi-cephfs/templates/provisioner-rolebinding.yaml +++ b/charts/ceph-csi-cephfs/templates/provisioner-rolebinding.yaml @@ -10,6 +10,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} subjects: - kind: ServiceAccount name: {{ include "ceph-csi-cephfs.serviceAccountName.provisioner" . }} diff --git a/charts/ceph-csi-cephfs/templates/provisioner-serviceaccount.yaml b/charts/ceph-csi-cephfs/templates/provisioner-serviceaccount.yaml index c4ba5c188..0207133bb 100644 --- a/charts/ceph-csi-cephfs/templates/provisioner-serviceaccount.yaml +++ b/charts/ceph-csi-cephfs/templates/provisioner-serviceaccount.yaml @@ -10,4 +10,5 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} {{- end -}} diff --git a/charts/ceph-csi-cephfs/templates/secret.yaml b/charts/ceph-csi-cephfs/templates/secret.yaml index 7063543b7..64124cb0f 100644 --- a/charts/ceph-csi-cephfs/templates/secret.yaml +++ b/charts/ceph-csi-cephfs/templates/secret.yaml @@ -9,6 +9,7 @@ metadata: chart: {{ include "ceph-csi-cephfs.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} stringData: adminID: {{ .Values.secret.adminID }} adminKey: {{ .Values.secret.adminKey }} diff --git a/charts/ceph-csi-cephfs/templates/storageclass.yaml b/charts/ceph-csi-cephfs/templates/storageclass.yaml index 4041dec6b..a21c99824 100644 --- a/charts/ceph-csi-cephfs/templates/storageclass.yaml +++ b/charts/ceph-csi-cephfs/templates/storageclass.yaml @@ -12,6 +12,7 @@ metadata: chart: {{ include "ceph-csi-cephfs.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} provisioner: {{ .Values.driverName }} parameters: clusterID: {{ .Values.storageClass.clusterID }} diff --git a/charts/ceph-csi-cephfs/values.yaml b/charts/ceph-csi-cephfs/values.yaml index f06ccbc5d..44ff60805 100644 --- a/charts/ceph-csi-cephfs/values.yaml +++ b/charts/ceph-csi-cephfs/values.yaml @@ -30,6 +30,9 @@ serviceAccounts: # netNamespaceFilePath: "{{ .kubeletDir }}/plugins/{{ .driverName }}/net" csiConfig: [] +# Labels to apply to all resources +commonLabels: {} + # Set logging level for csi containers. # Supported values from 0 to 5. 0 for general useful logs, # 5 for trace level verbosity. diff --git a/charts/ceph-csi-rbd/README.md b/charts/ceph-csi-rbd/README.md index 0f3975671..7e8eb4a89 100644 --- a/charts/ceph-csi-rbd/README.md +++ b/charts/ceph-csi-rbd/README.md @@ -87,6 +87,7 @@ charts and their default values. | `csiConfig` | Configuration for the CSI to connect to the cluster | [] | | `csiMapping` | Configuration details of clusterID,PoolID,FscID mapping | [] | | `encryptionKMSConfig` | Configuration for the encryption KMS | `{}` | +| `commonLabels` | Labels to apply to all resources | `{}` | | `logLevel` | Set logging level for csi containers. Supported values from 0 to 5. 0 for general useful logs, 5 for trace level verbosity. | `5` | | `sidecarLogLevel` | Set logging level for csi sidecar containers. Supported values from 0 to 5. 0 for general useful logs, 5 for trace level verbosity. | `1` | | `nodeplugin.name` | Specifies the nodeplugins name | `nodeplugin` | diff --git a/charts/ceph-csi-rbd/templates/ceph-conf.yaml b/charts/ceph-csi-rbd/templates/ceph-conf.yaml index bcd0e4d39..d2b0b1b48 100644 --- a/charts/ceph-csi-rbd/templates/ceph-conf.yaml +++ b/charts/ceph-csi-rbd/templates/ceph-conf.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} data: ceph.conf: | {{ tpl .Values.cephconf . | indent 4 }} diff --git a/charts/ceph-csi-rbd/templates/csiplugin-configmap.yaml b/charts/ceph-csi-rbd/templates/csiplugin-configmap.yaml index f0944027e..33a0df3c3 100644 --- a/charts/ceph-csi-rbd/templates/csiplugin-configmap.yaml +++ b/charts/ceph-csi-rbd/templates/csiplugin-configmap.yaml @@ -10,6 +10,7 @@ metadata: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} data: config.json: |- {{ toJson .Values.csiConfig | indent 4 }} diff --git a/charts/ceph-csi-rbd/templates/encryptionkms-configmap.yaml b/charts/ceph-csi-rbd/templates/encryptionkms-configmap.yaml index 47b7d093d..f754fea72 100644 --- a/charts/ceph-csi-rbd/templates/encryptionkms-configmap.yaml +++ b/charts/ceph-csi-rbd/templates/encryptionkms-configmap.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} data: config.json: |- {{ toJson .Values.encryptionKMSConfig | indent 4 -}} diff --git a/charts/ceph-csi-rbd/templates/nodeplugin-clusterrole.yaml b/charts/ceph-csi-rbd/templates/nodeplugin-clusterrole.yaml index 9e24d757e..aa8ddd4fd 100644 --- a/charts/ceph-csi-rbd/templates/nodeplugin-clusterrole.yaml +++ b/charts/ceph-csi-rbd/templates/nodeplugin-clusterrole.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} rules: {{- if .Values.topology.enabled }} - apiGroups: [""] diff --git a/charts/ceph-csi-rbd/templates/nodeplugin-clusterrolebinding.yaml b/charts/ceph-csi-rbd/templates/nodeplugin-clusterrolebinding.yaml index bf52865e1..ec8ad79b3 100644 --- a/charts/ceph-csi-rbd/templates/nodeplugin-clusterrolebinding.yaml +++ b/charts/ceph-csi-rbd/templates/nodeplugin-clusterrolebinding.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} subjects: - kind: ServiceAccount name: {{ include "ceph-csi-rbd.serviceAccountName.nodeplugin" . }} diff --git a/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml b/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml index aad875423..fdf85c56f 100644 --- a/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml +++ b/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} spec: selector: matchLabels: @@ -25,6 +26,7 @@ spec: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 8 }}{{- end }} spec: serviceAccountName: {{ include "ceph-csi-rbd.serviceAccountName.nodeplugin" . }} hostNetwork: true diff --git a/charts/ceph-csi-rbd/templates/nodeplugin-http-service.yaml b/charts/ceph-csi-rbd/templates/nodeplugin-http-service.yaml index 68a3942e8..e3b18f59a 100644 --- a/charts/ceph-csi-rbd/templates/nodeplugin-http-service.yaml +++ b/charts/ceph-csi-rbd/templates/nodeplugin-http-service.yaml @@ -14,6 +14,7 @@ metadata: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} spec: {{- if .Values.nodeplugin.httpMetrics.service.clusterIP }} clusterIP: "{{ .Values.nodeplugin.httpMetrics.service.clusterIP }}" diff --git a/charts/ceph-csi-rbd/templates/nodeplugin-serviceaccount.yaml b/charts/ceph-csi-rbd/templates/nodeplugin-serviceaccount.yaml index 36e1ee745..56bd024dd 100644 --- a/charts/ceph-csi-rbd/templates/nodeplugin-serviceaccount.yaml +++ b/charts/ceph-csi-rbd/templates/nodeplugin-serviceaccount.yaml @@ -10,4 +10,5 @@ metadata: component: {{ .Values.nodeplugin.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} {{- end -}} diff --git a/charts/ceph-csi-rbd/templates/provisioner-clusterrole.yaml b/charts/ceph-csi-rbd/templates/provisioner-clusterrole.yaml index 70c7670b2..fd3778bd8 100644 --- a/charts/ceph-csi-rbd/templates/provisioner-clusterrole.yaml +++ b/charts/ceph-csi-rbd/templates/provisioner-clusterrole.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} rules: - apiGroups: [""] resources: ["secrets"] diff --git a/charts/ceph-csi-rbd/templates/provisioner-clusterrolebinding.yaml b/charts/ceph-csi-rbd/templates/provisioner-clusterrolebinding.yaml index 5a086103a..d4077daa9 100644 --- a/charts/ceph-csi-rbd/templates/provisioner-clusterrolebinding.yaml +++ b/charts/ceph-csi-rbd/templates/provisioner-clusterrolebinding.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} subjects: - kind: ServiceAccount name: {{ include "ceph-csi-rbd.serviceAccountName.provisioner" . }} diff --git a/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml b/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml index f425b174d..a7acd1324 100644 --- a/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml +++ b/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml @@ -9,6 +9,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} spec: replicas: {{ .Values.provisioner.replicaCount }} strategy: @@ -30,6 +31,7 @@ spec: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 8 }}{{- end }} spec: {{- if gt (int .Values.provisioner.replicaCount) 1 }} affinity: diff --git a/charts/ceph-csi-rbd/templates/provisioner-http-service.yaml b/charts/ceph-csi-rbd/templates/provisioner-http-service.yaml index 0d4c925ec..10b0e6787 100644 --- a/charts/ceph-csi-rbd/templates/provisioner-http-service.yaml +++ b/charts/ceph-csi-rbd/templates/provisioner-http-service.yaml @@ -14,6 +14,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} spec: {{- if .Values.provisioner.httpMetrics.service.clusterIP }} clusterIP: "{{ .Values.provisioner.httpMetrics.service.clusterIP }}" diff --git a/charts/ceph-csi-rbd/templates/provisioner-role.yaml b/charts/ceph-csi-rbd/templates/provisioner-role.yaml index 3a235a36d..f0b86fb40 100644 --- a/charts/ceph-csi-rbd/templates/provisioner-role.yaml +++ b/charts/ceph-csi-rbd/templates/provisioner-role.yaml @@ -10,6 +10,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} rules: - apiGroups: [""] resources: ["configmaps"] diff --git a/charts/ceph-csi-rbd/templates/provisioner-rolebinding.yaml b/charts/ceph-csi-rbd/templates/provisioner-rolebinding.yaml index 23fa39fed..62dee4765 100644 --- a/charts/ceph-csi-rbd/templates/provisioner-rolebinding.yaml +++ b/charts/ceph-csi-rbd/templates/provisioner-rolebinding.yaml @@ -10,6 +10,7 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} subjects: - kind: ServiceAccount name: {{ include "ceph-csi-rbd.serviceAccountName.provisioner" . }} diff --git a/charts/ceph-csi-rbd/templates/provisioner-serviceaccount.yaml b/charts/ceph-csi-rbd/templates/provisioner-serviceaccount.yaml index 893b43a9c..8acf41a24 100644 --- a/charts/ceph-csi-rbd/templates/provisioner-serviceaccount.yaml +++ b/charts/ceph-csi-rbd/templates/provisioner-serviceaccount.yaml @@ -10,4 +10,5 @@ metadata: component: {{ .Values.provisioner.name }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} {{- end -}} diff --git a/charts/ceph-csi-rbd/templates/secret.yaml b/charts/ceph-csi-rbd/templates/secret.yaml index 1553ceec7..3040bcfd0 100644 --- a/charts/ceph-csi-rbd/templates/secret.yaml +++ b/charts/ceph-csi-rbd/templates/secret.yaml @@ -9,6 +9,7 @@ metadata: chart: {{ include "ceph-csi-rbd.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} stringData: userID: {{ .Values.secret.userID }} userKey: {{ .Values.secret.userKey }} diff --git a/charts/ceph-csi-rbd/templates/storageclass.yaml b/charts/ceph-csi-rbd/templates/storageclass.yaml index fda713ab3..a559456aa 100644 --- a/charts/ceph-csi-rbd/templates/storageclass.yaml +++ b/charts/ceph-csi-rbd/templates/storageclass.yaml @@ -12,6 +12,7 @@ metadata: chart: {{ include "ceph-csi-rbd.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} provisioner: {{ .Values.driverName }} parameters: clusterID: {{ .Values.storageClass.clusterID }} diff --git a/charts/ceph-csi-rbd/values.yaml b/charts/ceph-csi-rbd/values.yaml index 65745773b..27edd4a58 100644 --- a/charts/ceph-csi-rbd/values.yaml +++ b/charts/ceph-csi-rbd/values.yaml @@ -53,6 +53,9 @@ csiMapping: [] # vaultCAVerify: "false" encryptionKMSConfig: {} +# Labels to apply to all resources +commonLabels: {} + # Set logging level for csi containers. # Supported values from 0 to 5. 0 for general useful logs, # 5 for trace level verbosity. diff --git a/scripts/install-helm.sh b/scripts/install-helm.sh index cf3a8ad44..ef71a7c32 100755 --- a/scripts/install-helm.sh +++ b/scripts/install-helm.sh @@ -169,7 +169,7 @@ install_cephcsi_helm_charts() { fi # install ceph-csi-cephfs and ceph-csi-rbd charts # shellcheck disable=SC2086 - "${HELM}" install --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-cephfsplugin-provisioner --set nodeplugin.fullnameOverride=csi-cephfsplugin --set configMapName=ceph-csi-config --set provisioner.replicaCount=1 ${SET_SC_TEMPLATE_VALUES} ${CEPHFS_SECRET_TEMPLATE_VALUES} ${CEPHFS_CHART_NAME} "${SCRIPT_DIR}"/../charts/ceph-csi-cephfs + "${HELM}" install --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-cephfsplugin-provisioner --set nodeplugin.fullnameOverride=csi-cephfsplugin --set configMapName=ceph-csi-config --set provisioner.replicaCount=1 --set-json='commonLabels={"app.kubernetes.io/name": "ceph-csi-cephfs", "app.kubernetes.io/managed-by": "helm"}' ${SET_SC_TEMPLATE_VALUES} ${CEPHFS_SECRET_TEMPLATE_VALUES} ${CEPHFS_CHART_NAME} "${SCRIPT_DIR}"/../charts/ceph-csi-cephfs check_deployment_status app=ceph-csi-cephfs ${NAMESPACE} check_daemonset_status app=ceph-csi-cephfs ${NAMESPACE} @@ -179,7 +179,7 @@ install_cephcsi_helm_charts() { kubectl_retry delete cm ceph-config --namespace ${NAMESPACE} # shellcheck disable=SC2086 - "${HELM}" install --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-rbdplugin-provisioner --set nodeplugin.fullnameOverride=csi-rbdplugin --set configMapName=ceph-csi-config --set provisioner.replicaCount=1 ${SET_SC_TEMPLATE_VALUES} ${RBD_SECRET_TEMPLATE_VALUES} ${RBD_CHART_NAME} "${SCRIPT_DIR}"/../charts/ceph-csi-rbd --set topology.enabled=true --set topology.domainLabels="{${NODE_LABEL_REGION},${NODE_LABEL_ZONE}}" --set provisioner.maxSnapshotsOnImage=3 --set provisioner.minSnapshotsOnImage=2 + "${HELM}" install --namespace ${NAMESPACE} --set provisioner.fullnameOverride=csi-rbdplugin-provisioner --set nodeplugin.fullnameOverride=csi-rbdplugin --set configMapName=ceph-csi-config --set provisioner.replicaCount=1 --set-json='commonLabels={"app.kubernetes.io/name": "ceph-csi-rbd", "app.kubernetes.io/managed-by": "helm"}' ${SET_SC_TEMPLATE_VALUES} ${RBD_SECRET_TEMPLATE_VALUES} ${RBD_CHART_NAME} "${SCRIPT_DIR}"/../charts/ceph-csi-rbd --set topology.enabled=true --set topology.domainLabels="{${NODE_LABEL_REGION},${NODE_LABEL_ZONE}}" --set provisioner.maxSnapshotsOnImage=3 --set provisioner.minSnapshotsOnImage=2 check_deployment_status app=ceph-csi-rbd ${NAMESPACE} check_daemonset_status app=ceph-csi-rbd ${NAMESPACE}