-
Notifications
You must be signed in to change notification settings - Fork 512
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
GEP-718: consolidation of ServiceName in RouteForwardTo #719
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hbagdi 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 |
site-src/geps/gep-718.md
Outdated
|
||
```go | ||
// RouteForwardTo defines how a Route should forward a request. | ||
type RouteForwardTo struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to put an indicator as to if there are changes to the long comment text
like this?
// no change
// blah blah blah <<
// no change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bowei I added another summarized diff in the proposal for a clearer understanding of what is changing. PTAL.
/hold (in case of accidental merge) This looks reasonable to me LGTM |
site-src/geps/gep-718.md
Outdated
|
||
## Note on future consolidation | ||
|
||
It has been noted that `forwardTo` doesn't flow as good as `backendRefs`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question - why wait to make this consolidation? Every change will be harder in the future and v1alpha2 is the best milestone to make these changes. The forwardTo
block has a big impact on the YAML size and new user experience. Even the most basic Route with no matches must use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have used the word future
more carefully.
I'll be writing another small GEP to dedicate a discussion on this matter and then implement this and the future GEP together for v1a2. This is to reach consensus on unrelated areas sooner. Sort of small atomic decisions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My preference is the structure shown here. I read it as "forward to target X, with parameters A,B,C". I don't think that collapsing improves the readability.
/cc @jpeach @youngnick |
@hbagdi Thanks for writing this up! This generally LGTM and seems reasonable, but I think I'd rather explore the future consolidation in the same GEP, especially if this and the future consolidation would be part of the v1alpha2 release. I'm hesitant to commit to adding the extra yaml (backend.name vs serviceName) without exploring the other options currently listed as either future expansion or alternatives. |
following: | ||
|
||
```yaml | ||
backendRefs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more I've thought about this, I actually think this approach could make the most sense. It's just as concise as the existing API while also being less confusing. I'm a little concerned that there will not be a way to reference/apply policy to a specific item in this list, but that seems like an edge case to me. In most cases that could be resolved by applying policy either to the route rule or to the backend itself.
site-src/geps/gep-718.md
Outdated
// | ||
// +optional | ||
// +kubebuilder:default={kind: "service"} | ||
BackendRef *LocalObjectReference `json:"backendRef,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe TargetRef
, if we are considering names :)
Got it. I'll update the GEP to include this. Expect an update early next week. |
site-src/geps/gep-718.md
Outdated
```yaml | ||
... | ||
forwardTo: | ||
- backendRef: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove the backendRef
field and just have those fields exist in the RouteForwardTo
struct?
You'd end up with this:
forwardTo:
- name: foo-service-v1
port: 80
weight: 80
- name: foo-service-canary
port: 80
weight: 20
---
forwardTo:
- name: foo-v1
kind: server
group: networking.acme.io
port: 80
weight: 80
- name: foo-v1-canary
kind: server
group: networking.acme.io
port: 80
weight: 20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mentioned here (https://github.com/kubernetes-sigs/gateway-api/pull/719/files#diff-200562f21cd2e117d439d1a59d8b3c844217b91f3d6224f34222687e9a8fa5faR267) to move the port/weight fields into the backendRef
struct.
I'm suggesting something similar but just the opposite, moving everything into the forwardTo
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robscott @youngnick Do you know if this is a violation of the upstream API convention or not?
I lean towards an xRef containing only the reference (as API evolves, having such a standard makes the UX much better, envoy is a good example here) but happy to tweak this if that's helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good question. I can't find anything in the k8s API conventions about this. @lavalamp would it ever be acceptable to include concepts like port or weight in an object reference? We're trying to figure out if we can flatten our API a bit. Essentially translating this:
forwardTo:
- backendRef:
group: ""
kind: Service
name: foo
port: 80
weight: 10
to something like this:
backendRefs:
- group: ""
kind: Service
name: foo
port: 80
weight: 10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think additional fields should be fine. As long as they don't collide with any standard fields, or fields we're likely to add. I doubt object references will ever have "port" or "weight" fields so you should be good. @deads2k will probably agree.
@robscott @stevesloka @jpeach I've updated this GEP to include the larger |
site-src/geps/gep-718.md
Outdated
- Rename `RouteForwardTo.BackendRef` to `RouteForwardTo.TargetRef` | ||
- Rename `RouteForwardTo` to `Backend` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally think that forwardTo
is better unless we're able to flatten everything into a backendRefs
list. In this current proposal we end up with the same levels of nesting (forwardTo.backendRef
becomes backends.targetRef
). That feels like a slightly different way to accomplish the same thing and I'm not sure it justifies a breaking change.
I am very curious if we could have a list of backendRefs
that also included concepts like weight and port. If not, I think I'd prefer to fallback to forwardTo.backendRef
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am very curious if we could have a list of backendRefs that also included concepts like weight and port. If not, I think I'd prefer to fallback to forwardTo.backendRef.
I'm fine with flattening those out if we have answers to the concerned raised below in the doc (alternatives).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read Daniel's comment after posting the above comment, let me update this GEP in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robscott updated the GEP.
site-src/geps/gep-718.md
Outdated
type: Exact | ||
values: | ||
env: canary | ||
backends: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions so far on this name:
backendRefs
:refs
doesn't add much value heretargetRefs
:target
feels a bit too generic here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Destination and/or source is almost always preferable to "target". Target is ambiguous because it could be talking about the source's target (which is the destination) or the rule's target, (which is often the source).
I'll just add my support for this GEP:
Given that forwardTo's are probably the most repeated field within the Gateway API, having a concise and generic format will have a big impact. |
Interesting reference to PolicyReference there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work on this! Just a few nits and a suggested tweak to the name but otherwise LGTM.
Ignore my comment @hbagdi I don't think per-backend policies are a very realistic use-case or are easily implementable. I was thinking per-match policies and I got it mixed up. |
Co-authored-by: Rob Scott <[email protected]>
@robscott Updated. |
Thanks @hbagdi! /lgtm |
I think this has broad enough feedback and consensus to remove the hold. /hold cancel |
What type of PR is this?
/kind gep
What this PR does / why we need it:
This adds a GEP for droping ServiceName field from RouteForwardTo(#718)
Does this PR introduce a user-facing change?: