Skip to content

Conversation

@puertomontt
Copy link
Contributor

@puertomontt puertomontt commented Jun 20, 2025

Description

As part of #11203, expose http2 protocol options.
This pr exposes:

  • InitialStreamWindowSize
  • InitialConnectionWindowSize
  • MaxConcurrentStreams
  • OverrideStreamErrorOnInvalidHttpMessage

This is implemented such that http2 protocol options will only be applied to "http2" backends. For non-http2 backends, a warning is logging when the backend is processed.

Change Type

/kind new_feature

Changelog

add http2 protocol options to backendconfigpolicy

Additional Notes

Copilot AI review requested due to automatic review settings June 20, 2025 21:52

This comment was marked as outdated.

@github-actions github-actions bot added do-not-merge/kind-invalid Indicates a PR lacks a `kind/foo` label and requires one. do-not-merge/release-note-invalid Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 20, 2025
@puertomontt puertomontt changed the title http2 protocol options backendconfigpolicy: http2 protocol options Jun 20, 2025
@github-actions github-actions bot added kind/feature Categorizes issue or PR as related to a new feature. release-note and removed do-not-merge/kind-invalid Indicates a PR lacks a `kind/foo` label and requires one. do-not-merge/release-note-invalid Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 20, 2025
Signed-off-by: omar <[email protected]>
Signed-off-by: omar <[email protected]>
Signed-off-by: omar <[email protected]>
Signed-off-by: omar <[email protected]>
…http2 protocol options (this means http2 backend). otherwise it is possible to set http2 protocol opts erroneously (e.g. common http protocol opts configured)

Signed-off-by: omar <[email protected]>
Signed-off-by: omar <[email protected]>
Signed-off-by: omar <[email protected]>
we should never call MutateHttpOptions as a "no-op" because it will create an invalid cluster with empty HttpProtocolOptions. so just check the backend is HTTP2 app protocol.

Signed-off-by: omar <[email protected]>
@puertomontt puertomontt requested a review from Copilot June 24, 2025 19:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the backend configuration policy to support HTTP/2 protocol options by exposing new configuration fields and translating them appropriately for Envoy. The key changes include:

  • Adding translation functions and apply logic for HTTP/2 protocol options.
  • Updating tests to cover HTTP/2 and non-HTTP/2 backends.
  • Extending CRD schemas and apply configuration to support the new HTTP/2 options.

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/kgateway/translator/gateway/testutils/outputs/backendconfigpolicy/http2.yaml Added output definitions for clusters with HTTP/2 protocol options.
internal/kgateway/translator/gateway/testutils/inputs/backendconfigpolicy/http2.yaml Added test inputs including HTTP/2 and non-HTTP/2 cases.
internal/kgateway/translator/gateway/gateway_translator_test.go Introduced new test entry for HTTP/2 protocol options.
internal/kgateway/extensions2/plugins/backendconfigpolicy/protocoloptions.go Implemented translation and application functions for HTTP/2 options.
internal/kgateway/extensions2/plugins/backendconfigpolicy/plugin_test.go Expanded tests covering proper handling of HTTP/2 options on backends.
internal/kgateway/extensions2/plugins/backendconfigpolicy/plugin.go Registered and applied HTTP/2 protocol options in the backend process.
install/helm/kgateway-crds/templates/gateway.kgateway.dev_backendconfigpolicies.yaml Updated CRD validation schema to include HTTP/2 protocol options.
api/v1alpha1/backend_config_policy_types.go Defined the Http2ProtocolOptions structure and added related documentation.
api/applyconfiguration/* Added apply configuration support for HTTP/2 protocol options.
Comments suppressed due to low confidence (2)

internal/kgateway/extensions2/plugins/backendconfigpolicy/protocoloptions.go:79

  • [nitpick] Consider adding a clarifying comment that explains the use of MilliValue() for converting resource.Quantity to bytes, to aid future maintainability and clarity.
		out.InitialStreamWindowSize = &wrapperspb.UInt32Value{Value: uint32(http2ProtocolOptions.InitialStreamWindowSize.MilliValue())}

api/v1alpha1/backend_config_policy_types.go:141

  • [nitpick] The comments mention a default value of 268435456 for InitialStreamWindowSize but the translation function does not apply a default. Either document that the default is applied elsewhere or consider applying it here.
type Http2ProtocolOptions struct {

Signed-off-by: omar <[email protected]>
return
}

if backend.AppProtocol != ir.HTTP2AppProtocol {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relying on the backend AppProtocol to determine whether to apply the config.

this was simpler than inspecting the out cluster.

Also note that we can't use MutateHttpOptions to inspect the cluster because it will modify the cluster when called

backend: &ir.BackendObjectIR{},
cluster: &clusterv3.Cluster{},
want: &clusterv3.Cluster{},
wantErr: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should there be an error in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

processBackend doesn't return an error. Right now I only log a warning.

@jenshu jenshu added this pull request to the merge queue Jun 27, 2025
Merged via the queue into kgateway-dev:main with commit 447a144 Jun 27, 2025
21 checks passed
timflannagan added a commit to timflannagan/kgateway that referenced this pull request Jun 27, 2025
… options

This is a follow-up to the kgateway-dev#11455
PR which introduced support for HTTP2 protocol options on the BCP API.

Update the CEL validation used to enforce that http1 & http2 protocol options
cannot be defined together via the new AtMostOneOf marker.

Signed-off-by: timflannagan <[email protected]>
timflannagan added a commit to timflannagan/kgateway that referenced this pull request Jun 27, 2025
… options

This is a follow-up to the kgateway-dev#11455
PR which introduced support for HTTP2 protocol options on the BCP API.

Update the CEL validation used to enforce that http1 & http2 protocol options
cannot be defined together via the new AtMostOneOf marker.

Signed-off-by: timflannagan <[email protected]>
@puertomontt puertomontt deleted the http2 branch June 27, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature. release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants