diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 008b4434d..0972222a1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -70,7 +70,7 @@ juju add-model dev # Enable DEBUG logging juju model-config logging-config="=INFO;unit=DEBUG" # Deploy the charm -juju deploy ./mongodb-k8s_ubuntu-20.04-amd64.charm --resource mongodb-image=dataplatformoci/mongodb:5.0 --num-units=1 +juju deploy ./mongodb-k8s_ubuntu-22.04-amd64.charm --resource mongodb-image=dataplatformoci/mongodb:5.0 --num-units=1 ``` ## Canonical Contributor Agreement diff --git a/README.md b/README.md index b76115083..86f671180 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This operator charm deploys and operates MongoDB on Kubernetes. It offers featur - at least 2 CPU threads per host. - For production deployment: at least 60GB of available storage on each host. - Access to the internet for downloading the charm. -- Machine is running Ubuntu 20.04(focal) or later. +- Machine is running Ubuntu 22.04(jammy) or later. ## Config options auto-delete - `boolean`; When a relation is removed, auto-delete ensures that any relevant databases @@ -29,13 +29,12 @@ tls internal key - `string`; TLS external key for encryption inside the cluster ### Basic Usage To deploy a single unit of MongoDB using its default configuration ```shell -juju deploy ./mongodb-k8s_ubuntu-20.04-amd64.charm --resource mongodb-image=dataplatformoci/mongodb:5.0 +juju deploy ./mongodb-k8s_ubuntu-22.04-amd64.charm --resource mongodb-image=dataplatformoci/mongodb:5.0 ``` It is customary to use MongoDB with replication. Hence usually more than one unit (preferably an odd number to prohibit a "split-brain" scenario) is deployed. To deploy MongoDB with multiple replicas, specify the number of desired units with the `-n` option. ```shell -juju deploy ./mongodb-k8s_ubuntu-20.04-amd64.charm --resource mongodb-image=dataplatformoci/mongodb:5.0 - -n +juju deploy ./mongodb-k8s_ubuntu-22.04-amd64.charm --resource mongodb-image=dataplatformoci/mongodb:5.0 -n ``` ### Replication diff --git a/charmcraft.yaml b/charmcraft.yaml index 1b0aca5da..ab0ce517b 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -13,7 +13,7 @@ parts: bases: - build-on: - name: "ubuntu" - channel: "20.04" + channel: "22.04" run-on: - name: "ubuntu" - channel: "20.04" + channel: "22.04" diff --git a/lib/charms/mongodb/v0/mongodb_tls.py b/lib/charms/mongodb/v0/mongodb_tls.py index c197928c4..3bbc81556 100644 --- a/lib/charms/mongodb/v0/mongodb_tls.py +++ b/lib/charms/mongodb/v0/mongodb_tls.py @@ -247,7 +247,7 @@ def _get_sans(self) -> List[str]: return [ f"{self.charm.app.name}-{unit_id}", socket.getfqdn(), - f"{self.charm.app.name}-{unit_id}.{self.charm.app.name}-endpoints", + f"{self.charm.app.name}-{unit_id}.{self.charm.app.name}-endpoints", str(self.charm.model.get_binding(self.peer_relation).network.bind_address), ] diff --git a/tests/integration/ha_tests/application_charm/charmcraft.yaml b/tests/integration/ha_tests/application_charm/charmcraft.yaml index e109b8b2d..d37ba37ea 100644 --- a/tests/integration/ha_tests/application_charm/charmcraft.yaml +++ b/tests/integration/ha_tests/application_charm/charmcraft.yaml @@ -5,7 +5,7 @@ type: charm bases: - build-on: - name: "ubuntu" - channel: "20.04" + channel: "22.04" run-on: - name: "ubuntu" - channel: "20.04" + channel: "22.04" diff --git a/tests/integration/ha_tests/helpers.py b/tests/integration/ha_tests/helpers.py index a7b7ec57c..087b2873f 100644 --- a/tests/integration/ha_tests/helpers.py +++ b/tests/integration/ha_tests/helpers.py @@ -168,6 +168,7 @@ async def deploy_and_scale_mongodb( application_name=mongodb_application_name, resources=resources, num_units=num_units, + series="jammy", ) await ops_test.model.wait_for_idle( @@ -204,6 +205,7 @@ async def deploy_and_scale_application(ops_test: OpsTest) -> str: application_charm, application_name=APPLICATION_DEFAULT_APP_NAME, num_units=1, + series="jammy", ) await ops_test.model.wait_for_idle( diff --git a/tests/integration/test_charm.py b/tests/integration/test_charm.py index d07484648..13bc36ec1 100644 --- a/tests/integration/test_charm.py +++ b/tests/integration/test_charm.py @@ -37,7 +37,11 @@ async def test_build_and_deploy(ops_test: OpsTest): charm = await ops_test.build_charm(".") resources = {"mongodb-image": METADATA["resources"]["mongodb-image"]["upstream-source"]} await ops_test.model.deploy( - charm, resources=resources, application_name=APP_NAME, num_units=len(UNIT_IDS) + charm, + resources=resources, + application_name=APP_NAME, + num_units=len(UNIT_IDS), + series="jammy", ) # issuing dummy update_status just to trigger an event diff --git a/tests/integration/tls_tests/test_tls.py b/tests/integration/tls_tests/test_tls.py index 72d99af78..3e6abab53 100644 --- a/tests/integration/tls_tests/test_tls.py +++ b/tests/integration/tls_tests/test_tls.py @@ -27,11 +27,16 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None: async with ops_test.fast_forward(): my_charm = await ops_test.build_charm(".") resources = {"mongodb-image": METADATA["resources"]["mongodb-image"]["upstream-source"]} - await ops_test.model.deploy(my_charm, num_units=3, resources=resources) + await ops_test.model.deploy(my_charm, num_units=3, resources=resources, series="jammy") await ops_test.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active", timeout=2000) config = {"generate-self-signed-certificates": "true", "ca-common-name": "Test CA"} - await ops_test.model.deploy(TLS_CERTIFICATES_APP_NAME, channel="beta", config=config) + await ops_test.model.deploy( + TLS_CERTIFICATES_APP_NAME, + channel="beta", + config=config, + series="focal", + ) await ops_test.model.wait_for_idle( apps=[TLS_CERTIFICATES_APP_NAME], status="active", timeout=1000 ) diff --git a/tox.ini b/tox.ini index 956c41dc5..b4800b601 100644 --- a/tox.ini +++ b/tox.ini @@ -11,7 +11,7 @@ envlist = fmt, lint, unit src_path = {toxinidir}/src/ tst_path = {toxinidir}/tests/ lib_path = {toxinidir}/lib/charms/mongodb -all_path = {[vars]src_path} {[vars]tst_path} +all_path = {[vars]src_path} {[vars]tst_path} {[vars]lib_path} [testenv] whitelist_externals = poetry