Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The change drops support for the HTTP/1.1 Upgrade: h2c handshake, so compatibility must be preserved or the break explicitly documented in release notes.
1 open issue
What changed in this PR
Replaces the API server’s deprecated h2c wrapper with native net/http protocol configuration while retaining plaintext serving alongside TLS.
Changes:
- Enables HTTP/1 and unencrypted HTTP/2 on the plaintext listener.
- Simplifies gRPC and REST request dispatch by removing the
h2cwrapper. - Reclassifies
golang.org/x/netas an indirect dependency.
| File | Description |
|---|---|
go.mod |
Moves golang.org/x/net to indirect dependencies. |
cmd/api/main.go |
Configures native plaintext HTTP/2 and removes deprecated transport imports and wrapping. |
Review effort: Balanced
| // for gRPC clients, using net/http's native Protocols support. | ||
| var cleartextProtocols http.Protocols | ||
| cleartextProtocols.SetHTTP1(true) | ||
| cleartextProtocols.SetUnencryptedHTTP2(true) |
There was a problem hiding this comment.
Documented the issue as a breaking change. It's more of a theoretical issue, but indeed it should be properly indicated.
From doc: Package h2c is deprecated and unsupported. This package used to support unencrypted HTTP/2. Unencrypted HTTP/2 is now supported directly by the net/http package. We need to further remove support for unencrypted connections, at least the fallback more, but it's a breaking change and we'll do it separately. Known compatibility change: The plaintext (no-TLS) serving path now uses Go's native unencrypted HTTP/2 support (net/http's Protocols.SetUnencryptedHTTP2) instead of golang.org/x/net/http2/h2c. This supports HTTP/2 cleartext via "prior knowledge" (RFC 7540 §3.4), which is what gRPC client libraries use. It does not support the legacy HTTP/1.1 Upgrade: h2c handshake (RFC 7540 §3.2). Clients that negotiate h2c via the Upgrade mechanism rather than prior knowledge will no longer be able to establish HTTP/2 on the plaintext port.
390c947 to
2ab3995
Compare
|
@olegbet: changing LGTM is restricted to collaborators DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: olegbet The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Could we add a focused test for the plaintext server path? It should verify that a gRPC client using insecure credentials can connect over HTTP/2 and that a normal HTTP/1.1 REST request still works. Optionally, it could also confirm that an |

From doc: Package h2c is deprecated and unsupported. This package used to support unencrypted HTTP/2. Unencrypted HTTP/2 is now supported directly by the net/http package.
We need to further remove support for unencrypted connections, at least the fallback mode, but it's a breaking change and we'll do it separately.
Changes
/kind cleanup
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you review them:
/kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes