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-359062 - add ownerrefs and only deleteAll in multicluster (#620)
# Summary
fixes: #589
This pull request introduces important improvements to how Kubernetes
resources are managed and cleaned up for MongoDB and Ops Manager
deployments, especially in multi-cluster versus single-cluster
scenarios. The main focus is on correctly setting owner references for
resources to enable automatic garbage collection by Kubernetes, and
ensuring explicit resource deletion only occurs when necessary (i.e., in
multi-cluster setups where owner references cannot span clusters).
**Owner Reference Management & Resource Cleanup**
* Added missing owner references (`ownerReferences`) to all relevant
ConfigMaps and resources for MongoDB and Ops Manager, ensuring proper
automatic cleanup by Kubernetes in single-cluster deployments.
* Refactored constructors and initialization logic across controllers
(`appdbreplicaset_controller.go`, `mongodbopsmanager_controller.go`,
`mongodbshardedcluster_controller.go`, `state_store.go`) to consistently
pass and set `ownerReferences`.
**Multi-Cluster vs Single-Cluster Resource Deletion Logic**
* Updated deletion logic in controllers so that explicit resource
deletion is only performed in multi-cluster deployments; single-cluster
setups now rely solely on owner references for cleanup.
## Proof of Work
- unit tests
- relying on kubernetes GC working properly
## 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
0 commit comments