How mongodb/mongodb-kubernetes-operator works
This is the MongoDB Community Kubernetes Operator. A cluster user declares a MongoDBCommunity resource; the operator reconciles it into Kubernetes workloads and services, while coordinating replica-set configuration and reporting status. Documented capabilities include version changes and scaling, SCRAM users and custom roles, TLS, and Prometheus metrics. The graph uses sampled controller and workload-construction references for internal links; README-only feature links are identified by their evidence path.
Main entry points: replica_set_controller.go Replica-set reconciler · mongodbstatefulset.go StatefulSet construction · authentication.go Authentication dispatch · prometheus.go Prometheus metrics
Components 20
Operator control plane
- MongoDBCommunity resource
api/v1/mongodbcommunity_types.go - Operator manager
cmd/manager/main.go - Replica-set reconciler
controllers/replica_set_controller.go - Spec validation
controllers/validation/validation.go - Status reporting
controllers/mongodb_status_options.go - Resource cleanup
controllers/mongodb_cleanup.go
MongoDB workloads
- StatefulSet construction
controllers/construct/mongodbstatefulset.go - Kubernetes API
- MongoDB replica set
- Version-change hook
cmd/versionhook/main.go
Security and identity
- Authentication dispatch
pkg/authentication/authentication.go - SCRAM authentication
pkg/authentication/scram/scram.go - X.509 authentication
pkg/authentication/x509/x509.go - TLS management
controllers/mongodb_tls.go - Database users
controllers/mongodb_users.go
Runtime support
- Readiness probe
cmd/readiness/main.go - Automation configuration
pkg/automationconfig/automation_config.go - MongoDB agent
pkg/agent/replica_set_port_manager.go - Prometheus metrics
controllers/prometheus.go
Other components
- Cluster user
Connections 24
- Cluster user → MongoDBCommunity resource: declares
README.md - Operator manager → Replica-set reconciler: starts reconciliation
cmd/manager/main.go - Replica-set reconciler → MongoDBCommunity resource: reads and reconciles
controllers/replica_set_controller.go - Replica-set reconciler → Spec validation: validates spec
controllers/replica_set_controller.go - Replica-set reconciler → StatefulSet construction: builds workloads
controllers/replica_set_controller.go - StatefulSet construction → Automation configuration: configures agent
controllers/construct/mongodbstatefulset.go - Replica-set reconciler → Kubernetes API: creates resources
controllers/replica_set_controller.go - Replica-set reconciler → MongoDB replica set: deploys and scales
README.md - Replica-set reconciler → Status reporting: updates status
controllers/replica_set_controller.go - Replica-set reconciler → Resource cleanup: cleans resources
- MongoDB replica set → Version-change hook: runs during upgrades
README.md - StatefulSet construction → Readiness probe: adds probe
controllers/construct/mongodbstatefulset.go - MongoDB replica set → Readiness probe: reports readiness
- Replica-set reconciler → MongoDB agent: coordinates agent
controllers/replica_set_controller.go - Replica-set reconciler → Authentication dispatch: configures authentication
controllers/replica_set_controller.go - Authentication dispatch → SCRAM authentication: enables SCRAM
pkg/authentication/authentication.go - Authentication dispatch → X.509 authentication: enables X.509
pkg/authentication/authentication.go - Replica-set reconciler → TLS management: reconciles TLS
controllers/replica_set_controller.go - MongoDB replica set → TLS management: uses TLS connections
README.md - Replica-set reconciler → Database users: manages users
README.md - MongoDB replica set → Database users: authenticates users
README.md - Replica-set reconciler → Prometheus metrics: configures metrics
controllers/replica_set_controller.go - Prometheus metrics → MongoDB replica set: exposes metrics
README.md - Replica-set reconciler → Automation configuration: generates configuration
controllers/replica_set_controller.go