You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CLOUDP-317886 - block removing cluster from MC Sharded deployment (#495)
# Summary
During investigation of https://jira.mongodb.org/browse/CLOUDP-317886 we
have found that the operator panics, when the cluster is removed from
`clusterSpecList`. Initially we thought about allowing to do that, but
later on I have discussed the issue with @lsierant and the better
approach was chosen:
- when the user wants to remove cluster that already has 0 members, we
allow this
- when the user wants to remove cluster that has more than 0 members, we
block this, because it can lead to unexpected issues. This is described
in the code comment:
https://github.com/mongodb/mongodb-kubernetes/blob/31c346ee4770c3caabb620f3e7ad3f38ebdc4d3c/controllers/operator/mongodbshardedcluster_controller.go#L840-L846
...and in the changelog:
**MultiClusterSharded**: Block removing non-zero member cluster from
MongoDB resource. This prevents from scaling down member cluster without
current configuration available, which can lead to unexpected issues.
Previously operator was crashing in that scenario, after the fix it will
mark reconciliation as `Failed` with appropriate message. Example unsafe
scenario that is now blocked:
* User has 2 member clusters: `main` is used for application traffic,
`read-analytics` is used for read-only analytics
* `main` cluster has 7 voting members
* `read-analytics` cluster has 3 non-voting members
* User decides to remove `read-analytics` cluster, by removing the
`clusterSpecItem` completely
* Operator scales down members from `read-analytics` cluster one by one
* Because the configuration does not have voting options specified
anymore and by default `priority` is set to 1, the operator will remove
one member, but the other two members will be reconfigured as voting
members
* `replicaset` contains now 9 voting members, which is not [supported by
MongoDB](https://www.mongodb.com/docs/manual/reference/limits/#mongodb-limit-Number-of-Voting-Members-of-a-Replica-Set)
## Proof of Work
Passing CI + new unit tests for `blockNonEmptyClusterSpecItemRemoval`
function.
## Checklist
- [x] Have you linked a jira ticket and/or is the ticket in the title?
- [x] Have you checked whether your jira ticket required DOCSP changes?
- [x] Have you added changelog file?
- use `skip-changelog` label if not needed
- refer to [Changelog files and Release
Notes](https://github.com/mongodb/mongodb-kubernetes/blob/master/CONTRIBUTING.md#changelog-files-and-release-notes)
section in CONTRIBUTING.md for more details
---------
Co-authored-by: Vivek Singh <vsingh.ggits.2010@gmail.com>
***MultiClusterSharded**: Blocked removing non-zero member cluster from MongoDB resource. This prevents from scaling down member cluster without current configuration available, which could lead to unexpected issues.
0 commit comments