diff --git a/Documentation/Helm-Charts/operator-chart.md b/Documentation/Helm-Charts/operator-chart.md index 1b7eb2ad5a78..8e190a2cb151 100644 --- a/Documentation/Helm-Charts/operator-chart.md +++ b/Documentation/Helm-Charts/operator-chart.md @@ -80,6 +80,7 @@ The following table lists the configurable parameters of the rook-operator chart | `csi.csiRBDPluginVolume` | The volume of the CephCSI RBD plugin DaemonSet | `nil` | | `csi.csiRBDPluginVolumeMount` | The volume mounts of the CephCSI RBD plugin DaemonSet | `nil` | | `csi.csiRBDProvisionerResource` | CEPH CSI RBD provisioner resource requirement list csi-omap-generator resources will be applied only if `enableOMAPGenerator` is set to `true` | see values.yaml | +| `csi.disableCsiDriver` | Disable the CSI driver. | `"false"` | | `csi.disableHolderPods` | Deprecation note: Rook uses "holder" pods to allow CSI to connect to the multus public network without needing hosts to the network. Holder pods are being deprecated. See issue for details: https://github.com/rook/rook/issues/13055. New Rook deployments should set this to "true". | `true` | | `csi.enableCSIEncryption` | Enable Ceph CSI PVC encryption support | `false` | | `csi.enableCSIHostNetwork` | 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 | `true` | diff --git a/build/csv/ceph/rook-ceph-operator.clusterserviceversion.yaml b/build/csv/ceph/rook-ceph-operator.clusterserviceversion.yaml index 41bd0db7abb6..86829b82a277 100644 --- a/build/csv/ceph/rook-ceph-operator.clusterserviceversion.yaml +++ b/build/csv/ceph/rook-ceph-operator.clusterserviceversion.yaml @@ -3005,15 +3005,10 @@ spec: configMapKeyRef: key: ROOK_CSI_ENABLE_NFS name: ocs-operator-config - - name: ROOK_CSI_ENABLE_CEPHFS + - name: ROOK_CSI_DISABLE_DRIVER valueFrom: configMapKeyRef: - key: ROOK_CSI_ENABLE_CEPHFS - name: ocs-operator-config - - name: ROOK_CSI_ENABLE_RBD - valueFrom: - configMapKeyRef: - key: ROOK_CSI_ENABLE_RBD + key: ROOK_CSI_DISABLE_DRIVER name: ocs-operator-config - name: CSI_PROVISIONER_TOLERATIONS value: |2- diff --git a/deploy/charts/rook-ceph/templates/configmap.yaml b/deploy/charts/rook-ceph/templates/configmap.yaml index e38ddc9f22a9..c6f385451421 100644 --- a/deploy/charts/rook-ceph/templates/configmap.yaml +++ b/deploy/charts/rook-ceph/templates/configmap.yaml @@ -20,6 +20,7 @@ data: {{- if .Values.csi }} ROOK_CSI_ENABLE_RBD: {{ .Values.csi.enableRbdDriver | quote }} ROOK_CSI_ENABLE_CEPHFS: {{ .Values.csi.enableCephfsDriver | quote }} + ROOK_CSI_DISABLE_DRIVER: {{ .Values.csi.disableCsiDriver | quote }} CSI_ENABLE_CEPHFS_SNAPSHOTTER: {{ .Values.csi.enableCephfsSnapshotter | quote }} CSI_ENABLE_NFS_SNAPSHOTTER: {{ .Values.csi.enableNFSSnapshotter | quote }} CSI_ENABLE_RBD_SNAPSHOTTER: {{ .Values.csi.enableRBDSnapshotter | quote }} diff --git a/deploy/charts/rook-ceph/values.yaml b/deploy/charts/rook-ceph/values.yaml index 0493361a803e..abbfba44a949 100644 --- a/deploy/charts/rook-ceph/values.yaml +++ b/deploy/charts/rook-ceph/values.yaml @@ -81,6 +81,9 @@ csi: enableRbdDriver: true # -- Enable Ceph CSI CephFS driver enableCephfsDriver: true + # -- Disable the CSI driver. + disableCsiDriver: "false" + # -- 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-openshift.yaml b/deploy/examples/operator-openshift.yaml index cff5fe43a960..5b080a14726a 100644 --- a/deploy/examples/operator-openshift.yaml +++ b/deploy/examples/operator-openshift.yaml @@ -121,6 +121,8 @@ data: ROOK_CSI_ENABLE_RBD: "true" # Enable the CSI NFS driver. To start another version of the CSI driver, see image properties below. ROOK_CSI_ENABLE_NFS: "false" + # Disable the CSI driver. + ROOK_CSI_DISABLE_DRIVER: "false" # Set to true to enable Ceph CSI pvc encryption support. CSI_ENABLE_ENCRYPTION: "false" @@ -761,15 +763,10 @@ spec: configMapKeyRef: key: ROOK_CSI_ENABLE_NFS name: ocs-operator-config - - name: ROOK_CSI_ENABLE_CEPHFS + - name: ROOK_CSI_DISABLE_DRIVER valueFrom: configMapKeyRef: - key: ROOK_CSI_ENABLE_CEPHFS - name: ocs-operator-config - - name: ROOK_CSI_ENABLE_RBD - valueFrom: - configMapKeyRef: - key: ROOK_CSI_ENABLE_RBD + key: ROOK_CSI_DISABLE_DRIVER name: ocs-operator-config - name: CSI_PROVISIONER_TOLERATIONS value: |2- diff --git a/deploy/examples/operator.yaml b/deploy/examples/operator.yaml index bdc0b53103e9..9a0d35cf8c68 100644 --- a/deploy/examples/operator.yaml +++ b/deploy/examples/operator.yaml @@ -35,6 +35,8 @@ data: ROOK_CSI_ENABLE_RBD: "true" # Enable the CSI NFS driver. To start another version of the CSI driver, see image properties below. ROOK_CSI_ENABLE_NFS: "false" + # Disable the CSI driver. + ROOK_CSI_DISABLE_DRIVER: "false" # Set to true to enable Ceph CSI pvc encryption support. CSI_ENABLE_ENCRYPTION: "false" diff --git a/pkg/operator/ceph/csi/controller.go b/pkg/operator/ceph/csi/controller.go index 1c56183c2981..8a31f36f7905 100644 --- a/pkg/operator/ceph/csi/controller.go +++ b/pkg/operator/ceph/csi/controller.go @@ -137,6 +137,34 @@ func (r *ReconcileCSI) reconcile(request reconcile.Request) (reconcile.Result, e // reconcileResult is used to communicate the result of the reconciliation back to the caller var reconcileResult reconcile.Result + // Fetch the operator's configmap. We force the NamespaceName to the operator since the request + // could be a CephCluster. If so the NamespaceName will be the one from the cluster and thus the + // CM won't be found + opNamespaceName := types.NamespacedName{Name: opcontroller.OperatorSettingConfigMapName, Namespace: r.opConfig.OperatorNamespace} + opConfig := &v1.ConfigMap{} + err := r.client.Get(r.opManagerContext, opNamespaceName, opConfig) + if err != nil { + if kerrors.IsNotFound(err) { + logger.Debug("operator's configmap resource not found. will use default value or env var.") + r.opConfig.Parameters = make(map[string]string) + } else { + // Error reading the object - requeue the request. + return opcontroller.ImmediateRetryResult, errors.Wrap(err, "failed to get operator's configmap") + } + } else { + // Populate the operator's config + r.opConfig.Parameters = opConfig.Data + } + + // do not recocnile if csi driver is disabled + disableCSI, err := strconv.ParseBool(k8sutil.GetValue(r.opConfig.Parameters, "ROOK_CSI_DISABLE_DRIVER", "false")) + if err != nil { + return reconcile.Result{}, errors.Wrap(err, "unable to parse value for 'ROOK_CSI_DISABLE_DRIVER") + } else if disableCSI { + logger.Info("ceph csi driver is disabled") + return reconcile.Result{}, nil + } + serverVersion, err := r.context.Clientset.Discovery().ServerVersion() if err != nil { return opcontroller.ImmediateRetryResult, errors.Wrap(err, "failed to get server version") @@ -171,24 +199,6 @@ func (r *ReconcileCSI) reconcile(request reconcile.Request) (reconcile.Result, e return reconcile.Result{}, nil } - // Fetch the operator's configmap. We force the NamespaceName to the operator since the request - // could be a CephCluster. If so the NamespaceName will be the one from the cluster and thus the - // CM won't be found - opNamespaceName := types.NamespacedName{Name: opcontroller.OperatorSettingConfigMapName, Namespace: r.opConfig.OperatorNamespace} - opConfig := &v1.ConfigMap{} - err = r.client.Get(r.opManagerContext, opNamespaceName, opConfig) - if err != nil { - if kerrors.IsNotFound(err) { - logger.Debug("operator's configmap resource not found. will use default value or env var.") - r.opConfig.Parameters = make(map[string]string) - } else { - // Error reading the object - requeue the request. - return opcontroller.ImmediateRetryResult, errors.Wrap(err, "failed to get operator's configmap") - } - } else { - // Populate the operator's config - r.opConfig.Parameters = opConfig.Data - } csiHostNetworkEnabled, err := strconv.ParseBool(k8sutil.GetValue(r.opConfig.Parameters, "CSI_ENABLE_HOST_NETWORK", "true")) if err != nil {