fix(macos-container): mount live egress routes dir
This commit is contained in:
@@ -12,7 +12,7 @@ import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from ...bottle_state import egress_state_dir, read_metadata
|
||||
from ...egress import EGRESS_ROUTES_IN_CONTAINER
|
||||
from ...egress import EGRESS_ROUTES_FILENAME, EGRESS_ROUTES_IN_CONTAINER
|
||||
from ...egress_addon_core import load_routes
|
||||
from ...log import warn
|
||||
from .sidecar_bundle import sidecar_bundle_container_name
|
||||
@@ -58,7 +58,12 @@ def validate_routes_content(content: str) -> None:
|
||||
|
||||
|
||||
def _routes_path(slug: str) -> Path:
|
||||
return egress_state_dir(slug) / "egress_routes.yaml"
|
||||
state_dir = egress_state_dir(slug)
|
||||
routes_path = state_dir / EGRESS_ROUTES_FILENAME
|
||||
legacy_path = state_dir / "egress_routes.yaml"
|
||||
if legacy_path.exists() and not routes_path.exists():
|
||||
return legacy_path
|
||||
return routes_path
|
||||
|
||||
|
||||
def _signal_bundle_reload(slug: str) -> None:
|
||||
|
||||
@@ -363,8 +363,8 @@ def _sidecar_mounts(
|
||||
))
|
||||
if ep.routes:
|
||||
mounts.append((
|
||||
str(ep.routes_path),
|
||||
EGRESS_ROUTES_IN_CONTAINER,
|
||||
str(ep.routes_path.parent),
|
||||
str(Path(EGRESS_ROUTES_IN_CONTAINER).parent),
|
||||
True,
|
||||
))
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ CODEX_HOST_CREDENTIAL_TOKEN_REF = "BOT_BOTTLE_CODEX_HOST_ACCESS_TOKEN"
|
||||
EGRESS_HOSTNAME = "egress"
|
||||
|
||||
EGRESS_ROUTES_IN_CONTAINER = "/etc/egress/routes.yaml"
|
||||
EGRESS_ROUTES_FILENAME = Path(EGRESS_ROUTES_IN_CONTAINER).name
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -295,7 +296,7 @@ class Egress(ABC):
|
||||
) -> EgressPlan:
|
||||
routes = egress_routes_for_bottle(bottle, provider_routes)
|
||||
log = bottle.egress.Log
|
||||
routes_path = stage_dir / "egress_routes.yaml"
|
||||
routes_path = stage_dir / EGRESS_ROUTES_FILENAME
|
||||
routes_path.write_text(egress_render_routes(routes, log=log))
|
||||
routes_path.chmod(0o600)
|
||||
return EgressPlan(
|
||||
@@ -309,6 +310,7 @@ class Egress(ABC):
|
||||
__all__ = [
|
||||
"CODEX_HOST_CREDENTIAL_TOKEN_REF",
|
||||
"EGRESS_HOSTNAME",
|
||||
"EGRESS_ROUTES_FILENAME",
|
||||
"EGRESS_ROUTES_IN_CONTAINER",
|
||||
"Egress",
|
||||
"EgressPlan",
|
||||
|
||||
Reference in New Issue
Block a user