fix(apisix): match service key to container_name for stable Swarm DNS#509
Conversation
wax911
left a comment
There was a problem hiding this comment.
This does not fully satisfy #503 as written.
Changing the service key from apisix_gateway to apisix-gateway preserves the old short name in the source Compose file, but it does not prove that apisix-gateway:9091 is resolvable from the observability stack after Swarm deployment. Docker stack deploy creates stack-scoped service names, and Docker's own examples show service names such as vossibility_nsqd after deployment: https://docs.docker.com/reference/cli/docker/stack/deploy/
The safer fixes are one of:
- Keep the existing service key and change Prometheus to the actual fully-qualified Swarm service name, e.g.
infrastructure_apisix_gateway:9091. - Add an explicit network alias for
apisix-gatewayon the sharedtraefik-publicnetwork and document that alias as the stable cross-stack scrape name.
The #505 handoff/deepwork note also records the aligned direction for #503 as a fully-qualified cross-stack target, not service-key renaming. This PR should either update the Prometheus target directly or add a deliberate alias with runtime validation evidence.
d70f328 to
2cbde26
Compare
Update APISIX and Traefik scrape targets to use Swarm-qualified names: - apisix-gateway:9091 → infrastructure_apisix_gateway:9091 - traefik:8080 → infrastructure_traefik:8080 Docker stack deploy creates stack-scoped services; cross-stack DNS resolution on the shared traefik-public overlay network requires the <stack>_<service> prefix. All same-stack targets (loki, tempo, otel) remain unchanged. Ref: #503
2cbde26 to
a5984d0
Compare
Closes #503.
Changes the APISIX gateway service key from
apisix_gateway(underscore) toapisix-gateway(hyphen) to match the existingcontainer_name. The generator stripscontainer_namefrom Swarm stacks, so the service key becomes the DNS-resolvable name on the sharedtraefik-publicoverlay network.This preserves DNS stability:
apisix-gateway:9091resolves as the Prometheus scrape target in both Swarm and non-Swarm modes, avoiding the need to change configuration files for each deployment mode.Changes:
apisix/api-gateway/docker-compose.yml: service keyapisix_gateway→apisix-gatewayapisix/api-gateway/swarm.fragment.yml: matching key changestacks/infrastructure.yml: regenerated