Repository navigation
feat(edge): per-EdgeRoute downstream TLS via SDS + HTTP→HTTPS redirect - #244
Merged
Merged
Conversation
Replace the v1 file-mounted single-cert edge TLS (#239) with real ingress TLS: per-host certs, hot rotation, and an HTTP->HTTPS redirect. - EdgeRoute.spec.tls{secret_name, provider} references a cert (BYO / cert-manager). provider is a SecretProvider ENUM (kubernetes now; aws-secrets-manager reserved). - New agent/internal/edge/secret: a pluggable Provider interface + Registry (enum dispatch, provider-prefixed SDS names "<scheme>/<ref>"); kubernetesProvider reads a kubernetes.io/tls Secret. New backends = new enum value + Provider impl, no listener/SDS changes. - The edge agent watches EdgeRoutes + their Secrets, resolves cert bytes, and serves them to Envoy over the agent's ADS SecretType channel (cache.SetSecrets, free since upstream certs come from SPIRE directly). Envoy selects the cert by SNI. Rotation is event-driven (Secret watch) with no pod roll. - Listeners: TLS-terminating listener on httpsPort (one DownstreamTlsContext with N SDS certs, no client cert, min TLS 1.2, ALPN h2/http1.1) + a :80 listener that 301-redirects to https. Plain HTTP when TLS off. - Chart: edge.tls.enabled (+ edge.httpsPort, service.httpsPort); deployment passes --edge-tls/--edge-https-port, adds the :443 port + HTTPS readiness, NET_BIND_SERVICE covers 443; Service exposes https; edge Role gains secrets get/list/watch. Drops the mounted-Secret path. chart 0.11.0 -> 0.12.0. Removed: the file-based EdgeTLS struct, edge-tls cert/key flags, mounted Secret. Tests: kubernetesProvider + Registry (fake client); SDS downstream socket (ADS, no client cert, TLS params); redirect listener (301 https); cache TLS-mode two-listener set + SecretType cert; reconciler resolves provider/ref -> SDS name + bytes (and tolerates an unresolvable ref). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Pihqn5RmVPhV9HTdBnqbvY
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.
What
Real ingress TLS for the edge, replacing the v1 file-mounted single cert (#239): per-host certs, hot rotation, and an HTTP→HTTPS redirect.
Design
SecretTypechannel (free — upstream mTLS comes from SPIRE directly). Envoy picks the cert by SNI. Rotation is event-driven (Secret watch) — no pod roll, no static mount.SecretProvider. New pkgagent/internal/edge/secret: aProviderinterface +Registry(enum dispatch, provider-prefixed SDS names<scheme>/<ref>).kubernetesProviderreads akubernetes.io/tlsSecret. Adding AWS Secrets Manager / Vault = a new enum value +Providerimpl, no listener/SDS changes. The selector is a proto enum (SecretProvider) for schema validation.httpsPort(oneDownstreamTlsContext, N SDS certs, no client cert, min TLS 1.2, ALPN h2/http1.1) + a:80listener that 301-redirects to https. Plain HTTP when TLS off.edge.tls.enabled(+httpsPort,service.httpsPort): the deployment passes--edge-tls/--edge-https-port, adds the:443port + HTTPS readiness (NET_BIND_SERVICEcovers 443), the Service exposeshttps, and the edge Role gainssecrets get/list/watch. The mounted-Secret path is gone. Chart0.11.0 → 0.12.0.Tests
kubernetesProvider+Registry(fake client, enum dispatch, SDS-name prefix, error cases); SDS downstream socket (ADS source, no client cert, TLS params/ALPN); redirect listener (301 https); cache TLS-mode two-listener set +SecretTypecert; reconciler resolvesprovider/ref → SDS name + bytesand tolerates an unresolvable ref. Full build, 28 test targets, lint, format, and chart-version-bump pass; chart renders TLS on/off.Follow-ups
e2e on talos-main (publish → deploy from the published chart): a
kubernetes.io/tlsSecret +EdgeRoute.tls,curl -k --resolve … https://…→ 200,:80→ 301, and a Secret rotation reflected without a pod roll. Out of scope: client mTLS at the edge, chart-rendered cert-managerCertificate, default/fallback cert for SNI misses.🤖 Generated with Claude Code