diff --git a/Documentation/Helm-Charts/operator-chart.md b/Documentation/Helm-Charts/operator-chart.md index 7a9769e34..579d7d9e7 100644 --- a/Documentation/Helm-Charts/operator-chart.md +++ b/Documentation/Helm-Charts/operator-chart.md @@ -73,6 +73,8 @@ The following tables lists the configurable parameters of the rook-operator char | `csi.rbdFSGroupPolicy` | Policy for modifying a volume's ownership or permissions when the RBD PVC is being mounted | `ReadWriteOnceWithFSType` | | `csi.cephFSFSGroupPolicy` | Policy for modifying a volume's ownership or permissions when the CephFS PVC is being mounted | `ReadWriteOnceWithFSType` | | `csi.nfsFSGroupPolicy` | Policy for modifying a volume's ownership or permissions when the NFS PVC is being mounted | `ReadWriteOnceWithFSType` | +| `csi.enableMetadata` | Set volume metadata on the CephFS subvolumes and RBD images. | `false` | +| `csi.clusterName` | Cluster name identifier to set as metadata on the CephFS subvolumes and RBD images. | `` | | `csi.logLevel` | Set logging level for cephCSI containers maintained by the cephCSI. Supported values from 0 to 5. 0 for general useful logs, 5 for trace level verbosity. | `0` | | `csi.sidecarLogLevel` | Set logging level for cephCSI sidecar containers. Supported values from 0 to 5. 0 for general useful logs (the default), 5 for trace level verbosity. | `0` | | `csi.grpcTimeoutInSeconds` | Set GRPC timeout for csi containers. | `150` | diff --git a/deploy/charts/rook-ceph/templates/configmap.yaml b/deploy/charts/rook-ceph/templates/configmap.yaml index 2864d73f8..2289b7062 100644 --- a/deploy/charts/rook-ceph/templates/configmap.yaml +++ b/deploy/charts/rook-ceph/templates/configmap.yaml @@ -17,6 +17,7 @@ data: CSI_ENABLE_ENCRYPTION: {{ .Values.csi.enableCSIEncryption | quote }} CSI_ENABLE_OMAP_GENERATOR: {{ .Values.csi.enableOMAPGenerator | quote }} CSI_ENABLE_HOST_NETWORK: {{ .Values.csi.enableCSIHostNetwork | quote }} + CSI_ENABLE_METADATA: {{ .Values.csi.enableMetadata | quote }} {{- if .Values.csi.pluginPriorityClassName }} CSI_PLUGIN_PRIORITY_CLASSNAME: {{ .Values.csi.pluginPriorityClassName | quote }} {{- end }} @@ -177,6 +178,9 @@ data: {{- if .Values.csi.sidecarLogLevel }} CSI_SIDECAR_LOG_LEVEL: {{ .Values.csi.sidecarLogLevel | quote }} {{- end }} +{{- if .Values.csi.clusterName }} + CSI_CLUSTER_NAME: {{ .Values.csi.clusterName | quote }} +{{- end }} {{- if .Values.csi.grpcTimeoutInSeconds }} CSI_GRPC_TIMEOUT_SECONDS: {{ .Values.csi.grpcTimeoutInSeconds | quote }} {{- end }} diff --git a/deploy/charts/rook-ceph/values.yaml b/deploy/charts/rook-ceph/values.yaml index 4d75ad5ea..9b21fc54b 100644 --- a/deploy/charts/rook-ceph/values.yaml +++ b/deploy/charts/rook-ceph/values.yaml @@ -98,9 +98,17 @@ csi: # sidecar with CSI provisioner pod, to enable set it to true. enableOMAPGenerator: false + # (Optional) set to true to enable adding volume metadata on the CephFS subvolumes and RBD images. + # Not all users might be interested in getting volume/snapshot details as metadata on CephFS subvolume and RBD images. + # Hence enable metadata is false by default. + enableMetadata: false + # Set replicas for csi provisioner deployment. provisionerReplicas: 2 + # (Optional) cluster name identifier to set as metadata on the CephFS subvolume and RBD images. This will be useful + # in cases like for example, when two container orchestrator clusters (Kubernetes/OCP) are using a single ceph cluster. + # clusterName: "my-prod-cluster" # Set logging level for cephCSI containers maintained by the cephCSI. # Supported values from 0 to 5. 0 for general useful logs, 5 for trace level verbosity. #logLevel: 0 diff --git a/deploy/examples/operator-openshift.yaml b/deploy/examples/operator-openshift.yaml index 2c9322e90..b4ddb7bdd 100644 --- a/deploy/examples/operator-openshift.yaml +++ b/deploy/examples/operator-openshift.yaml @@ -122,6 +122,13 @@ data: # Set to true to enable Ceph CSI pvc encryption support. CSI_ENABLE_ENCRYPTION: "false" + # set to true to enable adding volume metadata on the CephFS subvolume and RBD images. + # CSI_ENABLE_METADATA: "true" + + # cluster name identifier to set as metadata on the CephFS subvolume and RBD images. This will be useful in cases + # like for example, when two container orchestrator clusters (Kubernetes/OCP) are using a single ceph cluster. + # CSI_CLUSTER_NAME: "my-prod-cluster" + # Set to true to enable host networking for CSI CephFS and RBD nodeplugins. This may be necessary # in some network configurations where the SDN does not provide access to an external cluster or # there is significant drop in read/write performance. diff --git a/deploy/examples/operator.yaml b/deploy/examples/operator.yaml index c0abcc9a5..0c0f01d76 100644 --- a/deploy/examples/operator.yaml +++ b/deploy/examples/operator.yaml @@ -42,6 +42,15 @@ data: # there is significant drop in read/write performance. # CSI_ENABLE_HOST_NETWORK: "true" + # Set to true to enable adding volume metadata on the CephFS subvolume and RBD images. + # Not all users might be interested in getting volume/snapshot details as metadata on CephFS subvolume and RBD images. + # Hence enable metadata is false by default. + # CSI_ENABLE_METADATA: "true" + + # cluster name identifier to set as metadata on the CephFS subvolume and RBD images. This will be useful in cases + # like for example, when two container orchestrator clusters (Kubernetes/OCP) are using a single ceph cluster. + # CSI_CLUSTER_NAME: "my-prod-cluster" + # Set logging level for cephCSI containers maintained by the cephCSI. # Supported values from 0 to 5. 0 for general useful logs, 5 for trace level verbosity. # CSI_LOG_LEVEL: "0" diff --git a/pkg/operator/ceph/csi/csi.go b/pkg/operator/ceph/csi/csi.go index 14b110c10..87cffea51 100644 --- a/pkg/operator/ceph/csi/csi.go +++ b/pkg/operator/ceph/csi/csi.go @@ -180,6 +180,10 @@ func (r *ReconcileCSI) setParams(ver *version.Info) error { CSIParam.EnableCSIEncryption = true } + if strings.EqualFold(k8sutil.GetValue(r.opConfig.Parameters, "CSI_ENABLE_METADATA", "false"), "true") { + CSIParam.CSIEnableMetadata = true + } + if strings.EqualFold(k8sutil.GetValue(r.opConfig.Parameters, "CSI_CEPHFS_PLUGIN_UPDATE_STRATEGY", rollingUpdate), onDelete) { CSIParam.CephFSPluginUpdateStrategy = onDelete } else { @@ -261,6 +265,7 @@ func (r *ReconcileCSI) setParams(ver *version.Info) error { CSIParam.CSINFSPodLabels = k8sutil.ParseStringToLabels(csiNFSPodLabels) csiRBDPodLabels := k8sutil.GetValue(r.opConfig.Parameters, "ROOK_CSI_RBD_POD_LABELS", "") CSIParam.CSIRBDPodLabels = k8sutil.ParseStringToLabels(csiRBDPodLabels) + CSIParam.CSIClusterName = k8sutil.GetValue(r.opConfig.Parameters, "CSI_CLUSTER_NAME", "") return nil } diff --git a/pkg/operator/ceph/csi/spec.go b/pkg/operator/ceph/csi/spec.go index ae0074816..6077d6aff 100644 --- a/pkg/operator/ceph/csi/spec.go +++ b/pkg/operator/ceph/csi/spec.go @@ -57,7 +57,9 @@ type Param struct { ProvisionerPriorityClassName string VolumeReplicationImage string CSIAddonsImage string + CSIClusterName string GRPCTimeout time.Duration + CSIEnableMetadata bool EnablePluginSelinuxHostMount bool EnableCSIHostNetwork bool EnableOMAPGenerator bool diff --git a/pkg/operator/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-dep.yaml b/pkg/operator/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-dep.yaml index a4c023e6e..d865a1e73 100644 --- a/pkg/operator/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-dep.yaml +++ b/pkg/operator/ceph/csi/template/cephfs/csi-cephfsplugin-provisioner-dep.yaml @@ -114,6 +114,12 @@ spec: - "--forcecephkernelclient={{ .ForceCephFSKernelClient }}" - "--metricspath=/metrics" - "--enablegrpcmetrics={{ .EnableCSIGRPCMetrics }}" + {{ if .CSIEnableMetadata }} + - "--setmetadata={{ .CSIEnableMetadata }}" + {{ end }} + {{ if .CSIClusterName }} + - "--clustername={{ .CSIClusterName }}" + {{ end }} env: - name: POD_IP valueFrom: diff --git a/pkg/operator/ceph/csi/template/rbd/csi-rbdplugin-provisioner-dep.yaml b/pkg/operator/ceph/csi/template/rbd/csi-rbdplugin-provisioner-dep.yaml index 5deaca9c9..243f5a7cb 100644 --- a/pkg/operator/ceph/csi/template/rbd/csi-rbdplugin-provisioner-dep.yaml +++ b/pkg/operator/ceph/csi/template/rbd/csi-rbdplugin-provisioner-dep.yaml @@ -199,6 +199,12 @@ spec: {{ if .EnableCSIAddonsSideCar }} - "--csi-addons-endpoint=$(CSIADDONS_ENDPOINT)" {{ end }} + {{ if .CSIEnableMetadata }} + - "--setmetadata={{ .CSIEnableMetadata }}" + {{ end }} + {{ if .CSIClusterName }} + - "--clustername={{ .CSIClusterName }}" + {{ end }} env: - name: POD_IP valueFrom: