Skip to content

ceph: add cephfs mirroring support#7062

Merged
travisn merged 1 commit intorook:masterfrom
leseb:cephfs-mirror
Jan 29, 2021
Merged

ceph: add cephfs mirroring support#7062
travisn merged 1 commit intorook:masterfrom
leseb:cephfs-mirror

Conversation

@leseb
Copy link
Member

@leseb leseb commented Jan 25, 2021

Description of your changes:

With Ceph Pacific, Rook can now deploy the cephfs-mirror daemon.
This initial commit covers the deployment of a single daemon only.
Multiple mirror daemons is currently untested.
Only a single mirror daemon is recommended.

The configuration of peers will come in a later PR since the mgr module
is still pending upstream: ceph/ceph#39050

The same goes for integration tests, they will get added later once we
start testing on Pacific.

Closes: #7002
Signed-off-by: Sébastien Han seb@redhat.com

Which issue is resolved by this Pull Request:
Resolves #

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the developer guide.
  • Skip Tests for Docs: Add the flag for skipping the build if this is only a documentation change. See here for the flag.
  • [ ]
  • ceph: add cephfs mirroring supportSkip Unrelated Tests: Add a flag to run tests for a specific storage provider. See [test options]
  • (https://github.com/rook/rook/blob/master/INSTALL.md#test-storage-provider).
  • Reviewed the developer guide on Submitting a Pull Request
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.
  • Pending release notes updated with breaking and/or notable changes, if necessary.
  • Upgrade from previous release is tested and upgrade user guide is updated, if necessary.
  • Code generation (make codegen) has been run to update object specifications, if necessary.

@mergify mergify bot added the ceph main ceph tag label Jan 25, 2021
@leseb leseb requested review from BlaineEXE and travisn January 25, 2021 09:25
@leseb leseb force-pushed the cephfs-mirror branch 10 times, most recently from a5ba3a8 to d82e932 Compare January 26, 2021 13:25
kubectl create -f cluster/examples/kubernetes/ceph/csi/cephfs/storageclass.yaml
```

## Mirroring
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have both the mirror.enabled flag and the CRD? I don't see why we need both.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CRD deploys the cephfs-mirror daemon, the CephFilesystem setting, turns on mirroring on that filesystem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this enable mirroring of complete filesystem by default? do we have an option to enable per subvolume not per filesystem like we do for RBD?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but just like rbd-mirroring must be first enabled on the pool and then per-image, we have to enable the mirroring on the fs and then we can do snapshot per-directory using subcommand like: ceph fs snapshot mirror add <fs> <path>.

@@ -0,0 +1,46 @@
---
title: FilesystemMirror CRD
weight: 3500
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This weight should put it after the rbd mirroring doc in the TOC

Suggested change
weight: 3500
weight: 3600


# Ceph FilesystemMirror CRD

Rook allows creation and updating fs-mirror daemon through the custom resource definitions (CRDs).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Rook allows creation and updating fs-mirror daemon through the custom resource definitions (CRDs).
Rook allows creation and updating the fs-mirror daemon through the custom resource definitions (CRDs).

metadata:
name: my-fs-mirror
namespace: rook-ceph
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there no settings like the number of mirroring daemons to start? Or is only a single daemon supported?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't add a count since the doc says: Multiple mirror daemons is currently untested. Only a single mirror daemon is recommended..
We can always add it later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to pass some tokens which contain remote information that the mirroring daemon will connect to?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this is coming in another PR, I'm waiting for ceph/ceph#39050 to merge so I can start the implementation.

# - key: role
# operator: In
# values:
# - rgw-node
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# - rgw-node
# - cephfs-mirror

}

// Enable mirroring if needed
if r.clusterInfo.CephVersion.IsAtLeastPacific() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be done by the new cephfs mirroring controller? I must be missing why we need the mirroring.enabled setting in the filesystem since we have the separate CRD.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CRD deploys the cephfs-mirror daemon, the CephFilesystem setting, turns on mirroring on that filesystem. So let's imagine we have multiple CephFilesystem deployed, we don't want all of them to be mirrored, that's why I'm basing the decision out of the CephFilesystem CRD and the CephFilesystemMirror CRD, which goal is to only deploy the cephfs-mirror at the moment. Later it will add/remove peers once available in Ceph.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything specific to this filesystem being enabled, I only see a merge module being enabled. Is there another setting coming that will be specific to the filesystem?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since enabling the module only needs to happen once for the entire cluster, this still seems like it belongs with the singleton mirroring CR instead of being enabled as a property on the filesystem. Why not enable the module with the mirroring CR, and get rid of the filesystem CR setting? With rbd mirroring there is a pool-specific setting so it makes sense to have the boolean on the pool CR. But if there is no filesystem-specific setting for mirroring, I don't see why a bool is needed on the filesystem CR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't see anything specific to the fs because I'm waiting for ceph/ceph#39050 to merge so I can turn on mirroring for the fs. Now, we just enable the mirroring module. Anyway, we will always need the fs setting to turn on mirroring.

Honestly, I have no preference, I can move this cephclient.MgrEnableModule to the CephFilesysteMirror CRD. Either way, we will have to enable it.

What do you think?

Hope that clarifies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, this is basically a placeholder for the per-filesystem setting that will come later.
Whether to enable the merge module sounds fine to keep here, as discussed it could go either here or with the mirroring CR.

Since Ceph Pacific, CephFS supports asynchronous replication of snapshots to a remote CephFS file system via cephfs-mirror tool. Snapshots are synchronized by mirroring snapshot data followed by creating a snapshot with the same name (for a given directory on the remote file system) as the snapshot being synchronized.
It is generally useful when planning for Disaster Recovery.
For clusters that are geographically distributed and stretching is not possible due to high latencies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you setup the peer? Still working on that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, just waiting for ceph/ceph#39050

kubectl create -f cluster/examples/kubernetes/ceph/csi/cephfs/storageclass.yaml
```

## Mirroring
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this enable mirroring of complete filesystem by default? do we have an option to enable per subvolume not per filesystem like we do for RBD?

# Ceph FilesystemMirror CRD

Rook allows creation and updating fs-mirror daemon through the custom resource definitions (CRDs).
CephFS images can be asynchronously mirrored between two Ceph clusters.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CephFS images or filesystem or even subvolumes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should remove this line, only the following sentences are relevant.

metadata:
name: my-fs-mirror
namespace: rook-ceph
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to pass some tokens which contain remote information that the mirroring daemon will connect to?

@leseb leseb requested a review from travisn January 27, 2021 09:46
@mergify
Copy link

mergify bot commented Jan 28, 2021

This pull request has merge conflicts that must be resolved before it can be merged. @leseb please rebase it. https://rook.io/docs/rook/master/development-flow.html#updating-your-fork

With Ceph Pacific, Rook can now deploy the cephfs-mirror daemon.
This initial commit covers the deployment of a single daemon only.
Multiple mirror daemons is currently untested.
Only a single mirror daemon is recommended.

The configuration of peers will come in a later PR since the mgr module
is still pending upstream: ceph/ceph#39050

The same goes for integration tests, they will get added later once we
start testing on Pacific.

Closes: rook#7002
Signed-off-by: Sébastien Han <seb@redhat.com>
return errors.Wrapf(err, "failed to get controller %q owner reference", filesystemMirror.Name)
}

daemonID := k8sutil.IndexToName(0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a single mirroring configuration is allowed per rook cluster, right? Do we need to prevent multiple mirroring CRs from being created? (similar to how we only allow a single CephCluster CR in a namespace)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a single mirroring configuration is allowed per rook cluster, right?

No, it's per filesystem.

Do we need to prevent multiple mirroring CRs from being created? (similar to how we only allow a single CephCluster CR in a namespace)

Not really since we support multiple fs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per discussion, agreed that only a single mirroring CR is supported, but no need for extra restrictions since we expect users to follow the docs and examples.

}

// Enable mirroring if needed
if r.clusterInfo.CephVersion.IsAtLeastPacific() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since enabling the module only needs to happen once for the entire cluster, this still seems like it belongs with the singleton mirroring CR instead of being enabled as a property on the filesystem. Why not enable the module with the mirroring CR, and get rid of the filesystem CR setting? With rbd mirroring there is a pool-specific setting so it makes sense to have the boolean on the pool CR. But if there is no filesystem-specific setting for mirroring, I don't see why a bool is needed on the filesystem CR.

}

// Enable mirroring if needed
if r.clusterInfo.CephVersion.IsAtLeastPacific() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, this is basically a placeholder for the per-filesystem setting that will come later.
Whether to enable the merge module sounds fine to keep here, as discussed it could go either here or with the mirroring CR.

return errors.Wrapf(err, "failed to get controller %q owner reference", filesystemMirror.Name)
}

daemonID := k8sutil.IndexToName(0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per discussion, agreed that only a single mirroring CR is supported, but no need for extra restrictions since we expect users to follow the docs and examples.

@travisn travisn merged commit 0a1bfe5 into rook:master Jan 29, 2021
@leseb leseb deleted the cephfs-mirror branch January 29, 2021 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ceph main ceph tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for CephFS mirroring deployment

3 participants