ingress: add h2c_upstream annotation - #1516
Merged
Merged
Conversation
Pomerium core supports plaintext HTTP/2 upstreams via the h2c:// scheme in route `to` URLs, but Ingress resources had no way to request it since the controller builds `to` URLs from Service/Endpoints and picks the scheme itself. Add an `h2c_upstream` boolean annotation, modeled on `secure_upstream`, that emits h2c:// upstream URLs. It is rejected when combined with `secure_upstream` (or ssh/tcp/udp upstream annotations) since the schemes are mutually exclusive per route. Existing precedence among the older scheme annotations is unchanged.
Greptile SummaryThis PR adds plaintext HTTP/2 upstream support for Ingress routes.
Confidence Score: 5/5The PR appears safe to merge, with h2c URL generation and mutually exclusive scheme handling implemented consistently. No actionable failures remain: h2c reaches all Ingress service-resolution modes, validation executes before route construction, and legacy scheme precedence is unchanged.
|
| Filename | Overview |
|---|---|
| model/ingress_config.go | Defines the h2c annotation and exposes it through the existing boolean annotation mechanism. |
| pomerium/ingress_annotations.go | Classifies h2c as an annotation handled during upstream URL construction. |
| pomerium/ingress_to_route.go | Validates mutually exclusive schemes and selects h2c through a precedence-preserving shared table. |
| pomerium/routes_test.go | Covers h2c endpoint URL generation and every newly prohibited scheme combination. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Ingress annotations] --> B[validateUpstreamAnnotations]
B -->|h2c plus another scheme| C[Return validation error]
B -->|valid combination| D[Build route]
D --> E[getUpstreamScheme]
E --> F[Resolve service hosts]
F --> G[Emit scheme://host URLs]
G --> H[pb.Route.To]
Reviews (1): Last reviewed commit: "ingress: add h2c_upstream annotation" | Re-trigger Greptile
calebdoxsey
approved these changes
Sep 9, 2026
wasaga
added a commit
to pomerium/documentation
that referenced
this pull request
Sep 9, 2026
Adds the new ingress.pomerium.io/h2c_upstream annotation to the Ingress annotations reference and a short HTTP/2 Cleartext Upstreams section under Services, noting it cannot be combined with secure_upstream. Companion to pomerium/ingress-controller#1516.
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.
Summary
Pomerium core supports plaintext HTTP/2 upstreams via the
h2c://scheme in routetoURLs, but Ingress resources had no way to request it: the controller buildstoURLs from Service/Endpoints and picks the scheme itself.ingress.pomerium.io/h2c_upstream: "true"annotation, modeled onsecure_upstream, that emitsh2c://upstream URLs.h2c_upstreamwhen combined withsecure_upstream(orssh_upstream/tcp_upstream/udp_upstream), since the schemes are mutually exclusive per route and core would otherwise silently degrade mixed lists to HTTP/1.1.Example
Combining it with
secure_upstreamfails with:Test plan
make test(envtest +pomerium/ctrl) passesgolangci-lint run ./...cleanTestEndpointsHTTPSforh2c://endpoint URLsTestH2CUpstreamConflictscovering all four conflicting annotation pairsDocumentation PR: pomerium/documentation#2361