Expand description
Where fakecloud actually connects for an AWS-visible data-plane address.
AWS reports addresses that only exist inside a VPC: an awsvpc ECS task is
an ENI private IP from its subnet, an EC2 target is an instance id. Locally
those addresses are not routable from fakecloud (Docker Desktop and podman
machine keep container IPs inside a VM, and a containerized fakecloud sits
on another network), so the runtimes publish the workload’s port on the
host and record here where it went. The ELBv2 data plane and health prober
keep the AWS-visible target id and port in every API response and consult
this module only to pick the socket to open.
Two sources feed it:
- static endpoints, registered by a runtime that already published the
port (ECS publishes each
awsvpccontainer port when the task starts); - an instance resolver, installed by the EC2 runtime, which can publish an arbitrary port of an instance on demand – an instance’s listening ports are only known once a target group names one.
A second, smaller registry maps a host-visible data-plane port to the port
sibling containers must use instead, for services whose protocol embeds the
address in its responses (a Kafka broker advertises its listener, so a
container needs a listener that advertises the host alias). The container
env rewriting in crate::container_net::rewrite_loopback_value applies
it.
Structs§
- Endpoint
- A socket address fakecloud can open: host (name or IP) and port.
Traits§
- Instance
Resolver - Publishes a port of an EC2 instance on demand and says where it landed.
Functions§
- account_
of_ arn - The account id in an ARN (
arn:<partition>:<service>:<region>:<account>:...). - container_
port_ for - The port sibling containers use for loopback
host_port, when a service registered a different one. - fallback_
host - Host for a target nothing registered: see
resolve_target. - register_
container_ port - Record that sibling containers must use
container_port(on the host alias) where host clients use loopbackhost_port. - register_
target - Record that
target_id:portinaccount_idis served atendpoint. - registered_
target - The static endpoint for
target_id:port, if a runtime registered one. - resolve_
target - The socket to open for an ELBv2 target. In order:
- set_
instance_ resolver - Install the EC2 instance resolver (one per process; a later call replaces the earlier one).
- unregister_
container_ port - Drop the container-view mapping of
host_port. - unregister_
target - Forget every endpoint of
target_idinaccount_id.
Type Aliases§
- Resolve
Future - Future returned by an
InstanceResolver.