E535 TLSRoute: Set MaxItems=1 for rules[] in v1alpha3 by rostislavbobo · Pull Request #3971 · kubernetes-sigs/gateway-api · GitHub
[go: up one dir, main page]

Skip to content

Conversation

rostislavbobo
Copy link
Member

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR sets TLSRoute.rules[] MaxItems to 1. Currently, TLSRouteRule only has backendRefs and no matches. Supporting more than one TLSRouteRule does NOT make much sense at this moment.

Which issue(s) this PR fixes:

Fixes #3970

Does this PR introduce a user-facing change?:

- Sets MaxItems=1 for TLSRoute.rules[] in v1alpha3.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 1, 2025
@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 1, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @rostislavbobo. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

// +kubebuilder:validation:MaxItems=1
// <gateway:experimental:validation:XValidation:message="Rule name must be unique within the route",rule="self.all(l1, !has(l1.name) || self.exists_one(l2, has(l2.name) && l1.name == l2.name))">
Rules []v1alpha2.TLSRouteRule `json:"rules"`
Rules []v1alpha2.TLSRouteRule `json:"rules,omitempty"`
Copy link
Member Author

Choose a reason for hiding this comment

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

Using omitempty on required fields is the most recent API conventions guidance as it prevents mess in the marshalled API and makes the error messages for structured and unstructured clients consistent (field is required for both, instead of field is required for one, and you didn't provide 1 item for the other)

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you link the guidance doc here ?

Copy link
Member

Choose a reason for hiding this comment

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

More discussion in #3905 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks
would have been ideal if this was split in 2 PRs (non blocking comment)

@rostislavbobo rostislavbobo changed the title TLSRoute: Set rules MaxItems to 1 in v1alpha3 TLSRoute: Set MaxItems=1 for rules[] in v1alpha3 Aug 1, 2025
@robscott
Copy link
Member
robscott commented Aug 1, 2025

Thanks @rostislavbobo! Will leave final LGTM for someone else.

/cc @arkodg @youngnick
/ok-to-test
/approve

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 1, 2025
Copy link
Contributor
@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

/approve

thanks

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: arkodg, robscott, rostislavbobo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@youngnick
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 4, 2025
@k8s-ci-robot k8s-ci-robot merged commit b6b2428 into kubernetes-sigs:main Aug 4, 2025
8 checks passed
@rostislavbobo rostislavbobo deleted the tlsroute-rules branch August 4, 2025 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restrict TLSRoutes rules length to 1
5 participants
0