Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/proxy_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ def sidecar_kwargs(name: str, slug: str, proxy_id: int | None, network: str | No
"name": name,
"labels": labels,
"network": network,
# The isolated bridge's resolvers, as every earner on it gets them: its
# rules refuse the daemon's LAN resolver. None on the default bridge.
"dns": orchestrator.container_dns(network),
Comment thread
GeiserX marked this conversation as resolved.
Resolved
"hostname": hostname,
"cap_drop": ["ALL"],
"cap_add": ["NET_ADMIN"],
Expand Down
9 changes: 9 additions & 0 deletions tests/test_proxy_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ def test_hardening(self):
assert "environment" not in kw and "command" not in kw
assert kw["log_config"] == {"type": "json-file", "config": {"max-size": "1m", "max-file": "2"}}

def test_a_tunnel_on_the_isolated_bridge_gets_its_resolvers(self):
# The bridge's rules refuse the daemon's LAN resolver, so the tunnel
# needs the same resolvers every earner on it gets (container_dns).
with patch.dict(os.environ, {"CASHPILOT_TUNNEL_IMAGE": "drumsergio/cashpilot-tunnel:1.64.0"}):
fenced = proxy_tunnel.sidecar_kwargs("cashpilot-tunnel-x-p1", "x", 1, "cp-isolated", "x-p1")
plain = proxy_tunnel.sidecar_kwargs("cashpilot-tunnel-x-p1", "x", 1, None, "x-p1")
assert fenced["dns"] == orchestrator.container_dns("cp-isolated") == ["1.1.1.1", "9.9.9.9"]
assert plain["dns"] is None
Comment thread
GeiserX marked this conversation as resolved.
Resolved

def test_secret_goes_only_into_the_archive(self):
client = MagicMock()
created = MagicMock(id="sidecar-id", status="running")
Expand Down
Loading