diff --git a/deploy/examples/nfs-test.yaml b/deploy/examples/nfs-test.yaml index 58fdae338..87b2433ee 100644 --- a/deploy/examples/nfs-test.yaml +++ b/deploy/examples/nfs-test.yaml @@ -22,7 +22,7 @@ metadata: namespace: rook-ceph # namespace:cluster spec: name: .nfs - failureDomain: host + failureDomain: osd replicated: size: 1 requireSafeReplicaSize: false diff --git a/deploy/examples/nfs.yaml b/deploy/examples/nfs.yaml index b3cdfb083..bad0e3297 100644 --- a/deploy/examples/nfs.yaml +++ b/deploy/examples/nfs.yaml @@ -55,17 +55,21 @@ spec: #priorityClassName: # The logging levels: NIV_NULL | NIV_FATAL | NIV_MAJ | NIV_CRIT | NIV_WARN | NIV_EVENT | NIV_INFO | NIV_DEBUG | NIV_MID_DEBUG |NIV_FULL_DEBUG |NB_LOG_LEVEL logLevel: NIV_INFO ---- -apiVersion: ceph.rook.io/v1 -kind: CephBlockPool -metadata: - name: builtin-nfs - namespace: rook-ceph # namespace:cluster -spec: - # The required pool name ".nfs" cannot be specified as a K8s resource name, thus we override - # the pool name created in Ceph with this name property - name: .nfs - failureDomain: host - replicated: - size: 3 - requireSafeReplicaSize: true +# --- +# # The built-in Ceph pool ".nfs" is used for storing configuration for all CephNFS clusters. If this +# # shared pool needs to be configured with alternate settings, create this pool (once) with any of +# # the pool properties. Create this pool before creating any CephNFSes, or else some properties may +# # not be applied when the pool is created by default. This pool must be replicated. +# apiVersion: ceph.rook.io/v1 +# kind: CephBlockPool +# metadata: +# name: builtin-nfs +# namespace: rook-ceph # namespace:cluster +# spec: +# # The required pool name ".nfs" cannot be specified as a K8s resource name, thus we override +# # the pool name created in Ceph with this name property +# name: .nfs +# failureDomain: host +# replicated: +# size: 3 +# requireSafeReplicaSize: true diff --git a/pkg/operator/ceph/nfs/controller_test.go b/pkg/operator/ceph/nfs/controller_test.go index a49c56a40..9021e914c 100644 --- a/pkg/operator/ceph/nfs/controller_test.go +++ b/pkg/operator/ceph/nfs/controller_test.go @@ -88,7 +88,7 @@ func TestCephNFSController(t *testing.T) { if args[0] == "auth" && args[1] == "get-or-create-key" { return nfsCephAuthGetOrCreateKey, nil } - if args[0] == "osd" && args[1] == "pool" && args[2] == "get" { + if args[0] == "osd" && args[1] == "pool" && args[2] == "create" { return "", nil } if args[0] == "osd" && args[1] == "crush" && args[2] == "rule" { diff --git a/pkg/operator/ceph/nfs/nfs.go b/pkg/operator/ceph/nfs/nfs.go index f7b999f13..3b1635e13 100644 --- a/pkg/operator/ceph/nfs/nfs.go +++ b/pkg/operator/ceph/nfs/nfs.go @@ -303,12 +303,13 @@ func (r *ReconcileCephNFS) configureNFSPool(n *cephv1.CephNFS) error { poolName := n.Spec.RADOS.Pool logger.Infof("configuring pool %q for nfs", poolName) - _, err := cephclient.GetPoolDetails(r.context, r.clusterInfo, poolName) + args := []string{"osd", "pool", "create", poolName} + output, err := cephclient.NewCephCommand(r.context, r.clusterInfo, args).Run() if err != nil { - return errors.Wrapf(err, "pool %q could not be retrieved, ensure the pool is defined with a CephBlockPool", poolName) + return errors.Wrapf(err, "failed to create default NFS pool %q. %s", poolName, string(output)) } - args := []string{"osd", "pool", "application", "enable", poolName, "nfs", "--yes-i-really-mean-it"} + args = []string{"osd", "pool", "application", "enable", poolName, "nfs", "--yes-i-really-mean-it"} _, err = cephclient.NewCephCommand(r.context, r.clusterInfo, args).Run() if err != nil { return errors.Wrapf(err, "failed to enable application 'nfs' on pool %q", poolName)