* fix(cloudmap): create the Route 53 hosted zone behind a DNS namespace
Private and public DNS namespaces reported a random HostedZoneId that no
Route 53 zone backed. They now create a real zone (private with the
namespace VPC and region, or public) via Route53Service, and DeleteNamespace
deletes it; a zone holding user records refuses with HostedZoneNotEmpty and
the namespace is kept.
A private zone now covers the namespace's names, and the Route 53 DNS source
answers NXDOMAIN for names it has no record for. EmbeddedDnsServer took the
first present answer across sources, so bean order could hide Cloud Map
instances. An NXDOMAIN from one source no longer wins over another source's
real answer.
Reset: zones and namespaces live in separate stores; Route53Service.clear()
only drops in-memory counters, so no Cloud Map reset hook was added.
* test(cloudmap): select the user's zone now that namespaces own a real one
A private DNS namespace now creates a real Route 53 hosted zone, as AWS
does, so the compat projects hold two zones named floci-compat.internal:
the namespace's private zone and the public aws_route53_zone. The bats
lookups took the first zone by name, which picked the namespace zone
whenever its id sorted first, so the record and tag assertions read the
wrong zone. They now select the public zone.
The CloudFormation test pinned the namespace HostedZoneId to 14
characters, the length of Cloud Map's old placeholder. The id now comes
from Route 53, which, like AWS, does not use a fixed length; the test
checks for a bare Z-prefixed id instead.
* fix(dns): let a record source with records win over another's NODATA
Two sources can own one zone (a Cloud Map namespace and its Route 53
zone). An empty NOERROR from the first consulted source was returned
before the other was asked, so a TXT record in the zone hid Cloud Map's
A record at the same name. Empty answers are now fallbacks, an existing
name preferred over NXDOMAIN.
* fix(cloudmap): log a namespace zone that was already deleted
* docs(cloudmap): describe the real hosted zone in the operations table
* test(dns): pin how record sources combine REFUSED and negative answers
Another source's records now beat a REFUSED, and REFUSED beats NXDOMAIN
in either source order; nothing pinned either, so returning REFUSED
immediately went unnoticed. Also pin, as current behaviour, that a plain
NODATA beats an NXDOMAIN carrying an SOA authority.
The packet test now deletes the TXT records it adds to the namespace's
hosted zone, so the zone is left deletable.
---------
Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com>
* feat(cloudformation): provision Cloud Map namespaces and services
AWS::ServiceDiscovery::PrivateDnsNamespace, PublicDnsNamespace,
HttpNamespace and Service were stubbed, so a stack reported them created
while nothing existed in Cloud Map and Fn::GetAtt resolved to literals.
CloudMapCfnProvisioner creates them through CloudMapService. Ref returns
the id; Fn::GetAtt exposes Id and Arn, HostedZoneId on a DNS namespace and
Name on a service. An unnamed service is named <LogicalId>-<12 chars>, as
measured on AWS. Description, DnsConfig, HealthCheckConfig and Tags update
in place; a createOnly change replaces the resource through
ReplacementCleanup, and a rolled-back replacement restores the createOnly
record. A Ref to a Number parameter is coerced back to a JSON number for
DnsRecords TTL and FailureThreshold.
Closes#4596
* fix(cloudformation): roll back in-place Cloud Map updates
An in-place namespace or service update followed by a later resource
failing left the Cloud Map changes live and the stack in
UPDATE_ROLLBACK_FAILED, since rollbackUpdate only undid replacements.
The provisioner now keeps the description, DnsConfig, HealthCheckConfig
and tags an in-place update overwrites and puts them back on rollback;
a committed update drops the snapshot.
* fix(cloudmap): reject DNS record type changes on service update
UpdateService only changes the TTLs of a service's existing DNS records on AWS. An in-place CloudFormation update that changes the record types, or gives a DnsConfig to a service without one, now fails with InvalidInput instead of being applied, so it rolls back like on AWS and a rollback never has to remove a DnsConfig.
* fix(cloudmap): accept only TTL changes in a service DnsConfig update
UpdateService carries only DnsRecords on AWS and CloudFormation does not support a RoutingPolicy update. Comparing the record types as a set let a RoutingPolicy change or an added record of the same type through; the requested and stored DnsConfig now have to match apart from the TTLs.
* fix(cloudmap): ignore DNS record order in a service DnsConfig update
A TTL-only update that listed the same records in another order was rejected. The comparison now uses the sorted record types, so counts, types and RoutingPolicy still have to match.
* test(cloudformation): restore a real HealthCheckConfig in the Cloud Map rollback test
The in-place rollback test went from a null health check config to null, so dropping it from the snapshot would have passed.
* feat(cloudmap): honor service TTL in DNS A answers
* fix(cloudmap): distinguish DNS no-data and reject case collisions
* fix(cloudmap): resolve SRV instance A hostnames
* refactor(cloudmap): simplify DNS answer states and resolver
Give DnsAnswer explicit records, noData and nxDomain factories, drop the
test-only buildAResponse overload, split Cloud Map name resolution into
service and instance-hostname lookups, and parse DnsConfig once on
CreateService.
* fix(cloudmap): lowercase DNS names independent of the default locale
* fix(route53): answer private zone DNS with the record set TTL
Port Route53DnsRecordSource to DnsAnswer after rebasing onto #4353. Answers
carry the record set TTL, a flattened CNAME chain uses the shortest TTL in
the chain, and an alias uses its target's. A name absent from the zone gets
NXDOMAIN; a name with records but no A gets NOERROR with no answers.
* fix(route53): answer empty non-terminals with no data and cap external CNAME TTL
A private zone name with records only beneath it exists in DNS, so it now
answers NOERROR with no A records instead of NXDOMAIN. A CNAME to a name
outside the private zones answers with at most 60 seconds, matching the
alias path, since the target's own TTL is not visible.
* fix(route53): stop wildcards matching at or beneath empty non-terminals
A name with records only beneath it exists, so under RFC 4592 a wildcard
from a farther ancestor must not answer for it or for names below it. The
closer-name check now counts any record sharing an ancestor with the query
name, including wildcard owners, so a closer wildcard also shadows a
parent wildcard.
* 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
Document AWS Cloud Map (servicediscovery), which was implemented but never
documented, and reconcile related documentation drift:
- Add docs/services/cloudmap.md covering all 22 operations, config, examples
- Bump headline service count from 52 to 53 across README and docs
- Add Cloud Map to the canonical service matrix, README tables, and docs index
- Backfill mkdocs nav with Cloud Map and 7 existing-but-unlisted service docs
- Backfill condensed tables with services missing from them (Transcribe,
Resource Groups Tagging, Neptune, EventBridge Pipes, CloudFront)
- Add Umami analytics tracking via a Material theme override (overrides/main.html)