Skip to main content

Module dataplane

Module dataplane 

Source
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 awsvpc container 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§

InstanceResolver
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 loopback host_port.
register_target
Record that target_id:port in account_id is served at endpoint.
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_id in account_id.

Type Aliases§

ResolveFuture
Future returned by an InstanceResolver.