mirror of
https://github.com/floci-io/floci.git
synced 2026-11-30 00:45:17 -05:00
fix(ecr): advertise the registry at the published address (#4863)
ECR built repositoryUri, the GetAuthorizationToken proxyEndpoint and the Lambda and ECS image rewrites from floci.port, the port Floci listens on inside its own container. The Docker daemon performs login, push and pull, and reaches Floci through the host port that container publishes. When Floci ran as docker run -p 54321:4566, every advertised address named port 4566 on the host, where nothing answers, so docker login, CDK container asset publishing and ECS or Lambda image pulls failed. EcrRegistryManager now has advertisedPort(): the host port Floci's container publishes for floci.port, read through the existing CurrentContainerNetworkResolver.resolvePublishedPort as RDS does for its proxy endpoint, or floci.port when Floci is not in a container or the port is not published. repositoryUri (hostname and path style, plain and TLS URI mode), proxyEndpoint and rewriteImageUri all use it. The EKS registry mirror keys must match the URIs pods name, so they use the same advertised port. The mirror endpoint stays Floci's in-network address on floci.port. The resolver now caches every published-port answer, "not published" and a failed inspect included, as it already caches the network: a running container's port bindings cannot change, and an inspect that fails fails the same way next time. ECR requests therefore do not inspect the container each time.
This commit is contained in:
1 parent
e22bd2c59a
commit
c1cd5af2bd
8 files changed
+169
-32
No files matched your search
@@ -88,6 +88,8 @@ services:
|
||||
|
||||
`docker login 000000000000.dkr.ecr.us-east-1.localhost:4566` works once Floci starts the registry sidecar.
|
||||
|
||||
When Floci runs in a container that publishes its port on another host port (for example `docker run -p 54321:4566`), the `repositoryUri`, the `GetAuthorizationToken` `proxyEndpoint` and the rewritten Lambda and ECS image URIs all name that host port (`000000000000.dkr.ecr.us-east-1.localhost:54321`), because the Docker daemon performs login, push and pull through it. Floci reads the published port from its own container through the mounted Docker socket, and uses `floci.port` (`4566`) when it does not run in a container or the port is not published.
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
|
||||
@@ -679,6 +679,8 @@ Requirements and limits:
|
||||
EKS service network variable.
|
||||
- Only Floci-mintable hostnames are mirrored; public registries (docker.io, ghcr.io, …)
|
||||
are never touched.
|
||||
- Mirrored hostnames carry the port the repository URIs advertise, which is the host port
|
||||
when Floci's container publishes `4566` on another one (see [ECR](ecr.md#docker-compose-port-mapping)).
|
||||
- Repository URIs using a non-default `registryId` (account) are not covered.
|
||||
- The mirror set is snapshotted when the cluster is created. Clusters created before this
|
||||
feature can be fixed manually because the k3s container filesystem survives a restart:
|
||||
|
||||
Reference in new issue
Block a user