skr8tr_ingress is a reverse proxy that resolves backends dynamically via the
Tower on every request. Longest-prefix route matching, MAX_RETRY=3 failover,
X-Forwarded-For injection, bidirectional select() proxy. Built on Arch Linux,
compiled with gcc C23, verified with curl.
The nginx ingress controller for Kubernetes is a 90 MB container image. It runs an nginx
process and a Go sidecar that watches the Kubernetes API for Ingress objects
and rewrites nginx config on change. The actual routing logic is nginx configuration
generated by the Go controller from YAML annotations — none of which you wrote directly.
We wanted something that did exactly what an ingress needs to do: accept an HTTP request, figure out which backend service handles it, connect to that backend, and forward bytes in both directions. Nothing else. Here is what we built.
The biggest design decision: the ingress resolves backends at request time via the Tower, not from a static config file. This means new replicas appear automatically (Tower registers them on launch) and dead replicas disappear automatically (Tower deregisters them on kill). The ingress itself has no state beyond the route table you pass at startup.
Routes are stored in a flat array, sorted by prefix length descending at startup. Matching is an O(N) scan — fine for any realistic number of routes:
For each request, we send a LOOKUP|<service> UDP datagram to the Tower
and parse the response. The Tower round-robins across replicas, so the ingress gets built-in
load balancing for free:
Once the backend is connected, we proxy bytes in both directions using select()
with a 30-second timeout. No threads per connection — one pthread handles the full
client↔backend lifecycle:
Tested on the same Arch Linux workstation, single-node cluster, ingress on port 9090:
max_workers) — sufficient for our use case, not suitable for high-concurrency public endpoints without tuningFull source: src/daemon/skr8tr_ingress.c — 320 lines, no external dependencies beyond pthreads.
Questions: scott.bakerphx@gmail.com