mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
* feat(cloudmap): resolve DNS namespaces and register ECS tasks in them Cloud Map's control plane already accepted namespaces, services and instances and read them back correctly, but nothing answered DNS for <service>.<namespace>. A container that registered successfully still failed to resolve its peers, and the gap only surfaced at application runtime because every API call looked right. The embedded DNS server now consults DnsRecordSource implementations before forwarding a query upstream, and Cloud Map provides one: a DNS namespace resolves to the AWS_INSTANCE_IPV4 of the instances registered under it, one A record each. The SPI keeps the direction right, since core must not import a service. Which instances answer follows Route 53: the healthy ones while any instance is healthy, all of them when none is, and at most eight records either way. HTTP namespaces do not resolve, matching AWS, where they are reachable only through DiscoverInstances. An ECS service that declares serviceRegistries now registers each running task as an instance of the named Cloud Map service, and deregisters it when the task stops, mirroring EcsLoadBalancerRegistrar. The address is the task's ENI address on an awsvpc task and the container's Docker network address otherwise, which is the one a peer container can reach. Alongside it the instance carries the metadata attributes the ECS service discovery documentation lists: AVAILABILITY_ZONE, REGION, ECS_SERVICE_NAME, ECS_CLUSTER_NAME and ECS_TASK_DEFINITION_FAMILY. serviceRegistries stays raw: registryArn, containerName and containerPort are the only members anything acts on. * test(ecs): pin the Cloud Map registration hooks with a docker mode test EcsServiceDiscoveryRegistrarTest drives the registrar directly, so removing EcsService's calls to it left every ECS test green. The registration only runs in docker mode, which the suite mocks out, so nothing covered the wiring. The new test runs ECS unmocked under a profile, creates a service that declares serviceRegistries, and drives one reconciler tick to launch a real container. It asserts the Cloud Map name resolves to the task's ENI address while it runs, and that stopping the task removes the instance and the answer. Commenting out either hook fails it: the register hook on the resolve assertion, the deregister hook on the instance one. Security-group enforcement goes back to its shipped default of off for the profile. The suite turns it on and its helper needs rootful Docker, which is a requirement of security groups rather than of service discovery. Also corrects the health status deviation note. An instance registered without AWS_INIT_HEALTH_STATUS starts HEALTHY on AWS too, so the deviation is not the initial status but that Floci never moves it: AWS registers an ECS task UNHEALTHY and promotes it once the container health check passes, for a service that declares HealthCheckCustomConfig. * fix(cloudmap): retain DNS ownership and ECS registry targets * fix(cloudmap): keep namespace apex queries authoritative * style(dns): remove em dash from test heading