Skip to content

infra: configure envoy gateway with cert-manager support#131

Open
TineoC wants to merge 8 commits intoCodeForPhilly:mainfrom
TineoC:feat/gateway-api
Open

infra: configure envoy gateway with cert-manager support#131
TineoC wants to merge 8 commits intoCodeForPhilly:mainfrom
TineoC:feat/gateway-api

Conversation

@TineoC
Copy link
Copy Markdown
Contributor

@TineoC TineoC commented Mar 21, 2026

Changes

  • Add cert-manager.io/cluster-issuer: letsencrypt-prod annotation to main-gateway
  • This enables automatic certificate provisioning when cert-manager is configured with enableGatewayAPI: true.

Depends on: #134

@TineoC
Copy link
Copy Markdown
Contributor Author

TineoC commented Mar 21, 2026

This implementation is not entirely correct yet,

 Option 1: The "Shared Secret" Approach (Recommended for your current setup)
  Since your Gateway already references a single secret (main-gateway-tls), the cleanest way to satisfy
  cert-manager while supporting multiple projects is to list all hostnames on the Gateway listener. 

  cert-manager will then generate a single certificate (SAN) that covers all the listed domains.

    1 # infra/envoy-gateway-manifests/gateway.yaml
    2     - name: https
    3       protocol: HTTPS
    4       port: 443
    5       hostname: "*.sandbox.k8s.phl.io" # Use a wildcard if your DNS supports it
    6       # OR list them explicitly if they are different domains:
    7       # hostname: sandbox.balancerproject.org 
    8       allowedRoutes:
    9         namespaces:
   10           from: All
   11       tls:
   12         mode: Terminate
   13         certificateRefs:
   14           - name: main-gateway-tls

  Option 2: The "Merged Listeners" Approach
  If you want each project to have its own Certificate and Secret (e.g., balancer-tls, echo-http-tls),
  you define multiple listeners on the same port (443) with different names and specific hostnames. Envoy
  Gateway will automatically merge these onto the same physical port using SNI.

    1 # infra/envoy-gateway-manifests/gateway.yaml
    2   listeners:
    3     - name: balancer-https
    4       protocol: HTTPS
    5       port: 443
    6       hostname: sandbox.balancerproject.org
    7       tls:
    8         mode: Terminate
    9         certificateRefs:
   10           - name: balancer-tls
   11     - name: echo-https
   12       protocol: HTTPS
   13       port: 443
   14       hostname: echo-http.sandbox.k8s.phl.io
   15       tls:
   16         mode: Terminate
   17         certificateRefs:
   18           - name: echo-http-tls

I would like to hear your thoughts if you prefer to have a single cert for everyone or per-project certs

@themightychris
Copy link
Copy Markdown
Member

@TineoC thanks for your work on this! Sorry for my slow turnaround on a review, I'll keep a tight loop going forward

Ugh I hate Gateway API lol... or at least that they're forcing us into this new paradigm because it's better for enterprise use cases

My instinct is option 2 but I'm not sure what the downsides would be

Looking at cert-manager's blog post about this challenge it looks like ListenerSet landed in February and is in the v1.5 CRDs you configured—could you take a look at the support for that and how it would work in Envoy?

Also your hologit configs are a bit messed up, you can use:

npx skills add --global JarvusInnovations/hologit

to enable your agent to set up and test and debug it

@TineoC
Copy link
Copy Markdown
Contributor Author

TineoC commented Apr 18, 2026

https://cert-manager.io/announcements/2025/11/26/ingress-nginx-eol-and-gateway-api/#listenerset-the-missing-building-block The listener set resource looks promising, it would keep the setup similar to what we do while maintaining multi-tenancy.

image

@TineoC
Copy link
Copy Markdown
Contributor Author

TineoC commented Apr 18, 2026

Version 1.20 of cert-manager added support for ListenerSet. Would you like to upgrade to this one and try this out? https://cert-manager.io/docs/releases/release-notes/release-notes-1.20/#v1200

TineoC added 6 commits April 18, 2026 18:39
…olve cycle

This change fixes a cyclic dependency in the hologit configuration for the k8s-manifests branch by removing redundant 'before' constraints and cleaning up the mapping directory structure. It also removes a misplaced mapping file.
This change implements the self-service TLS model using Gateway API v1.5 ListenerSets. The main-gateway is updated to allow ListenerSets from all namespaces, and the balancer project is configured with its own ListenerSet and HTTPRoute.
…oad to listenerset

This change removes annotations and explicit listeners from the main-gateway resource, delegating that responsibility entirely to ListenerSet resources as requested. The balancer ListenerSet is updated to include both HTTP and HTTPS listeners.
Removing ListenerSet and HTTPRoute manifests from this repo as they will be managed in the balancer-main repository instead.
Restoring gateway-listeners.yaml and http-route.yaml to the kustomization.yaml resources list. While these files are no longer stored in this repository, they are expected to be provided via hologit projection from the balancer-main source.
This change updates the balancer kustomization to reference the new projected manifests (gateway-listeners.yaml and httproute.yaml) and replaces the legacy Ingress patches with ListenerSet/HTTPRoute patches.
@TineoC
Copy link
Copy Markdown
Contributor Author

TineoC commented Apr 18, 2026

CodeForPhilly/balancer-main#482 this one is ready to merge

@TineoC
Copy link
Copy Markdown
Contributor Author

TineoC commented Apr 18, 2026

Could you help me with upgrading cert-manager to 1.20? I still don't fully grasp how those manifests are being deployed into the cluster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants