mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
On Fargate the containers of an awsvpc task share one network namespace and reach each other on localhost. Floci gave each container a namespace of its own unless security-group enforcement was on, and enforcement needs rootful Docker, so a sidecar task definition (nginx in front of php-fpm on 127.0.0.1:9000) could not run unchanged on rootless Docker or Podman. floci.services.ecs.shared-task-network (FLOCI_SERVICES_ECS_SHARED_TASK_NETWORK), off by default, gives such a task one namespace while enforcement is off. A helper container holds it, as the ECS agent's pause container does. The firewall manager starts it from the same code as a protected helper, with no nftables table and no rootful requirement, and every container in the task joins it. The helper holds what the task has once rather than per container: its published ports, the link-local address its containers reach the task-role credential endpoint from, and its ENI address on the VPC's Docker network. FireLens's FLUENT_HOST is 127.0.0.1, the value the ECS agent sets for awsvpc. The helper is removed once the task's containers are, before its link-local address is handed on, and a helper a previous run left behind is swept at startup with the task's other containers. A helper Docker keeps is marked pending on the task's handle, which the service keeps to retry the removal; its address stays reserved until then, and it is taken off the VPC network so the ENI address is free when the ENI is released. Launch cleanup removes a helper by name even when its start failed part way, and now also covers the VPC attachment, so a failed attachment no longer leaves the task's containers running. With enforcement on, nothing changes. The helper image now builds from docker.io/library/alpine: Podman refuses a short name it cannot prompt about, and the task-role credentials proxy builds from the same Dockerfile. Closes #4331