From 096f0fe0e50dfdf13c4dfa3904f0746bcae577ca Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Fri, 24 Jun 2022 11:43:23 +0530 Subject: [PATCH] csi: change the fsgrouppolicy for CephFS driver to "File" mode At present the CephFS CSI driver works with default mode ie, `ReadWriteOncewithFsType`. However `File` type is more apt for the CephFS CSI driver and this commit bring that change. The similar change is also introduced in ceph csi driver here: https://github.com/ceph/ceph-csi/pull/3204 considering the `File` mode has been GAd in 1.23 kubernetes version and also we are lifting one of the problematic code path in this area via Ceph CSI driver changes, it is good to move the fsgrouppolicy to `File`. Signed-off-by: Humble Chirammal (cherry picked from commit 58a2f66411aebd34a85cc02b9568e31a538c794a) --- deploy/charts/rook-ceph/values.yaml | 2 +- deploy/examples/operator-openshift.yaml | 2 +- deploy/examples/operator.yaml | 2 +- pkg/operator/ceph/csi/betav1csidriver.go | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/deploy/charts/rook-ceph/values.yaml b/deploy/charts/rook-ceph/values.yaml index 77e28f0d7..4d75ad5ea 100644 --- a/deploy/charts/rook-ceph/values.yaml +++ b/deploy/charts/rook-ceph/values.yaml @@ -85,7 +85,7 @@ csi: # (Optional) policy for modifying a volume's ownership or permissions when the CephFS PVC is being mounted. # supported values are documented at https://kubernetes-csi.github.io/docs/support-fsgroup.html - cephFSFSGroupPolicy: "ReadWriteOnceWithFSType" + cephFSFSGroupPolicy: "File" # (Optional) policy for modifying a volume's ownership or permissions when the NFS PVC is being mounted. # supported values are documented at https://kubernetes-csi.github.io/docs/support-fsgroup.html diff --git a/deploy/examples/operator-openshift.yaml b/deploy/examples/operator-openshift.yaml index 4a2c52c90..fa610ef29 100644 --- a/deploy/examples/operator-openshift.yaml +++ b/deploy/examples/operator-openshift.yaml @@ -162,7 +162,7 @@ data: # (Optional) policy for modifying a volume's ownership or permissions when the CephFS PVC is being mounted. # supported values are documented at https://kubernetes-csi.github.io/docs/support-fsgroup.html - CSI_CEPHFS_FSGROUPPOLICY: "ReadWriteOnceWithFSType" + CSI_CEPHFS_FSGROUPPOLICY: "File" # (Optional) policy for modifying a volume's ownership or permissions when the NFS PVC is being mounted. # supported values are documented at https://kubernetes-csi.github.io/docs/support-fsgroup.html diff --git a/deploy/examples/operator.yaml b/deploy/examples/operator.yaml index ce480422c..a3c829b45 100644 --- a/deploy/examples/operator.yaml +++ b/deploy/examples/operator.yaml @@ -77,7 +77,7 @@ data: # (Optional) policy for modifying a volume's ownership or permissions when the CephFS PVC is being mounted. # supported values are documented at https://kubernetes-csi.github.io/docs/support-fsgroup.html - CSI_CEPHFS_FSGROUPPOLICY: "ReadWriteOnceWithFSType" + CSI_CEPHFS_FSGROUPPOLICY: "File" # (Optional) policy for modifying a volume's ownership or permissions when the NFS PVC is being mounted. # supported values are documented at https://kubernetes-csi.github.io/docs/support-fsgroup.html diff --git a/pkg/operator/ceph/csi/betav1csidriver.go b/pkg/operator/ceph/csi/betav1csidriver.go index efbf4c77f..cf7b487b8 100644 --- a/pkg/operator/ceph/csi/betav1csidriver.go +++ b/pkg/operator/ceph/csi/betav1csidriver.go @@ -52,6 +52,11 @@ func (d beta1CsiDriver) createCSIDriverInfo(ctx context.Context, clientset kuber }, } if fsGroupPolicy != "" { + if fsGroupPolicy == "File" { + // fsGroupPolicy: File was added in Kubernetes 1.19, considering beta1CsiDriver + // life exist before 1.19, we are falling back to `ReadWriteOnceWithFStype`. + fsGroupPolicy = "ReadWriteOnceWithFSType" + } policy := betav1k8scsi.FSGroupPolicy(fsGroupPolicy) csiDriver.Spec.FSGroupPolicy = &policy }