Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement L4 traffic matching #976

Merged
merged 2 commits into from
Jan 18, 2022

Conversation

shaneutt
Copy link
Member

@shaneutt shaneutt commented Jan 3, 2022

What type of PR is this?

/kind feature
/kind api-change

What this PR does / why we need it:

This implements GEP 735.

Does this PR introduce a user-facing change?:

- optional L4 traffic matching has been added for `TCPRoute` and `UDPRoute`

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 3, 2022
@k8s-ci-robot k8s-ci-robot requested review from bowei and robscott January 3, 2022 17:58
@shaneutt shaneutt marked this pull request as ready for review January 3, 2022 18:12
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 3, 2022
// implementation to handle (and add validation for) according to their
// own needs.
//
// For IPAddress the implementor may expect either IPv4 or IPv6.
Copy link
Contributor

Choose a reason for hiding this comment

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

Upstream differentiates between v4 and v6:

Should we?

Furthermore, do we need to think of cases where an implementation doesn't support IPv6 for any reason? Too hypothetical?

Copy link
Member Author

Choose a reason for hiding this comment

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

Upstream differentiates between v4 and v6 should we?

My initial thoughts are: one reason we might want to differentiate would be if one or the other is not available on the Gateway network (e.g. the Gateway only has IPv4 OR IPv6). Given that we're simply using the existing IPAddress type which already supported both IPv4 and IPv6 I feel like we would need a strong reason and a separate body of work to add this differentiation as it seems possible it would end up being backwards incompatible.

Furthermore, do we need to think of cases where an implementation doesn't support IPv6 for any reason? Too hypothetical?

To expand on that I think there could be cases where IPv4 isn't supported too, but as you've already suggested I personally wouldn't want to spend cycles trying to predict these kinds of situations. We have until February (at least) before we're going to start talking beta release, there's time in the interim for such use cases to present themselves.

Copy link
Contributor

Choose a reason for hiding this comment

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

Given that we're simply using the existing IPAddress type which already supported both IPv4 and IPv6 I feel like we would need a strong reason and a separate body of work to add this differentiation as it seems possible it would end up being backwards incompatible.

Let's discuss this in the office hour today. We will be asked about dual-stack as soon as this API hits beta and we need to have a good answer/plan for it. Best to follow upstream closely.

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad. No meeting today.
cc @robscott who may be more familiar with upstream dual-stack work

Copy link
Member

Choose a reason for hiding this comment

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

Upstream differentiates between v4 and v6

Although that's true, at least part of that was motivated by simpler implementation. For example, EndpointSlices initially started with a single IPAddress type in v1alpha1 that was replaced with separate v4 and v6 types in large part to simplify proxy implementations where v4 and v6 addresses were handled entirely separately.

It does seem like it would be useful to be able to request the IP families you want to have assigned to a Gateway. I'm less sure that it's helpful to have separate matching types for v4 and v6 addresses. In that case, the families can already be derived by the value provided and a separate type does not seem as useful to me.

@khenidak has been most involved in upstream dual stack work, what do you think about representing IP matching? Should we have separate address types per IP family or rely on deriving that information from the address/cidr itself?

Copy link
Member Author

Choose a reason for hiding this comment

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

This comment seems to be the lingering question, but has not gotten any further feedback in over a week. Given that this PR is not actually changing how we differentiate between v4 and v6 (this uses the pre-existing AddressType which already accepts both) I would like to suggest that we should split out reworking how we configure and differentiate IP versions into a separate GEP or body of work so that it doesn't have to hold this PR up?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am looking at this now for CRDs (outside of Gateway) and I am leaning to follow Service which uses ipfamilies to follow existing semantics.
To easily express: match ipv6 traffic, match ipv4 traffic, match both
@shaneutt is that what you are thinking AddressType would do, equivalent-ish to Service ipfamilies?
This could allow matching on family alone without requiring the person to define a match pattern.
To your point, always requiring a match pattern to signify anything other than 'both' is only one key.

Copy link
Member Author

Choose a reason for hiding this comment

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

If I'm understanding correctly, yes that's basically what I had in mind.

Copy link
Contributor

Choose a reason for hiding this comment

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

As the value is a specific Value, having an additional IP family field seems to be redundant.

Minor style point, we should write all of the comment from the perspective of the users (the implemetors should...) style comments need to live somewhere else...

@shaneutt shaneutt force-pushed the shaneutt/gep-735-impl branch from e4a659b to 7acd39e Compare January 3, 2022 19:10
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 3, 2022
@shaneutt shaneutt requested a review from hbagdi January 3, 2022 20:15
@shaneutt shaneutt force-pushed the shaneutt/gep-735-impl branch 2 times, most recently from e8bf1e6 to 50a44ae Compare January 4, 2022 15:34
@shaneutt shaneutt requested review from jpeach and hbagdi January 4, 2022 15:37
@shaneutt shaneutt force-pushed the shaneutt/gep-735-impl branch 2 times, most recently from 694e320 to dbf2e9a Compare January 4, 2022 19:13
Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this @shaneutt! Mostly LGTM, just a few small nits.

@shaneutt shaneutt force-pushed the shaneutt/gep-735-impl branch from dbf2e9a to 2ed1120 Compare January 5, 2022 13:43
@shaneutt shaneutt requested review from jpeach and robscott January 5, 2022 13:44
@shaneutt shaneutt force-pushed the shaneutt/gep-735-impl branch from 2ed1120 to 9f92464 Compare January 12, 2022 18:41
Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks for all the work on this @shaneutt! I think you and @jpeach may be working on bigger changes here, but just remembered that we need to guard all these new fields as experimental to start, so added some comments related to that.

@shaneutt shaneutt force-pushed the shaneutt/gep-735-impl branch from 22c4509 to e0e4b27 Compare January 12, 2022 19:06
@shaneutt shaneutt force-pushed the shaneutt/gep-735-impl branch 2 times, most recently from 7cf4ea9 to 12d3364 Compare January 13, 2022 14:11
@shaneutt shaneutt requested a review from robscott January 13, 2022 14:21
@shaneutt shaneutt force-pushed the shaneutt/gep-735-impl branch 5 times, most recently from 3ed1799 to 6e1cccf Compare January 13, 2022 14:53
@robscott
Copy link
Member

Thanks for the work on this @shaneutt! This LGTM other than a couple tiny nits.

@shaneutt shaneutt force-pushed the shaneutt/gep-735-impl branch from fa3da8d to bb3672a Compare January 18, 2022 15:11
@shaneutt shaneutt requested a review from robscott January 18, 2022 15:12
@shaneutt shaneutt force-pushed the shaneutt/gep-735-impl branch 2 times, most recently from 17a89db to 5f448f5 Compare January 18, 2022 18:22
@robscott
Copy link
Member

Thanks @shaneutt!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 18, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: robscott, shaneutt

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 18, 2022
@k8s-ci-robot k8s-ci-robot merged commit dcf4c5b into kubernetes-sigs:master Jan 18, 2022
@shaneutt shaneutt deleted the shaneutt/gep-735-impl branch January 18, 2022 18:40
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/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants