Skip to content

Commit

Permalink
Merge pull request rook#10054 from BlaineEXE/nfs-create-config-pool-a…
Browse files Browse the repository at this point in the history
…utomatically

nfs: create config pool automatically
  • Loading branch information
BlaineEXE authored Apr 12, 2022
2 parents 8ea14f7 + 254a7ad commit 5470d9c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion deploy/examples/nfs-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ metadata:
namespace: rook-ceph # namespace:cluster
spec:
name: .nfs
failureDomain: host
failureDomain: osd
replicated:
size: 1
requireSafeReplicaSize: false
32 changes: 18 additions & 14 deletions deploy/examples/nfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion pkg/operator/ceph/nfs/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
7 changes: 4 additions & 3 deletions pkg/operator/ceph/nfs/nfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5470d9c

Please sign in to comment.