fix public ip selfcheck logic
This commit is contained in:
1 parent
a6f9646da5
commit
67adc6670e
18 files changed
+209
-90
No files matched your search
+19
-15
@@ -8,31 +8,35 @@ real OpenStack cloud and no real internet access:
|
||||
synthetic floating IP per configured address (see
|
||||
`cmd/control-api/main.go`'s `newOpenStackClient`).
|
||||
- **1 validator-agent** (`validator_01`), started with
|
||||
`-stub-ports 12022,18081,18443,18888` — trivial accept-and-close TCP
|
||||
`-stub-ports 22022,28081,28443,28888` — trivial accept-and-close TCP
|
||||
listeners standing in for the base-minimum services (22/80/443/8080) a
|
||||
real validator would run. ICMP needs no stub: the kernel answers echo
|
||||
requests to any local address (127.0.0.0/8) on its own.
|
||||
- **3 probers** (`site-1`/`site-2`/`site-3`), all probing `127.0.0.1`.
|
||||
- **3 `httpstub` instances** (`scripts/httpstub`) standing in for the real
|
||||
outbound targets (hub.docker.com / github.com / packages.ubuntu.com),
|
||||
always returning `200 OK`.
|
||||
- **3 `httpstub` instances** (`scripts/httpstub`) — `/` always returns
|
||||
`200 OK`, standing in for the real outbound egress targets (hub.docker.com
|
||||
/ github.com / packages.ubuntu.com); `/ip` echoes the caller's remote
|
||||
address as plain text, standing in for the external IP-echo service the
|
||||
validator-agent's self-check normally queries in production (see
|
||||
`internal/agentcore.detectPublicIP` and `config.SelfCheckCfg.IPEchoURLs`).
|
||||
|
||||
The generated config uses a short `lease_ttl_seconds: 8` and
|
||||
`checking_window_seconds: 15` so the whole run finishes in well under a
|
||||
minute instead of using the (much longer) production defaults.
|
||||
|
||||
**Why only one IP address (`127.0.0.1`), and why it must be exactly that
|
||||
one:** the self-check mechanism (`GET /whatsmyip`, see
|
||||
`internal/httpapi/server.go`'s `remoteIP`) compares the TCP source address
|
||||
the validator-agent's own outbound connection to control-api arrives with
|
||||
against the address it was just assigned. In a real deployment, Neutron
|
||||
actually SNATs the validator's egress traffic through whichever floating
|
||||
IP is attached, so any configured address self-checks correctly. This
|
||||
offline harness has no real network-level SNAT — the agent's traffic to
|
||||
control-api always really originates from `127.0.0.1` — so only that
|
||||
literal loopback address can ever pass self-check here. This is a
|
||||
limitation of the harness's fidelity, not of the self-check mechanism
|
||||
itself.
|
||||
one:** self-check compares the source address the validator-agent's own
|
||||
request to the IP-echo target arrives with against the address it was
|
||||
just assigned. In a real deployment that target is a real external
|
||||
IP-echo service, and Neutron actually SNATs the validator's egress
|
||||
traffic through whichever floating IP is attached, so any configured
|
||||
address self-checks correctly. This offline harness points
|
||||
`self_check.ip_echo_urls` at the local `httpstub`'s `/ip` route instead
|
||||
(see `validator-agent.yaml` generated by the script) — there's no real
|
||||
network-level SNAT here, the agent's traffic to that stub always really
|
||||
originates from `127.0.0.1`, so only that literal loopback address can
|
||||
ever pass self-check in this harness. This is a limitation of the
|
||||
harness's fidelity, not of the self-check mechanism itself.
|
||||
|
||||
## Running it
|
||||
|
||||
|
||||
Reference in new issue
Block a user