Expand description
etcd-backed config store for HA clustering.
Talks to etcd’s v3 HTTP/JSON gateway (the /v3/kv/* and
/v3/auth/authenticate endpoints) through the shared OutboundClient —
no gRPC, protoc, or tonic dependency. Config lives under per-resource
keys (<prefix>/routes/<name>, <prefix>/policies/<name>,
<prefix>/consumers/<name>), each value the resource’s JSON. Every gateway
instance loads from the same prefix and a background poll task keeps the
cluster converged (see spawn_watch).
§Route ordering
etcd returns keys in lexicographic order, so in etcd mode routes are matched by name order, not file declaration order. Name routes accordingly when precedence matters.
§v1 limitations (documented follow-ups)
- Plaintext / no TLS to etcd (loopback or private-network etcd).
- Poll-based convergence (default 2 s) rather than a streaming watch.
- Uses the first endpoint; multi-endpoint failover is a later addition.
Structs§
- Etcd
Config Store - etcd config store over the v3 HTTP/JSON gateway.
Enums§
- Etcd
Call 🔒Error - Internal call-error type distinguishing a 401 (triggers re-auth) from other failures.
Functions§
- build_
source - Builds the etcd store and the initial gateway config.
- gateway_
from_ 🔒kvs - Assembles a
GatewayConfigfrom the etcd key/value pairs underprefix. - is_
empty 🔒 - prefix_
range_ 🔒end - Computes etcd’s prefix range-end: the prefix with its last non-
0xffbyte incremented (so a Range covers all keys starting with the prefix). An all-0xffprefix ranges to the end of the keyspace ([0]). - spawn_
watch - Spawns the poll-based convergence task: every
poll_interval(default 2 s) it reloads from etcd and, when the config changed, applies it. Errors are logged and retried on the next tick — a transient etcd outage leaves the last-good config serving.