swarm-otel: scrape nats through its published name
The queue's metrics were scraped over loopback from the exporter, declared only where the queue and the collector share a host, so a collector on any other host had no job for it. Its target is now declared on every host as `https://<swarm.nats.domain>/metrics`, and the queue's host gets a gateway vhost on that name serving `= /metrics` from the exporter behind the collector's auth subrequest (`/__nats_metrics_authz`, the forge's shape). Every other path there is 403; the monitoring endpoint is never proxied. The rules derived from `publishedScrapeTargets` admit the collector's client and deny every other subject. The loopback entry, and with it `glue-otel-scrape-targets.nix`, is gone. In self-signed mode the vhost serves the queue's own `swarm-nats` leaf (issued for exactly that name, `server_flag` set), copied 0640 root:nginx by `swarm-nats-gateway-cert`; until the leaf exists that unit writes a throwaway pair, so nginx never starts on a missing file. The name stays out of `swarm.serviceDomains`, so a host whose only swarm service is the queue fronts no services name and its gateway neither waits for nor needs the swarm-services leaf: no services-issuer pair has to be placed on it. With ACME or an operator cert the vhost uses the gateway's own TLS, as every other name does. The queue's host now enables the gateway (`mkDefault`), as every other swarm service's host does. Fixes #5205
This commit is contained in:
parent
d24dbaeadf
commit
217b3f1cea
9 changed files with 276 additions and 56 deletions
|
|
@ -40,8 +40,11 @@ in
|
|||
Every other hive resolves it through the operator's upstream DNS,
|
||||
which is where a multi-host swarm needs a record for it.
|
||||
|
||||
Not in {option}`services.hyperhive.swarm.serviceDomains`: that list
|
||||
is the names a gateway vhost fronts, and nginx fronts nothing here.
|
||||
Not in {option}`services.hyperhive.swarm.serviceDomains`. The gateway
|
||||
on the queue's host serves `https://<domain>/metrics` to the swarm
|
||||
collector, and in self-signed mode it serves the queue's own leaf
|
||||
there rather than the swarm-services one, so that host never waits
|
||||
for a services leaf (./swarm-nats.nix).
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -89,7 +92,9 @@ in
|
|||
default = 7777;
|
||||
description = ''
|
||||
Port the Prometheus exporter serves NATS's metrics on, bound to
|
||||
loopback for the swarm collector to scrape.
|
||||
loopback. The gateway's `= /metrics` location on
|
||||
{option}`services.hyperhive.swarm.nats.domain` proxies it, behind
|
||||
the swarm collector's authelia check.
|
||||
|
||||
⚠️ This and {option}`monitorPort` are two more claims on a port
|
||||
space every swarm container shares — they run in this container but
|
||||
|
|
|
|||
Loading…
Reference in a new issue