Repository navigation
[M1.5] Route management through the Caddy admin API - #154
Merged
Merged
Conversation
Signed-off-by: Samuel Mbabhazi <[email protected]>
Signed-off-by: Samuel Mbabhazi <[email protected]>
Signed-off-by: Samuel Mbabhazi <[email protected]>
Signed-off-by: Samuel Mbabhazi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #17.
What changed
M1.5: the agent manages HTTP routes through Caddy's admin API (ADR 0005).
agent/internal/caddy. A typed admin client over the Unix socket. Request bodies are Go structs (no Caddyfile, no templates), responses are capped at 4 MiB, and Caddy's error text is never echoed.EnsureServercreates theshipkeepserver (:80,:443) at the deepest missing configuration level only. It never calls/load, which would also reset the admin endpoint the installer put on a Unix socket.@id = sk-route-<route_id>, read and patched in place by id or appended. Removing a missing route counts as done.SetPlainHostsmaintainsautomatic_https.skipforTLS_MODE_OFFroutes.upsert_routeandremove_routehandlers:[a-z0-9][a-z0-9-]{0,62}.*.allowed; IP addresses,localhostand duplicates refused.address:portliterals only (Docker or WireGuard), so no public, loopback, metadata, hostname or unix upstreams. Weights 1–100 map toweighted_round_robin.OFFadds the hosts to the skip list, and switching back removes them.AUTO_DNSis refused until a DNS provider is configured.caddy.admin_socket.How it was tested
localhost, duplicate, oversize;/load, append thenPATCH /id/sk-route-api, read back, idempotent removal, Caddy error text hidden, relative socket path refused.go test -race ./agent/...,golangci-lint(0 issues) and the local gate pass.Security considerations