Skip to content

Commit

Permalink
When NFS is enabled on the storagecluster pass ROOK_CSI_ENABLE_NFS: true
Browse files Browse the repository at this point in the history
Earlier when enabling NFS the key needed to be passed manually to
rook via patching the rook-ceph-operator-config cm. Now the key is
passed automatically via env variable to the rook pod.

Signed-off-by: Malay Kumar Parida <[email protected]>
  • Loading branch information
malayparida2000 committed Sep 22, 2023
1 parent 1d5b7b2 commit 319c561
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ func (r *OCSInitializationReconciler) ensureOcsOperatorConfigExists(initialData
util.ClusterNameKey: util.GetClusterID(r.ctx, r.Client, &r.Log),
util.EnableReadAffinityKey: "true",
util.CephFSKernelMountOptionsKey: "ms_mode=prefer-crc",
util.EnableNFSKey: "false",
}
ocsOperatorConfig := &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Expand Down
9 changes: 9 additions & 0 deletions controllers/storagecluster/ocs_operator_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func (r *StorageClusterReconciler) ensureOCSOperatorConfig(sc *ocsv1.StorageClus
util.ClusterNameKey: util.GetClusterID(r.ctx, r.Client, &r.Log),
util.EnableReadAffinityKey: strconv.FormatBool(!sc.Spec.ExternalStorage.Enable),
util.CephFSKernelMountOptionsKey: getCephFSKernelMountOptions(sc),
util.EnableNFSKey: getEnableNFSVal(sc),
}

cm := &corev1.ConfigMap{
Expand Down Expand Up @@ -80,3 +81,11 @@ func getCephFSKernelMountOptions(sc *ocsv1.StorageCluster) string {
// so we need to set the mount options to prefer-crc
return "ms_mode=prefer-crc"
}

// getEnableNFSVal returns the value of enableNFS based on the spec on the StorageCluster
func getEnableNFSVal(sc *ocsv1.StorageCluster) string {
if sc.Spec.NFS != nil && sc.Spec.NFS.Enable {
return "true"
}
return "false"
}
1 change: 1 addition & 0 deletions controllers/util/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const (
ClusterNameKey = "CSI_CLUSTER_NAME"
EnableReadAffinityKey = "CSI_ENABLE_READ_AFFINITY"
CephFSKernelMountOptionsKey = "CSI_CEPHFS_KERNEL_MOUNT_OPTIONS"
EnableNFSKey = "ROOK_CSI_ENABLE_NFS"
)

// GetWatchNamespace returns the namespace the operator should be watching for changes
Expand Down
11 changes: 11 additions & 0 deletions tools/csv-merger/csv-merger.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,17 @@ func unmarshalCSV(filePath string) *csvv1.ClusterServiceVersion {
},
},
},
{
Name: "ROOK_CSI_ENABLE_NFS",
ValueFrom: &corev1.EnvVarSource{
ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: "ocs-operator-config",
},
Key: "ROOK_CSI_ENABLE_NFS",
},
},
},
{
Name: "CSI_PROVISIONER_TOLERATIONS",
Value: `
Expand Down

0 comments on commit 319c561

Please sign in to comment.