From 196161654a6e85bc91bef12afad997f97b448632 Mon Sep 17 00:00:00 2001 From: atlas Date: Sat, 24 Oct 2026 14:54:47 +0200 Subject: [PATCH] Revert "drop port-collision checks against swarm.otel.telemetryPort" This reverts commit 627964f72de8d3db142665c3f6f4517a27c17867. --- nix/host-modules/hive-forge/default.nix | 3 ++- nix/host-modules/otel.nix | 4 +++- nix/host-modules/swarm-bao-service.nix | 8 +++++--- nix/host-modules/swarm-nats-service.nix | 6 ++++-- nix/host-modules/swarm-nats.nix | 3 ++- nix/host-modules/swarm-victorialogs.nix | 3 ++- nix/module-eval/nats-authelia.nix | 3 +++ 7 files changed, 21 insertions(+), 9 deletions(-) diff --git a/nix/host-modules/hive-forge/default.nix b/nix/host-modules/hive-forge/default.nix index d4b9658f..b126db5a 100644 --- a/nix/host-modules/hive-forge/default.nix +++ b/nix/host-modules/hive-forge/default.nix @@ -458,13 +458,14 @@ in assertion = !(lib.elem forwarderTelemetryPort [ config.services.hyperhive.otel.telemetryPort + config.services.hyperhive.swarm.otel.telemetryPort config.services.hyperhive.swarm.bao.otel.telemetryPort config.services.hyperhive.swarm.nats.otel.telemetryPort ]); message = '' The forge's journal forwarder's telemetry port (${toString forwarderTelemetryPort}) collides with another collector's in the host netns: the hive - collector's, the store forwarder's or the + collector's, the swarm collector's, the store forwarder's or the queue forwarder's. ''; } diff --git a/nix/host-modules/otel.nix b/nix/host-modules/otel.nix index 57c4baad..e2379eb9 100644 --- a/nix/host-modules/otel.nix +++ b/nix/host-modules/otel.nix @@ -144,7 +144,9 @@ in the value *configured* rather than implied, which is the point of the option. An undeclared port is invisible to anything comparing ports, so a second collector on the same host picking the same - number fails at `bind()` rather than at eval. + number fails at `bind()` rather than at eval — + `services.hyperhive.swarm.otel.telemetryPort` sidesteps 8888 by + hand for that reason. ''; }; diff --git a/nix/host-modules/swarm-bao-service.nix b/nix/host-modules/swarm-bao-service.nix index 40774b9b..7c83df05 100644 --- a/nix/host-modules/swarm-bao-service.nix +++ b/nix/host-modules/swarm-bao-service.nix @@ -136,10 +136,12 @@ in failures. How you find out that telemetry is being lost, so it is worth keeping rather than switching off. - ⚠️ **Deliberately not 8888.** 8888 is the collector + ⚠️ **Deliberately neither 8888 nor 8889.** 8888 is the collector binary's built-in default, which the hive tier - ({option}`services.hyperhive.otel.telemetryPort`) already binds. This - container runs with `privateNetwork = false`, so both share the + ({option}`services.hyperhive.otel.telemetryPort`) already binds, and + 8889 is the swarm tier's + ({option}`services.hyperhive.swarm.otel.telemetryPort`). This + container runs with `privateNetwork = false`, so all three share the host's network namespace whenever they are co-located — and unlike the OTLP ports this one appears nowhere in either config when it is left undeclared, so nothing that compares configured ports can see diff --git a/nix/host-modules/swarm-nats-service.nix b/nix/host-modules/swarm-nats-service.nix index c3de732a..fe48c19b 100644 --- a/nix/host-modules/swarm-nats-service.nix +++ b/nix/host-modules/swarm-nats-service.nix @@ -115,8 +115,10 @@ in serves its own metrics on (refused and dropped records, exporter failures). - ⚠️ Not 8888 or 8890: the hive collector and the store's forwarder - bind those ({option}`services.hyperhive.otel.telemetryPort`, + ⚠️ Not 8888, 8889 or 8890: the hive collector, the swarm collector + and the store's forwarder bind those + ({option}`services.hyperhive.otel.telemetryPort`, + {option}`services.hyperhive.swarm.otel.telemetryPort`, {option}`services.hyperhive.swarm.bao.otel.telemetryPort`), and this container shares the host netns with them when co-located. The second collector to bind a port dies with `bind: address already in use`. diff --git a/nix/host-modules/swarm-nats.nix b/nix/host-modules/swarm-nats.nix index c2d61fdd..0b76a267 100644 --- a/nix/host-modules/swarm-nats.nix +++ b/nix/host-modules/swarm-nats.nix @@ -603,6 +603,7 @@ in cfg.metricsPort cfg.otel.telemetryPort config.services.hyperhive.otel.telemetryPort + swarmOtelCfg.telemetryPort config.services.hyperhive.swarm.bao.otel.telemetryPort ]; in @@ -611,7 +612,7 @@ in services.hyperhive.swarm.nats.otel.telemetryPort (${toString cfg.otel.telemetryPort}) collides with another port in the host netns: the queue's own ports, or the telemetry port of the - hive collector or the store's forwarder. Pick + hive collector, the swarm collector or the store's forwarder. Pick a free port. ''; } diff --git a/nix/host-modules/swarm-victorialogs.nix b/nix/host-modules/swarm-victorialogs.nix index a3f09089..2276ad6e 100644 --- a/nix/host-modules/swarm-victorialogs.nix +++ b/nix/host-modules/swarm-victorialogs.nix @@ -276,13 +276,14 @@ in assertion = !(lib.elem forwarderTelemetryPort [ hyperhiveCfg.otel.telemetryPort + hyperhiveCfg.swarm.otel.telemetryPort hyperhiveCfg.swarm.bao.otel.telemetryPort hyperhiveCfg.swarm.nats.otel.telemetryPort ]); message = '' The log store's journal forwarder's telemetry port (${toString forwarderTelemetryPort}) collides with another collector's in the host netns: the hive - collector's, the store forwarder's or the + collector's, the swarm collector's, the store forwarder's or the queue forwarder's. ''; } diff --git a/nix/module-eval/nats-authelia.nix b/nix/module-eval/nats-authelia.nix index d21bc646..95f01e18 100644 --- a/nix/module-eval/nats-authelia.nix +++ b/nix/module-eval/nats-authelia.nix @@ -153,6 +153,7 @@ let # Every other collector port on the host, and the queue's forwarder. taken = [ 8888 + 8889 8890 h.services.hyperhive.swarm.nats.otel.telemetryPort ] @@ -265,6 +266,7 @@ let let taken = [ 8888 + 8889 8890 h.services.hyperhive.swarm.nats.otel.telemetryPort ] @@ -1000,6 +1002,7 @@ let reader = lib.head s.service.telemetry.metrics.readers; taken = [ 8888 + 8889 8890 h.services.hyperhive.swarm.nats.otel.telemetryPort ]