From 84fa075b97422529770ca5876c177af4ef8bb47d Mon Sep 17 00:00:00 2001 From: Arturo Seijas Date: Wed, 4 Dec 2024 11:00:23 +0100 Subject: [PATCH] Fix Traefik configuration to allow for non TLS connections --- src/traefik_route_observer.py | 3 +-- tests/unit/test_traefik_route_observer.py | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/traefik_route_observer.py b/src/traefik_route_observer.py index 9d43b37d..9eaca133 100644 --- a/src/traefik_route_observer.py +++ b/src/traefik_route_observer.py @@ -82,8 +82,7 @@ def _ingress_config(self) -> dict[str, dict[str, dict[str, typing.Any]]]: routers[f"juju-{self.model.name}-{self.model.app.name}-{sanitized_protocol}"] = { "entryPoints": [sanitized_protocol], "service": service_name, - "rule": "HostSNI(`*`)", - "tls": {"passthrough": True}, + "rule": "ClientIP(`0.0.0.0/0`)", } services[service_name] = { "loadBalancer": {"servers": [{"address": f"{self.hostname}:{port}"}]} diff --git a/tests/unit/test_traefik_route_observer.py b/tests/unit/test_traefik_route_observer.py index 4e06f814..c4dc1b5e 100644 --- a/tests/unit/test_traefik_route_observer.py +++ b/tests/unit/test_traefik_route_observer.py @@ -59,14 +59,12 @@ def test_on_traefik_route_relation_joined_when_leader(monkeypatch: pytest.Monkey "juju-testing-observer-charm-conn-tcp": { "entryPoints": ["conn-tcp"], "service": "juju-testing-observer-charm-service-conn-tcp", - "rule": "HostSNI(`*`)", - "tls": {"passthrough": True}, + "rule": "ClientIP(`0.0.0.0/0`)", }, "juju-testing-observer-charm-enrole-tcp": { "entryPoints": ["enrole-tcp"], "service": "juju-testing-observer-charm-service-enrole-tcp", - "rule": "HostSNI(`*`)", - "tls": {"passthrough": True}, + "rule": "ClientIP(`0.0.0.0/0`)", }, }, "services": {