mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
docs(ecs): document task-role credentials configuration (#4500)
The wiring landed in #4486 but none of the four FLOCI_SERVICES_ECS_TASK_ROLE_CREDENTIALS_* settings were written down anywhere, and nothing said the credentials proxy needs a user-defined Docker network rather than the default bridge. Adds them to the environment variable reference, the application.yml example and the ECS service page, the last with a short section on how the endpoint is reached and the two cases where a task does not get credentials: one that sets its own, and one under security-group enforcement. Also fixes two things the same work left behind in the source. The cleanupProtectedNetwork javadoc was orphaned when prepareTaskRoleCredentials was inserted between it and its method, and two config javadocs still described the wiring and the proxy as follow-up work.
This commit is contained in:
1 parent
4faa2b1354
commit
81e646b86d
7 files changed
+82
-18
No files matched your search
@@ -2066,9 +2066,9 @@ public interface EmulatorConfig {
|
||||
interface EcsTaskRoleCredentialsConfig {
|
||||
/**
|
||||
* Opt-in: vends real task-role credentials over the AWS container-credentials wire
|
||||
* contract. Off by default: reaching it from a task container needs a Docker network the
|
||||
* task and Floci both have real access to, which the follow-up wiring this feeds into
|
||||
* establishes; this alone has no way to satisfy it.
|
||||
* contract. Off by default: reaching it from a task container needs a user-defined Docker
|
||||
* network that both the task and the credentials proxy join, so the default bridge is not
|
||||
* enough. Set {@code floci.services.ecs.docker-network} alongside this.
|
||||
*/
|
||||
@WithDefault("false")
|
||||
boolean enabled();
|
||||
@@ -2084,10 +2084,10 @@ public interface EmulatorConfig {
|
||||
/**
|
||||
* Port on the Floci host serving the credentials endpoint itself. Not the address a task
|
||||
* container talks to: real ECS SDKs hardcode 169.254.170.2, which nothing in Floci's own
|
||||
* process can bind without also owning that address on the task's Docker network. A
|
||||
* follow-up piece launches a small proxy container that holds that address and forwards
|
||||
* to this port, the same way Lambda and ECS containers already reach Floci's other
|
||||
* endpoints over {@code host.docker.internal}.
|
||||
* process can bind without also owning that address on the task's Docker network. A small
|
||||
* proxy container holds that address on each task network and forwards to this port, the
|
||||
* same way Lambda and ECS containers already reach Floci's other endpoints over
|
||||
* {@code host.docker.internal}.
|
||||
*/
|
||||
@WithDefault("51679")
|
||||
int port();
|
||||
|
||||
+5
-5
@@ -1528,11 +1528,6 @@ public class EcsContainerManager {
|
||||
}
|
||||
return "127.0.0.1";
|
||||
}
|
||||
/**
|
||||
* Tears down the firewall registration of a protected task. The ENI itself outlives this:
|
||||
* it belongs to the task, not to its containers, and {@link #releaseTaskNetwork} frees it when
|
||||
* the task reaches STOPPED.
|
||||
*/
|
||||
/**
|
||||
* Issues the task's role credentials and makes sure the endpoint that serves them is up,
|
||||
* before any of its containers start.
|
||||
@@ -1629,6 +1624,11 @@ public class EcsContainerManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the firewall registration of a protected task. The ENI itself outlives this:
|
||||
* it belongs to the task, not to its containers, and {@link #releaseTaskNetwork} frees it when
|
||||
* the task reaches STOPPED.
|
||||
*/
|
||||
private void cleanupProtectedNetwork(EcsTaskHandle handle) {
|
||||
if (firewallManager != null && handle.getNetworkInterfaceId() != null) {
|
||||
firewallManager.unregister(handle.getNetworkInterfaceId());
|
||||
|
||||
+4
-4
@@ -26,10 +26,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
/**
|
||||
* Owns the small proxy container, one per Docker network, that holds the ECS container-credentials
|
||||
* address (169.254.170.2) and forwards to {@link EcsTaskRoleCredentialsServer}. A task container
|
||||
* needs its own address in 169.254.0.0/16 to reach this proxy at all (see the follow-up wiring
|
||||
* that gives it one): without a connected route for that range, the kernel routes toward the
|
||||
* default gateway instead of resolving the peer directly, and the connection is refused before it
|
||||
* reaches this proxy's socket.
|
||||
* needs its own address in 169.254.0.0/16 to reach this proxy at all, which
|
||||
* {@code EcsTaskLinkLocalAddresses} hands out: without a connected route for that range, the
|
||||
* kernel routes toward the default gateway instead of resolving the peer directly, and the
|
||||
* connection is refused before it reaches this proxy's socket.
|
||||
*
|
||||
* <p>Docker accepts a link-local address request even on a runtime that then does not honour it
|
||||
* (see the review discussion on #4063), so a bind is never trusted from the API call alone: after
|
||||
|
||||
+2
-2
@@ -26,8 +26,8 @@ import java.util.concurrent.CompletableFuture;
|
||||
* <p>Bound to a normal Floci-host port, not to 169.254.170.2: the AWS SDK hardcodes that address
|
||||
* (it is not configurable, unlike EC2's {@code AWS_EC2_METADATA_SERVICE_ENDPOINT}), and nothing in
|
||||
* Floci's own process can bind an address it does not otherwise own on a task's Docker network.
|
||||
* A follow-up piece is what actually holds 169.254.170.2, one small proxy container per ECS
|
||||
* network, forwarding here over {@code host.docker.internal}.
|
||||
* {@link EcsCredentialsProxy} is what actually holds 169.254.170.2, one small proxy container per
|
||||
* ECS network, forwarding here over {@code host.docker.internal}.
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class EcsTaskRoleCredentialsServer {
|
||||
|
||||
Reference in new issue
Block a user