Which Gateway, certificates, and DNS front the public surface? #63

Closed
opened 2026-11-23 22:29:06 -05:00 by bobby · 2 comments
Owner

Part of #44

Question

How does public HTTPS :443 reach hAPI? Decide:

  • The Gateway API implementation: Cilium's built-in Gateway (Cilium is already the CNI, per ADR-0003) vs a standalone controller such as Envoy Gateway.
  • TLS: cert-manager with ACME DNS-01, since :80 is closed (ADR-0002). Which ACME CA, and how the DNS API credential is scoped.
  • The DNS provider for hAPI's hostname(s), and whether it has an API cert-manager supports.
  • Public-edge hardening without a CDN: rate limiting and connection limits, request size limits, TLS policy.
  • NodeBalancer and its Cloud Firewall: inbound 443 only through the CCM firewall-id annotation, Proxy Protocol to preserve client IPs, and VPC backends.
Part of #44 ## Question How does public HTTPS :443 reach hAPI? Decide: - The **Gateway API implementation**: Cilium's built-in Gateway (Cilium is already the CNI, per ADR-0003) vs a standalone controller such as Envoy Gateway. - **TLS**: cert-manager with **ACME DNS-01**, since :80 is closed (ADR-0002). Which ACME CA, and how the DNS API credential is scoped. - The **DNS provider** for hAPI's hostname(s), and whether it has an API cert-manager supports. - **Public-edge hardening without a CDN**: rate limiting and connection limits, request size limits, TLS policy. - **NodeBalancer and its Cloud Firewall**: inbound 443 only through the CCM `firewall-id` annotation, Proxy Protocol to preserve client IPs, and VPC backends.
bobby added the wayfinder:grilling label 2026-11-23 22:29:06 -05:00
Author
Owner

Constraint from How are secrets stored and delivered? (#57, ADR-0008): the DNS-01 credential must be its own narrowly scoped token, limited to the hAPI zone and DNS edits only. It's committed SOPS-encrypted under deploy/**/*.sops.yaml and decrypted by Flux, so the Flux Kustomization that carries it needs decryption.provider: sops. It's mounted as a file or referenced as a Secret, never inlined. Prefer a DNS provider whose API supports per-zone, least-privilege tokens.

Constraint from **How are secrets stored and delivered?** (#57, [ADR-0008](https://git.bobbypalko.com/bobby/hapi/src/branch/main/docs/adr/0008-sops-secrets-in-git.md)): the DNS-01 credential must be its own **narrowly scoped token**, limited to the hAPI zone and DNS edits only. It's committed **SOPS-encrypted** under `deploy/**/*.sops.yaml` and decrypted by Flux, so the Flux Kustomization that carries it needs `decryption.provider: sops`. It's mounted as a file or referenced as a Secret, never inlined. Prefer a DNS provider whose API supports per-zone, least-privilege tokens.
bobby self-assigned this 2026-11-25 14:23:10 -05:00
Author
Owner

Resolution

Recorded in ADR-0010.

  • Path: hapi.bobbypalko.com, IPv4 only, on an address Tofu reserves. There's no AAAA, because the NodeBalancer's IPv6 address can't be reserved.
  • NodeBalancer: created by the CCM in TCP mode with Proxy Protocol v2, throttle: 20, and VPC backends. Its Cloud Firewall (inbound 443 only) is owned by Tofu.
  • TLS terminates at Envoy Gateway: 2 replicas with a PDB. From there, plain HTTP goes to :8000.
  • Why not Cilium's own Gateway: it lacks rate, connection, size and timeout limits and a TLS minimum-version policy. Cilium's Gateway API is disabled.
  • Edge limits:
    • TLS 1.3 only, h2 and http/1.1, HSTS.
    • Request bodies up to 1 MiB, headers up to 16 KiB.
    • Per IP: about 20 req/s with a burst of 100, and about 50 connections.
    • Timeouts: 30 s per request, 60 s idle.
    • No per-Principal limits.
    • uvicorn trusts XFF only from the Gateway.
  • Certificates:
    • cert-manager with Let's Encrypt over DNS-01, using linode/cert-manager-webhook-linode. Staging and prod issuers, default profile and default renewBefore.
    • _acme-challenge.hapi is a CNAME into a delegated acme.bobbypalko.com zone. The token belongs to a restricted Linode user with domain_admin on that zone only, and is delivered through SOPS.
    • CAA on hapi. pins dns-01 and our accounturi. The ACME account key is generated offline and kept in SOPS, so it survives a rebuild.
  • Verify during the build: that the token is capped by its user's grants, and that Linode serves the delegated subzone. If either fails, switch to acme-dns. Also check that the CCM picks up the annotations from Envoy Gateway's Service.
  • Delivery and observability:
    • Flux HelmReleases, with the Standard-channel Gateway API CRDs.
    • One Gateway in a gateway namespace that only accepts routes from hapi.
    • JSON access logs, without auth headers or query strings, go to VictoriaLogs.
    • Kuma alerts on TLS expiry at 14 days, with vmalert as a backstop.
  • Traefik's ACME was considered and rejected: it rotates certificates just like cert-manager, but OSS can't share ACME state across replicas.
## Resolution Recorded in [ADR-0010](https://git.bobbypalko.com/bobby/hapi/src/branch/main/docs/adr/0010-envoy-gateway-public-edge.md). - **Path:** `hapi.bobbypalko.com`, IPv4 only, on an address Tofu reserves. There's no `AAAA`, because the NodeBalancer's IPv6 address can't be reserved. - **NodeBalancer:** created by the CCM in TCP mode with Proxy Protocol v2, `throttle: 20`, and VPC backends. Its Cloud Firewall (inbound 443 only) is owned by Tofu. - **TLS** terminates at **Envoy Gateway**: 2 replicas with a PDB. From there, plain HTTP goes to `:8000`. - **Why not Cilium's own Gateway:** it lacks rate, connection, size and timeout limits and a TLS minimum-version policy. Cilium's Gateway API is disabled. - **Edge limits:** - TLS 1.3 only, h2 and http/1.1, HSTS. - Request bodies up to 1 MiB, headers up to 16 KiB. - Per IP: about 20 req/s with a burst of 100, and about 50 connections. - Timeouts: 30 s per request, 60 s idle. - No per-Principal limits. - uvicorn trusts XFF only from the Gateway. - **Certificates:** - cert-manager with Let's Encrypt over DNS-01, using `linode/cert-manager-webhook-linode`. Staging and prod issuers, default profile and default `renewBefore`. - `_acme-challenge.hapi` is a CNAME into a delegated **`acme.bobbypalko.com`** zone. The token belongs to a restricted Linode user with `domain_admin` on that zone only, and is delivered through SOPS. - CAA on `hapi.` pins `dns-01` and our `accounturi`. The ACME account key is generated offline and kept in SOPS, so it survives a rebuild. - **Verify during the build:** that the token is capped by its user's grants, and that Linode serves the delegated subzone. If either fails, switch to acme-dns. Also check that the CCM picks up the annotations from Envoy Gateway's Service. - **Delivery and observability:** - Flux `HelmRelease`s, with the Standard-channel Gateway API CRDs. - One Gateway in a `gateway` namespace that only accepts routes from `hapi`. - JSON access logs, without auth headers or query strings, go to VictoriaLogs. - Kuma alerts on TLS expiry at 14 days, with vmalert as a backstop. - **Traefik's ACME** was considered and rejected: it rotates certificates just like cert-manager, but OSS can't share ACME state across replicas.
bobby closed this issue 2026-11-25 14:39:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bobby/hapi#63