If we deploy the mongoDB charm as a replica set and then change the role to config-server, the config-changed event fails
If we change the role to an invalid value it goes to blocked status.
Steps to reproduce
juju deploy mongodb-k8s --config role=replication --channel=8/edge
juju config mongodb-k8s role=config-server
Expected behavior
The charm goes into a blocked status. When we set the original role, the status goes back to active.
Actual behavior
config-changed event fails
Versions
Operating system: 26.04 on multipass
Juju CLI:
Juju agent: 3.6.21
Charm revision: 197 (8/edge) -- I only tested on mongodb-k8s
Microk8s 1.35
Log output
Juju debug log:
unit-mongodb-k8s-0: 16:29:06 ERROR unit.mongodb-k8s/0.juju-log single_kernel_mongo.managers.mongodb_operator:cluster migration currently not supported, cannot change from replication to config-server
unit-mongodb-k8s-0: 16:29:06 ERROR unit.mongodb-k8s/0.juju-log root:Uncaught exception while in charm code:
Traceback (most recent call last):
File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/src/charm.py", line 36, in <module>
main(MongoDBK8sCharm)
File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/lib/python3.12/site-packages/ops/main.py", line 39, in main
return _main.main(charm_class=charm_class, use_juju_for_storage=use_juju_for_storage)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/lib/python3.12/site-packages/ops/_main.py", line 507, in main
manager.run()
File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/lib/python3.12/site-packages/ops/_main.py", line 491, in run
self._emit()
File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/lib/python3.12/site-packages/ops/_main.py", line 426, in _emit
self._emit_charm_event(self.dispatcher.event_name)
File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/lib/python3.12/site-packages/ops/_main.py", line 470, in _emit_charm_event
event_to_emit.emit(*args, **kwargs)
File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/lib/python3.12/site-packages/ops/framework.py", line 337, in emit
framework._emit(event)
File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/lib/python3.12/site-packages/ops/framework.py", line 910, in _emit
self._reemit(event_path)
File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/lib/python3.12/site-packages/ops/framework.py", line 1028, in _reemit
custom_handler(event)
File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/lib/python3.12/site-packages/single_kernel_mongo/events/lifecycle.py", line 195, in on_config_changed
self.dependent.update_config_and_restart()
File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/lib/python3.12/site-packages/single_kernel_mongo/managers/mongodb_operator.py", line 705, in update_config_and_restart
raise ShardingMigrationError(
single_kernel_mongo.exceptions.ShardingMigrationError: Migration of sharding components not permitted, revert config role to replication
unit-mongodb-k8s-0: 16:29:07 ERROR juju.worker.uniter.operation hook "config-changed" (via hook dispatching script: dispatch) failed: exit status 1
unit-mongodb-k8s-0: 16:29:07 INFO juju.worker.uniter awaiting error resolution for "config-changed" hook
Additional context
If we deploy the mongoDB charm as a replica set and then change the role to config-server, the
config-changedevent failsIf we change the role to an invalid value it goes to blocked status.
Steps to reproduce
Expected behavior
The charm goes into a blocked status. When we set the original role, the status goes back to active.
Actual behavior
config-changedevent failsVersions
Operating system: 26.04 on multipass
Juju CLI:
Juju agent: 3.6.21
Charm revision: 197 (8/edge) -- I only tested on mongodb-k8s
Microk8s 1.35
Log output
Juju debug log:
Additional context