mirror of
https://github.com/floci-io/floci.git
synced 2026-12-03 10:17:48 -05:00
refactor(docker): read the Docker host override from floci.docker.host-override (#10025)
The Docker host override every container Floci starts relies on was read from the Lambda section by core classes. floci.docker.host-override (env FLOCI_DOCKER_HOST_OVERRIDE) is now the key, read through EmulatorConfig.effectiveDockerHostOverride() by DockerHostResolver and TlsProxyServer. It wins when set and not blank; otherwise the former floci.services.lambda.docker-host-override still applies, giving every reader the value it gave before, and its first use logs a deprecation warning. The docs say which key wins and that the self-signed TLS certificate does not name the override.
This commit is contained in:
1 parent
2a2c51abe5
commit
5fffd9f3a8
19 files changed
+358
-31
No files matched your search
@@ -131,6 +131,7 @@ floci:
|
||||
log-max-size: "10m" # Max size per container log file before rotation
|
||||
log-max-file: "3" # Number of rotated log files to retain
|
||||
docker-host: unix:///var/run/docker.sock # Docker daemon socket (shared by Lambda, RDS, ElastiCache)
|
||||
# host-override: floci # Address containers use to reach Floci instead of the detected one (legacy: floci.services.lambda.docker-host-override)
|
||||
max-connections: 1024 # Docker client connection pool for short calls
|
||||
streaming-max-connections: 3072 # Separate pool for streams; each live Lambda container holds 2, plus 1 per extension
|
||||
pool-gauge-interval-seconds: 60 # Log Docker pool use every N seconds while a pool is busy; 0 = off
|
||||
@@ -423,6 +424,8 @@ Per-queue SQS redrive policy (`maxReceiveCount`) is configured at queue creation
|
||||
|
||||
The flat keys `floci.max-request-size` / `FLOCI_MAX_REQUEST_SIZE` and `floci.ecr-base-uri` / `FLOCI_ECR_BASE_URI` moved into sub-structures in 2.x (`floci.protocols.max-request-size` and `floci.services.lambda.ecr-base-uri`). The old names still resolve — a `FlociConfigRelocationsInterceptor` maps them onto the new keys — so existing configs and env vars keep working.
|
||||
|
||||
`floci.services.lambda.docker-host-override` / `FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE` moved to `floci.docker.host-override` / `FLOCI_DOCKER_HOST_OVERRIDE`, since every container Floci starts uses it, not only Lambda's. The old key is still read when the new one is unset, with a deprecation warning logged once; when both are set, the new key wins.
|
||||
|
||||
## Disabling Services
|
||||
|
||||
Set `enabled: false` for any service you don't need. Disabled services return a `ServiceUnavailableException` rather than silently ignoring calls.
|
||||
|
||||
@@ -452,13 +452,15 @@ What each setting does and why it is needed:
|
||||
explicitly to bypass auto-detection:
|
||||
|
||||
```bash
|
||||
FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE=floci
|
||||
FLOCI_DOCKER_HOST_OVERRIDE=floci
|
||||
```
|
||||
|
||||
This forces every spawned Lambda container to reach the Runtime API at the
|
||||
given host (here the `FLOCI_HOSTNAME` value), skipping Floci's
|
||||
auto-detection entirely. See the [Lambda docs](../services/lambda.md#configuration)
|
||||
for details.
|
||||
This forces every container Floci spawns to reach Floci, and Lambda
|
||||
containers its Runtime API, at the given host (here the `FLOCI_HOSTNAME`
|
||||
value), skipping Floci's auto-detection entirely. The former
|
||||
`FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE` still works when
|
||||
`FLOCI_DOCKER_HOST_OVERRIDE` is unset, but is deprecated. See the
|
||||
[Lambda docs](../services/lambda.md#runtime-api-host-override) for details.
|
||||
|
||||
## Transient I/O retry
|
||||
|
||||
|
||||
@@ -145,6 +145,7 @@ This foundation release provides opt-in security-group filtering for EC2 Docker
|
||||
| `FLOCI_NETWORK_SECURITY_GROUP_ENFORCEMENT_ENABLED` | `false` | Opt in to filtering Docker-backed EC2 and ECS `awsvpc` traffic by attached security groups |
|
||||
| `FLOCI_NETWORK_SECURITY_GROUP_ENFORCEMENT_HELPER_IMAGE` | `floci/network-helper:local` | Linux helper image containing nftables; Floci builds the default image locally when missing |
|
||||
| `FLOCI_DOCKER_DOCKER_HOST` | `unix:///var/run/docker.sock` | Docker daemon socket path or TCP address |
|
||||
| `FLOCI_DOCKER_HOST_OVERRIDE` | _(none)_ | Explicit host/IP that containers Floci starts (Lambda's Runtime API callback included) use to reach Floci, bypassing auto-detection (e.g. rootless Podman). The self-signed TLS certificate does not name it. Replaces `FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE` |
|
||||
| `FLOCI_DOCKER_DOCKER_CONFIG_PATH` | _(none)_ | Path to a directory containing Docker's `config.json` for registry auth |
|
||||
| `FLOCI_DOCKER_MAX_CONNECTIONS` | `1024` | Connection pool size for Floci's short Docker calls. See [Docker Configuration](docker.md#connection-pool) |
|
||||
| `FLOCI_DOCKER_STREAMING_MAX_CONNECTIONS` | `3072` | Connection pool size for streams that last a container's lifetime or a long command's run, kept apart from the main pool so they never starve create, start, stop and remove. Each live Lambda container holds two (log stream and exit watcher) plus one per extension, and each CodeBuild phase, SSM command, ECS Exec session, EKS audit follower, user data script and EMR bootstrap action one. See [Docker Configuration](docker.md#connection-pool) |
|
||||
@@ -342,7 +343,7 @@ See [Initialization Hooks](./initialization-hooks.md) for lifecycle phases and s
|
||||
| `FLOCI_SERVICES_LAMBDA_DOCKER_NETWORK` | _(none)_ | Docker network for Lambda containers (overrides `FLOCI_SERVICES_DOCKER_NETWORK`) |
|
||||
| `FLOCI_SERVICES_LAMBDA_DOCKER_FLAGS` | _(none)_ | Additional Docker flags applied to Lambda containers, such as `--env`, `--volume`, `--publish`, `--add-host`, `--dns`, `--label`, `--network`, `--user`, `--privileged`, and `--platform`. Explicit `--dns` entries replace automatic embedded DNS and public fallback resolvers. Published ports support `host:container` and `127.0.0.1:host:container` forms |
|
||||
| `FLOCI_SERVICES_LAMBDA_CONTAINER_NAME_PREFIX` | `floci` | Base name prefix for Lambda-spawned containers and code volumes (must match `[A-Za-z0-9][A-Za-z0-9_.-]*`) |
|
||||
| `FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE` | _(none)_ | Explicit host/IP Lambda containers use to reach the Runtime API, bypassing auto-detection (e.g. rootless Podman) |
|
||||
| `FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE` | _(none)_ | Deprecated: use `FLOCI_DOCKER_HOST_OVERRIDE`, which wins when both are set. Still honoured when that one is unset, with a deprecation warning at startup |
|
||||
| `FLOCI_SERVICES_LAMBDA_AWS_CONFIG_PATH` | _(none)_ | Host path bind-mounted read-only at `/opt/aws-config` inside Lambda containers for real credential discovery |
|
||||
| `FLOCI_SERVICES_LAMBDA_EXECUTOR` | `docker` | Execution backend for Lambda environments: `docker` (containers), `kubernetes` (pods) or `process` (local processes for `provided.*` runtimes) |
|
||||
| `FLOCI_SERVICES_LAMBDA_KUBERNETES_NAMESPACE` | `default` | Namespace Lambda pods are created in |
|
||||
|
||||
@@ -193,7 +193,7 @@ The credentials endpoint performs the following validations:
|
||||
|
||||
Kubernetes only accepts an `https` `clientConfig.url` on a `MutatingWebhookConfiguration`, together with a `caBundle` the API server trusts. Floci serves HTTP with the default `floci.tls.enabled=false`, so the webhook is skipped with a warning in that case and pods start unmutated. Set `FLOCI_TLS_ENABLED=true` to get injection; the `caBundle` is then what `GET /_floci/ca.pem` serves: Floci's local CA, after the certificates in the `floci.tls.cert-path` file when Floci serves a certificate of your own.
|
||||
|
||||
The API server also checks that the certificate names the webhook URL's host, so the URL uses a host the certificate Floci serves names. When the cluster resolves through Floci's embedded DNS (`FLOCI_SERVICES_EKS_EMBEDDED_DNS`, with the cluster on a Docker network that reaches Floci's DNS server, as it does by default with Floci in a container), that is Floci's hostname: `FLOCI_HOSTNAME`, or `localhost.floci.io`, both of which the self-signed certificate covers. Otherwise it is the host other containers reach Floci on: `host.docker.internal` when Floci runs natively, which the self-signed certificate also covers, or Floci's container IP, which it does not. When the certificate does not name that host, as with a certificate of your own issued for other names, pod identity injection is not available: the webhook is skipped with a warning naming the host, and pods start unmutated. To get it, have the API server call Floci by a name the certificate covers: with embedded DNS, set `FLOCI_HOSTNAME` to that name; without it, point `FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE` at it. The self-signed certificate covers `FLOCI_HOSTNAME` too.
|
||||
The API server also checks that the certificate names the webhook URL's host, so the URL uses a host the certificate Floci serves names. When the cluster resolves through Floci's embedded DNS (`FLOCI_SERVICES_EKS_EMBEDDED_DNS`, with the cluster on a Docker network that reaches Floci's DNS server, as it does by default with Floci in a container), that is Floci's hostname: `FLOCI_HOSTNAME`, or `localhost.floci.io`, both of which the self-signed certificate covers. Otherwise it is the host other containers reach Floci on: `host.docker.internal` when Floci runs natively, which the self-signed certificate also covers, or Floci's container IP, which it does not. When the certificate does not name that host, as with a certificate of your own issued for other names, pod identity injection is not available: the webhook is skipped with a warning naming the host, and pods start unmutated. To get it, have the API server call Floci by a name the certificate covers: with embedded DNS, set `FLOCI_HOSTNAME` to that name; without it, point `FLOCI_DOCKER_HOST_OVERRIDE` at it. The self-signed certificate covers `FLOCI_HOSTNAME` too.
|
||||
|
||||
The webhook carries `failurePolicy: Ignore`, and Floci admits the pod unchanged on any internal error, so a webhook that cannot be registered or cannot be reached never prevents a pod from being created. Registration failures log a warning and leave the cluster running.
|
||||
|
||||
|
||||
+11
-5
@@ -799,7 +799,7 @@ Configuration resource reads and `ListFunctionsByCodeSigningConfig` return
|
||||
| `FLOCI_SERVICES_LAMBDA_DOCKER_NETWORK` | *(unset)* | Docker network to attach Lambda containers to (overrides `FLOCI_SERVICES_DOCKER_NETWORK`) |
|
||||
| `FLOCI_SERVICES_LAMBDA_DOCKER_FLAGS` | *(unset)* | Additional Docker flags applied to Lambda containers, including `--env`, `--volume`, `--publish`, `--add-host`, `--dns`, `--label`, `--network`, `--user`, `--privileged`, and `--platform`. Explicit `--dns` entries replace automatic embedded DNS and public fallback resolvers. Published ports support `host:container` and `127.0.0.1:host:container` forms |
|
||||
| `FLOCI_SERVICES_LAMBDA_EXTRA_HOSTS` | *(unset)* | Comma-separated `hostname:ip` entries added to each Lambda container's `/etc/hosts`; `ip` may be `host-gateway`, mirroring `docker run --add-host` |
|
||||
| `FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE` | *(unset)* | Explicit host/IP that spawned Lambda containers use to reach Floci's Runtime API, bypassing auto-detection |
|
||||
| `FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE` | *(unset)* | Deprecated: use `FLOCI_DOCKER_HOST_OVERRIDE` (see [Runtime API host override](#runtime-api-host-override)), which wins when both are set |
|
||||
| `FLOCI_SERVICES_LAMBDA_CONTAINER_NAME_PREFIX` | `floci` | Base name prefix for spawned Lambda containers and code volumes (e.g. `acme` → `acme-<function>-<id>` containers, `acme-code-<function>-<hash>` volumes; with `FLOCI_DOCKER_RESOURCE_NAMESPACE` set, the namespace follows the prefix and a short hash of it ends the volume name, e.g. `acme-<namespace>-code-<function>-<hash>-<namespace hash>`). Must be a valid Docker name segment (`[A-Za-z0-9][A-Za-z0-9_.-]*`); invalid values are ignored with a warning |
|
||||
| `FLOCI_SERVICES_LAMBDA_CODE_VOLUME_POPULATE_CONCURRENCY` | `max(2, cpus/2)` | Maximum concurrent first-time code-volume populates. See the note below |
|
||||
| `FLOCI_SERVICES_LAMBDA_EXECUTOR` | `docker` | Execution backend: `docker` (containers), `kubernetes` (pods) or `process` (local processes, see [Process executor](#process-executor)) |
|
||||
@@ -925,14 +925,20 @@ correct and needs no configuration.
|
||||
|
||||
On unusual network topologies, for example rootless Podman, auto-detection
|
||||
can pick an address the Lambda container cannot reach, and invocations fail with
|
||||
`connect ECONNREFUSED <ip>:12000`. Set `FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE`
|
||||
to the host or IP that containers can actually reach Floci on, and Floci uses it
|
||||
verbatim instead of auto-detecting:
|
||||
`connect ECONNREFUSED <ip>:12000`. Set `FLOCI_DOCKER_HOST_OVERRIDE`
|
||||
(`floci.docker.host-override`) to the host or IP that containers can actually
|
||||
reach Floci on, and Floci uses it verbatim instead of auto-detecting:
|
||||
|
||||
```bash
|
||||
FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE=floci
|
||||
FLOCI_DOCKER_HOST_OVERRIDE=floci
|
||||
```
|
||||
|
||||
The override applies to every container Floci starts, not only Lambda's. The
|
||||
former key `floci.services.lambda.docker-host-override`
|
||||
(`FLOCI_SERVICES_LAMBDA_DOCKER_HOST_OVERRIDE`) still works when the new one is
|
||||
unset, and Floci logs a deprecation warning the first time it uses it. When both
|
||||
are set, `FLOCI_DOCKER_HOST_OVERRIDE` wins.
|
||||
|
||||
See [Docker Configuration → Running on Podman (rootless)](../configuration/docker.md#running-on-podman-rootless)
|
||||
for a full rootless Podman walkthrough.
|
||||
|
||||
|
||||
Reference in new issue
Block a user