Skip to content

Conversation

@jenshu
Copy link
Contributor

@jenshu jenshu commented Jun 12, 2025

Description

Allow configuring app protocol on Static Backends.

Fixes #10622

Change Type

/kind new_feature

Changelog

Allow configuring app protocol on Static Backends.

Additional Notes

@github-actions github-actions bot added kind/feature Categorizes issue or PR as related to a new feature. release-note labels Jun 12, 2025
}

// AppProtocol defines the application protocol to use when communicating with the backend.
// +kubebuilder:validation:Enum=http2;grpc;grpc-web;kubernetes.io/h2c;kubernetes.io/ws
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure if we want to be restrictive here or just allow any string

Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense to restrict. is there a reason a user would have an arbitrary string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is there a reason a user would have an arbitrary string?

reasons for allowing any string:

  • k8s Service allows any string
  • they might be using protocols that we don't explicitly handle

reasons for using enum:

  • it spells out the protocols that we explicitly support
  • anything else would map to the same 'default' protocol which is effectively the same as leaving it blank

Signed-off-by: Jenny Shu <[email protected]>
Comment on lines +226 to +227
// +optional
// +kubebuilder:validation:Optional
Copy link
Contributor

Choose a reason for hiding this comment

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

do you need both lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm not sure, in some other places we are using both as well. i'll try removing one and see if it makes a difference

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so it seems they are redundant, but i think i want to do a pass in a separate PR to clean up all the kubebuilder markers (i noticed typos in some of them)

---
apiVersion: v1
kind: Service
apiVersion: gateway.kgateway.dev/v1alpha1
Copy link
Contributor

Choose a reason for hiding this comment

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

why was the service replace with backend? should we have both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good question. i previously had 6 translator tests (Service with each appProtocol+default). now we support the same thing with Backends, and i thought having a new translator test for each app protocol was overkill, so i've changed it to have 3 tests each for Service and Backend (http2, ws, default), and i added unit tests in pkg/pluginsdk/ir/backend_test.go to test the parsing of all the various protocols

@jenshu jenshu added this pull request to the merge queue Jun 12, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 12, 2025
@jenshu jenshu added this pull request to the merge queue Jun 12, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 12, 2025
@jenshu jenshu added this pull request to the merge queue Jun 12, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 12, 2025
@jenshu jenshu added this pull request to the merge queue Jun 12, 2025
Merged via the queue into kgateway-dev:main with commit 526c2c8 Jun 12, 2025
26 of 27 checks passed
@jenshu jenshu deleted the backend-app-protocols branch June 12, 2025 22:42
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.

Support GW API Backend Protocol Selection

3 participants