AWS echoes all three on CreateService/UpdateService/DescribeServices; Floci
dropped them, so clients that persist them saw drift. Terraform's
aws_ecs_service reads all three and schedulingStrategy is ForceNew, which
replaced the service on every apply.
- EcsServiceModel: schedulingStrategy and availabilityZoneRebalancing
alongside the existing deploymentController
- CreateService parses schedulingStrategy, deploymentController.type and
availabilityZoneRebalancing (400 InvalidParameterException on unknown
values); UpdateService parses availabilityZoneRebalancing
- Defaults match AWS: REPLICA / ECS, and availabilityZoneRebalancing is
ENABLED on create; a service that never had a value reads as DISABLED
- DAEMON is honoured, not just stored: rejected for the Fargate launch type
and the CODE_DEPLOY/EXTERNAL controllers (AWS's rule), otherwise the
reconciler keeps exactly one task per ACTIVE container instance and
derives desiredCount from the instance count
Co-authored-by: Hisham Mohammed <hisham.ma.mohammed@gmail.com>
Co-authored-by: Priamo <pgermosen@gmail.com>
UpdateService with a new taskDefinition recorded a deployment but left the
running tasks on the old revision forever: a redeploy (new image tag, new
environment) never reached the containers, and the only way to apply it was
to StopTask by hand so the reconciler relaunched.
The reconciler now counts only tasks on the service's current task
definition towards desiredCount, so replacements start first, and when the
service is over desiredCount it drains the stale tasks before anything
else — the shape of AWS's rolling deployment with the ECS deployment
controller. Stopped reason names the replaced task definition.
The service pins the resolved task-definition ARN on CreateService and
UpdateService (AWS stores and reports the ARN), so a family or
family:revision reference compares exactly with each task's
taskDefinitionArn; a service persisted with a raw reference is pinned on
its first reconciler tick.
Co-authored-by: Hisham Mohammed <hisham.ma.mohammed@gmail.com>
RegisterTaskDefinition parsed a fixed field list and dropped everything
else, so a task definition registered with a runtimePlatform or a
container logConfiguration came back from DescribeTaskDefinition without
them. A client that verifies its own write — Terraform, or a deploy tool
comparing the registered revision against desired state — saw drift that
was not there.
Both are now parsed, stored on the task definition, and serialized back
with the AWS wire shape. A request that omits them still produces a
response without the keys, so nothing changes for existing callers.
The two fields are set on the task definition returned by
EcsService.registerTaskDefinition, following the pattern already used for
task-level volumes. That mutation happens after the value was stored, so
a backend that serializes on put (persistent, hybrid, WAL) had captured
the pre-mutation value; the definition is now written back, which also
makes the existing volumes round-trip survive a restart.
* fix(ecs): report service deployments and MISSING failures on DescribeServices
DescribeServices omitted services[].deployments entirely and always returned an
empty failures list. Both are read by AWS's own ServicesStable waiter, which
accepts on
length(services[?!(length(deployments) == `1` && runningCount == desiredCount)]) == `0`
and fails fast on failures[].reason == "MISSING" (botocore
ecs/2014-11-13/waiters-2.json). Because that file is codegen'd into every SDK,
`aws ecs wait services-stable` and every SDK waiter polled for the full
40 x 15s before giving up, and Terraform's aws_ecs_service never converged
(terraform-provider-aws internal/service/ecs/service.go:2206 applies the same
len(Deployments) == 1 test). Evaluating the acceptor against the old payload
raises JMESPathTypeError, so it could not even be evaluated.
An ACTIVE service now reports exactly one PRIMARY deployment derived from its
current state, with rolloutState COMPLETED once runningCount reaches
desiredCount. The deployment id is derived from the service ARN and task
definition rather than generated per request, so it is stable across calls and
restarts and rolls over when the task definition changes. An unresolvable
service reference is returned as a MISSING failure carrying the ARN it would
have had, instead of being dropped.
Known deviations are documented in docs/services/ecs.md: a single deployment
with no draining ACTIVE alongside it, no deploymentController gating, and
pendingCount always 0.
Closes#2174
* fix(ecs): stamp a deployment with its own start time, not the service's
A task-definition change mints a new deployment id, but both deployment
timestamps were still taken from the service's creation time, so the payload
contradicted itself: a new deployment claiming to have been created when the
service was. botocore documents Deployment.createdAt as "the time when the
service deployment was created", and moto stamps it at deployment construction
(moto/ecs/models.py:540) rather than reusing the service's.
Track when the current deployment began on the service model, set at creation
and on every task-definition change, and report that. Services persisted before
this field existed fall back to the service creation time.
Raised in review on #2176.
* feat(ecs): apply EFS access point POSIX ownership to shared local volumes
#1569 materialises an ECS task's efsVolumeConfiguration volume as a shared
local Docker named volume (floci-efs-<fileSystemId>). Docker creates a named
volume root:root 0755, so a task whose image runs as a non-root USER — as
containers mounting an EFS access point typically do — cannot create files on
it and fails with EACCES.
Real EFS initialises an access point's root directory per
RootDirectory.CreationInfo {OwnerUid, OwnerGid, Permissions} and applies the
access point's PosixUser to all I/O regardless of the process uid. This change
emulates that mechanism for the shared local volume, driven by generic config:
- New floci.storage.efs.* block (owner-uid, owner-gid, root-permissions,
setgid, init-image, mount-user, mount-group-add). Every value is empty/false
by default, so a shared volume behaves exactly as before (a plain named
volume, no ownership change) unless explicitly configured.
- ContainerLifecycleManager.ensureSharedVolume(...) ensures the volume then, if
ownership is configured, chowns/chmods the mount root once (run-once guard;
optional setgid so subdirectories inherit the owner gid) inside a short-lived
helper container.
- ContainerSpec/ContainerBuilder gain withUser/withGroupAdd; wired into
createContainerCmd.withUser and HostConfig.withGroupAdd.
- EcsContainerManager initialises the EFS volume root via ensureSharedVolume
before mounting it.
Unit tests cover the no-op default (no helper container, no image pull), the
one-off chown/chmod/setgid helper with the run-once guard, the builder
round-trip, and the EcsContainerManager wiring.
* fix(ecs): apply configured EFS PosixUser to containers mounting a shared volume
Wire the previously-inert floci.storage.efs.mount-user / mount-group-add config into the
ECS container spec: a container mounting an EFS-backed shared volume now runs under the
configured uid[:gid] and adds the supplementary group, emulating the access point's
PosixUser squashing. Without this a non-root image USER could not write a volume owned by
owner-uid/owner-gid. Also add the floci.storage.efs.* section to application.yml (the
source of truth for effective defaults) and correct the root-permissions Javadoc, which
implied leaving it empty always skips volume init even when owner/setgid are set.
* docs: regenerate action tables
* docs: update Docker image references to floci/floci
* docs: keep README Docker Hub badges pointing to hectorvent/floci
The hectorvent/floci image has accumulated pull and size metrics; switch
the badges to floci/floci once the new image has comparable numbers.