feat: move the ingress layer from ingress-nginx to Traefik - #27
Merged
Conversation
The dids daemon warn-logs every request that claims a forwarded host from a peer outside its trusted-CIDR set, and an ingress puts X-Forwarded-Host on every request — so it logged one warning per request, forever. Trusting the ingress CIDR would have silenced it by granting host control to every pod on a flat network, which is exactly what the daemon's gate exists to prevent. Stripping the header at the ingress is impossible under ingress-nginx: snippet annotations are disabled cluster-wide (the admission webhook refuses them), and even enabled, the snippet renders after the controller's own `proxy_set_header X-Forwarded-Host $best_http_host` in the same location, where nginx sends both values rather than letting the later one win. Traefik writes the X-Forwarded-* set at the entrypoint, before middlewares run, so a headers middleware with an empty value actually removes it — verified against v3.3, and the dids Ingress now carries one per user namespace. The controller swap subsumes the rest: - ingressClassName is Traefik's, hardcoded in k8s.IngressClass. A different controller needs different entrypoint settings, default certificate and ACME solver class too, so one env var could never carry the switch. - The Ingresses lose every annotation. HTTP→HTTPS is now an entrypoint redirect and the wildcard certificate comes from the `default` TLSStore, so there is nothing left for them to say. The wildcard moves to kube-system because a TLSStore can only reference a Secret in its own namespace. - The HTTP-01 solver names the traefik class; Let's Encrypt follows the entrypoint redirect and does not validate the certificate it lands on. scripts/migrate-ingress-to-traefik.sh repoints Ingresses that already exist — this API only ever creates them, so without it they keep the nginx class and Traefik never adopts them. Dry-run by default, and it reports the chart-managed Ingresses it deliberately does not touch rather than editing a chart's output. Two things the dev migration taught, both recorded where they will be read: Helm accepts a values path that is one level off without complaining, so the entrypoint keys must be verified against the rendered args and not this file; and managed hostnames are proxied through Cloudflare, so verification has to pin the node IP or it reports Cloudflare's certificate instead of ours. Signed-off-by: vthwang <vthwang.work@gmail.com>
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.
Resolved #26