Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: disallow multiple clusters in the same namespace #9457

Merged
merged 2 commits into from Dec 20, 2021

Conversation

leseb
Copy link
Member

@leseb leseb commented Dec 17, 2021

Description of your changes:

Rook does not support running multiple clusters in the same namespace,
so the operator should not reconcile if a new cluster is added.
The scenario where a cluster is added while the operator is down is also
handled. CR updates are also handled.
When the operator detects more than one cluster it will refuse to
reconcile the CephCluster, and child CRDs will block too until the
operator is ready.
The user must remove one of the clusters before can continue to perform
any reconcile.

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

Which issue is resolved by this Pull Request:
Resolves #9452

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.
  • Skip Unrelated Tests: Add a flag to run tests for a specific storage provider. See test options.
  • 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.

Let's use debug not to clutter logs.

Signed-off-by: Sébastien Han <seb@redhat.com>
Rook does not support running multiple clusters in the same namespace,
so the operator should not reconcile if a new cluster is added.
The scenario where a cluster is added while the operator is down is also
handled. CR updates are also handled.
When the operator detects more than one cluster it will refuse to
reconcile the CephCluster, and child CRDs will block too until the
operator is ready.
The user must remove one of the clusters before can continue to perform
any reconcile.

Closes: rook#9452
Signed-off-by: Sébastien Han <seb@redhat.com>
@@ -41,6 +44,10 @@ func predicateController() predicate.Funcs {

// If a Ceph Cluster is created we want to reconcile the csi driver
if cephCluster, ok := e.Object.(*cephv1.CephCluster); ok {
// If there are more than one ceph cluster in the same namespace do not reconcile
if controller.DuplicateCephClusters(ctx, c, e.Object, false) {
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 really need to skip reconcile in the csi and obc controllers in this case? It's a rare enough error that it doesn't seem necessary to check here and just keep these other controllers simple.

Copy link
Member Author

Choose a reason for hiding this comment

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

If we don't check, the logs will be a bit cluttered and users might skip the useful information. CSI and OBC controllers will reconcile and hide the message:

2021-12-17 09:27:02.826962 E | ceph-spec: found more than one ceph cluster in namespace "rook-ceph". not reconciling. only one ceph cluster per namespace.
2021-12-17 09:27:02.826989 E | ceph-spec: found ceph cluster "lesebb" in namespace "rook-ceph"
2021-12-17 09:27:02.826994 E | ceph-spec: found ceph cluster "rook-ceph" in namespace "rook-ceph"

@leseb leseb requested a review from travisn December 20, 2021 09:22
@leseb leseb merged commit fffb862 into rook:master Dec 20, 2021
@leseb leseb deleted the fix-9452 branch December 20, 2021 16:18
mergify bot added a commit that referenced this pull request Dec 20, 2021
core: disallow multiple clusters in the same namespace (backport #9457)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple clusters in the same namespace should be prevented
2 participants