diff --git a/metadata.yaml b/metadata.yaml index 65abaa1..4306d66 100755 --- a/metadata.yaml +++ b/metadata.yaml @@ -25,7 +25,7 @@ storage: location: /data minimum-size: 10G requires: - ingress: + console-ingress: interface: ingress schema: https://raw.githubusercontent.com/canonical/operator-schemas/master/ingress.yaml versions: [v1] \ No newline at end of file diff --git a/src/charm.py b/src/charm.py index b9caca0..ad33c06 100755 --- a/src/charm.py +++ b/src/charm.py @@ -172,8 +172,8 @@ def _with_console_address(self, minio_args): return [*minio_args, "--console-address", ":" + console_port] def _configure_ingress(self, interfaces): - if interfaces["ingress"]: - interfaces["ingress"].send_data( + if interfaces["console-ingress"]: + interfaces["console-ingress"].send_data( { "prefix": "/", "rewrite": "/", @@ -181,14 +181,6 @@ def _configure_ingress(self, interfaces): "port": self.model.config["console-port"], } ) - interfaces["ingress"].send_data( - { - "prefix": "/", - "rewrite": "/", - "service": f"{self.model.app.name}", - "port": self.model.config["port"], - } - ) def _gen_pass() -> str: diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index dce302f..2ab6f00 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -340,7 +340,7 @@ def test_install_with_all_inputs(harness): ) # ingress - ingress_relation_name = "ingress" + ingress_relation_name = "console-ingress" relation_version_data = {"_supported_versions": "- v1"} ingress_rel_id = harness.add_relation( ingress_relation_name, f"{ingress_relation_name}-subscriber" @@ -368,3 +368,12 @@ def test_install_with_all_inputs(harness): "--console-address", ":9001", ] + data = yaml.safe_load(harness.get_relation_data(os_rel_id, "minio")["data"]) + assert data == { + "access-key": "test-access-key", + "namespace": None, + "port": 9000, + "secret-key": "test-secret-key", + "secure": False, + "service": "minio", + } \ No newline at end of file