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

Adding new PartiallyInvalid condition for Routes #2429

Merged
merged 1 commit into from Oct 9, 2023

Conversation

robscott
Copy link
Member

What type of PR is this?
/kind feature

What this PR does / why we need it:
This adds a new condition along with corresponding guidance for how to handle Routes that are partially invalid.

Note: I can't think of any way to write conformance tests for this condition since the most likely way to get into this state is when an implementation can't support a feature configured in a Route.

Which issue(s) this PR fixes:
Fixes #1696.

Does this PR introduce a user-facing change?:

New "PartiallyInvalid" condition has been added for all Route types.

/hold for consensus

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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 Sep 25, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: robscott

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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 25, 2023
@shaneutt shaneutt added this to the v1.0.0 milestone Sep 25, 2023
@shaneutt shaneutt added the release-blocker MUST be completed to complete the milestone label Sep 25, 2023
Copy link
Member

@shaneutt shaneutt left a comment

Choose a reason for hiding this comment

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

I think having these two options and saying that you MUST do one or the other makes sense, because we don't want to have completely undefined behavior for partial invalidity between implementations.

I suppose conformance tests shouldn't be too hard, it will be like opting into a "feature" from a test triggering point of view, except you MUST opt for one or the other behaviors.

It seems like really late in the cycle for v1.0.0 we're seeing a few more of these "do one or the other" kind of things crop up (also see #2416), which definitely gives me a bit of pause.

I think at a high level I'm on board because this is an improvement for users over the previously undefined behavior, I definitely think we should make sure a greater number of community members look it over too though.

/cc @arkodg @sunjayBhatia @LiorLieberman @candita @gcs278 @mlavacca @kflynn @michaelbeaumont @rainest @Xunzhuo

@youngnick
Copy link
Contributor

I would really have preferred that we could pick one or the other, but from discussion, it seems that we can't, so this is the next best thing.

LGTM, but will leave it for others to review.

Comment on lines +372 to +414
// last known good state of the entire Route. The message for this
// condition MUST start with the prefix "Fall Back" and include
Copy link
Contributor

Choose a reason for hiding this comment

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

Using message as a typed/specified thing seems a bit odd/unexpected/nonstandard?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, but there we don't have another way to indicate this information, and we really need to have some guidance around this before GA. Ideas welcomed, I guess.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe adding new condition types with this info would work? Another condition that would only be set if PartiallyInvalid is also set

- type: PartiallyInvalid
  status: true
  reason: UnsupportedValue
  message: ...
- type: PartiallyInvalid[DropRouteRule|RouteFallBack]
  status: true
  reason: Implementation[DropsRulesOnPartialInvalidity|FallsBackOnPartialInvalidity]
  message: ...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, agree this is a bit wonky, but I don't love the alternatives here. @sunjayBhatia's idea to add additional conditions to more clearly reflect this state may actually be something we need to do in the future, but I'd like to see if we can survive without adding more conditions first. If we try it out and determine that it would really be best to add additional conditions, we can do that later.

apis/v1beta1/shared_types.go Outdated Show resolved Hide resolved
@mikemorris
Copy link
Contributor

mikemorris commented Oct 3, 2023

My biggest concern with this proposal is that I haven't seen any implementations explicitly state their desire to support it yet - I agree that we need to do something to resolve the discrepancy between spec documentation and GEP-1364, but I'm not sure if we want to add this to resolve a somewhat-abstract problem before determining this is the solution that at least some implementations actually want, especially given that dropping invalid rules is not without risks.

Copy link
Member

@sunjayBhatia sunjayBhatia left a comment

Choose a reason for hiding this comment

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

Looks like most concerns I would have are captured by comments from others 👍🏽

Another outcome of this spec change/resolving the linked issue IMO would be agreeing on a plan on how to test this in conformance, especially given we have a MUST statement added (When this happens, implementations MUST take one of the following approaches). If we can come up with route rules that pass CEL validation but are universally invalid (not just implementation-specific invalid) my first thought is to add testing like:

  • Add a new core feature, SupportsPartiallyInvalidRoutes (name tbd) and test that makes sure the status is set to true when there is a partially invalid route, likely ignoring reason/message
  • Add a couple new extended features, SupportsPartiallyInvalidRoutes[DropRule|Fallback]
  • Implementations would opt-in to the test they support
  • We can modify a route to becoming partially invalid and test the invalid rule is dropped or the old configuration is respected, depending on what test is run
  • Status checked for the right values depending on what test is run

I can include this comment in the original issue for this feature or a new one if that makes sense instead!

@sunjayBhatia
Copy link
Member

My biggest concern with this proposal is that I haven't seen any implementations explicitly state their desire to support it yet - I agree that we need to do something to resolve the discrepancy between spec documentation and GEP-1364, but I'm not sure if we want to add this to resolve a somewhat-abstract problem before determining this is the solution that at least some implementations actually want, especially given that dropping invalid rules is not without risks.

In Contour we haven't explicitly stated in our Gateway API support/in the community discussions about this, but representing partial validity has been a bit of an issue in our own CRD/status/etc., so I'm enthusiastic about trying to do this in a standardized way with representing in status what is going to happen to invalid routes.

// This condition indicates that the Route contains a combination of both
// valid and invalid rules.
//
// When this happens, implementations MUST take one of the following
Copy link
Member

Choose a reason for hiding this comment

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

I like that the two options described below are explicitly stated. In Contour we've had a somewhat inconsistent mix in our own CRD throughout history of "dropping" invalid rules, programming 5xx responses for invalid rules while preserving valid ones, attempting to program as much of an invalid rule as we can but giving warnings/errors in status about invalid attributes of a rule, etc., which all make for a bit of an inconsistent UX. Explicitly giving users feedback in status about what is happening is a step forward IMO.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, completely agree, I think many implementations have inconsistent behavior here.

@robscott
Copy link
Member Author

robscott commented Oct 6, 2023

Another outcome of this spec change/resolving the linked issue IMO would be agreeing on a plan on how to test this in conformance, especially given we have a MUST statement added (When this happens, implementations MUST take one of the following approaches). If we can come up with route rules that pass CEL validation but are universally invalid (not just implementation-specific invalid) my first thought is to add testing like:

  • Add a new core feature, SupportsPartiallyInvalidRoutes (name tbd) and test that makes sure the status is set to true when there is a partially invalid route, likely ignoring reason/message
  • Add a couple new extended features, SupportsPartiallyInvalidRoutes[DropRule|Fallback]
  • Implementations would opt-in to the test they support
  • We can modify a route to becoming partially invalid and test the invalid rule is dropped or the old configuration is respected, depending on what test is run
  • Status checked for the right values depending on what test is run

Agree that this would make a good follow up. I created #2458 based on this.

@robscott
Copy link
Member Author

robscott commented Oct 6, 2023

Thanks to everyone for the feedback! I think I've resolved everything now, PTAL.

@robscott
Copy link
Member Author

robscott commented Oct 6, 2023

I think we've got enough consensus here, going to remove the hold so the next LGTM merges this.

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 6, 2023
@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 Oct 9, 2023
@k8s-ci-robot k8s-ci-robot merged commit 8402518 into kubernetes-sigs:main Oct 9, 2023
8 checks passed
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. release-blocker MUST be completed to complete the milestone release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Define how to reflect partial validity of routing rules in the HTTPRoute status
7 participants