Skip to content

Conversation

utako
Copy link
Member

@utako utako commented May 30, 2018

otherwise, pilot will not enumerate the routes past the base route.

thanks all.

@zachgersh
Copy link
Contributor

/ok-to-test

Copy link
Contributor

@ZackButcher ZackButcher left a comment

Choose a reason for hiding this comment

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

LG, though if the goal is to put path condition routes before non-path routes, IMO sorting the routes by Match is going to be a better long term impl, rather than encoding/enforcing that bit of business logic in the loop itself (where IMO it's not obvious).

cr.Match = createMatchRequest(route)
vs.Http = append([]*networking.HTTPRoute{cr}, vs.Http...)
} else {
vs.Http = append(vs.Http, cr)
Copy link
Contributor

Choose a reason for hiding this comment

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

aren't this line and line 97 duplicates? I think we can rewrite this whole block to:

cr := createRoute(route)
cr.Route[0].Destination.Subset = route.GetCapiProcessGuid()
if route.GetPath() != "" {
    cr.Match = createMatchRequest(route)
}
vs.Http = append(vs.Http, cr)

Or was the goal to differentiate append(cr, vs.Http...) vs append(vs.Http, cr)? If the goal is to fix that discrepancy, then I think you'd be better off sorting the HTTP routes by these conditions before returning it, rather than keeping the ordering as we process the list (IMO it's more obvious, and it'll be easier to change later if match ordering needs to change for some other reason down the line).

Copy link
Contributor

Choose a reason for hiding this comment

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

We considered this but then you have the mess of what is potentially a nil pointer (there may not be a match for the route you are looking at).

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO sorting is a cleaner/better way to implement this because it consolidates the logic into a single location and it's fairly obvious what's happening. The impl as-is is a big tripping hazard IMO: that logic diff is subtle and easy to change later. Either way, doesn't warrant blocking the PR, though I would recommend adding a comment describing what's happening here.

Copy link
Member Author

Choose a reason for hiding this comment

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

cool, added a comment in cc2229b

hoping to refactor that soon. thanks for the input @ZackButcher

@@ -70,7 +70,7 @@ func TestCloudFoundrySnapshot(t *testing.T) {
g.Expect(virtualService.Gateways).To(gomega.ConsistOf([]string{"some-gateway", "some-other-gateway"}))

g.Expect(virtualService.Http).To(gomega.HaveLen(2))
g.Expect(virtualService.Http).To(gomega.ConsistOf([]*networking.HTTPRoute{
g.Expect(virtualService.Http).To(gomega.Equal([]*networking.HTTPRoute{
Copy link
Contributor

Choose a reason for hiding this comment

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

Equal enforces element ordering where ConsistOf doesn't, I assume?

Copy link
Contributor

Choose a reason for hiding this comment

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

correct!

@utako
Copy link
Member Author

utako commented May 30, 2018

/test istio-pilot-e2e

2 similar comments
@zachgersh
Copy link
Contributor

/test istio-pilot-e2e

@utako
Copy link
Member Author

utako commented Jun 1, 2018

/test istio-pilot-e2e

theganyo and others added 4 commits June 1, 2018 09:22
* use Gateway and VirtualService to expose helloworld service

* readme fix
istio#5873)

* Update Jaeger version and add limit on the number of traces held in memory

* Use tag 1 to pick up latest stable versions

* Use tag 1.5
otherwise, pilot will not enumerate the routes past the base route
@zachgersh zachgersh force-pushed the better_fix_copilot_matching branch from cc2229b to a30139a Compare June 1, 2018 16:28
@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Jun 1, 2018
@googlebot
Copy link
Collaborator

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@googlebot googlebot added cla: no Set by the Google CLA bot to indicate the author of a PR has not signed the Google CLA. and removed cla: yes labels Jun 1, 2018
@utako utako changed the base branch from release-0.8 to master June 1, 2018 16:28
@utako utako closed this Jun 1, 2018
@utako utako reopened this Jun 1, 2018
@istio-testing istio-testing removed the needs-rebase Indicates a PR needs to be rebased before being merged label Jun 1, 2018
@utako utako closed this Jun 1, 2018
@istio-testing
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: utako
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approvers: greghanson, vadimeisenbergibm

Assign the PR to them by writing /assign @greghanson @vadimeisenbergibm in a comment when ready.

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

@istio-testing
Copy link
Collaborator

@utako: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
prow/istio-pilot-e2e-envoyv2-v1alpha3.sh a30139a link /test istio-pilot-e2e-envoyv2-v1alpha3
prow/e2e-bookInfoTests-v1alpha3.sh a30139a link /test e2e-bookInfo-envoyv2-v1alpha3
prow/e2e-simpleTests.sh a30139a link /test e2e-simple
prow/istio-pilot-e2e.sh a30139a link /test istio-pilot-e2e
prow/e2e-bookInfoTests.sh a30139a link /test e2e-bookInfo

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/test-infra repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: no Set by the Google CLA bot to indicate the author of a PR has not signed the Google CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants