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

virtualservice delegation #1121

Merged
merged 25 commits into from Sep 5, 2019
Merged

Conversation

ilackarms
Copy link
Member

@ilackarms ilackarms commented Sep 4, 2019

BOT NOTES:
resolves #1120
resolves #1122

@solo-git-bot
Copy link

solo-git-bot bot commented Sep 4, 2019

Issues linked to changelog:
#1120

Copy link
Contributor

@marcogschmidt marcogschmidt left a comment

Choose a reason for hiding this comment

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

Looks good, just some minor fixes

var (
missingPrefixErr = errors.Errorf("invalid route: routes with delegate actions must specify a prefix matcher")
hasHeaderMatcherErr = errors.Errorf("invalid route: routes with delegate actions cannot use header matchers")
hasMethodMatcherErr = errors.Errorf("invalid route: routes with delegate actions cannot use header matchers")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
hasMethodMatcherErr = errors.Errorf("invalid route: routes with delegate actions cannot use header matchers")
hasMethodMatcherErr = errors.Errorf("invalid route: routes with delegate actions cannot use method matchers")

missingPrefixErr = errors.Errorf("invalid route: routes with delegate actions must specify a prefix matcher")
hasHeaderMatcherErr = errors.Errorf("invalid route: routes with delegate actions cannot use header matchers")
hasMethodMatcherErr = errors.Errorf("invalid route: routes with delegate actions cannot use header matchers")
hasQueryMatcherErr = errors.Errorf("invalid route: routes with delegate actions cannot use header matchers")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
hasQueryMatcherErr = errors.Errorf("invalid route: routes with delegate actions cannot use header matchers")
hasQueryMatcherErr = errors.Errorf("invalid route: routes with delegate actions cannot use query matchers")

func (rv *routeVisitor) convertDelegateAction(ours *v1.Route) ([]*gloov1.Route, error) {
action := ours.GetDelegateAction()
if action == nil {
return nil, errors.Errorf("internal error: convertDelegateAction() called on route without delegate action")
Copy link
Contributor

Choose a reason for hiding this comment

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

Add error to the error vars above.

}
for _, visited := range rv.visited {
if routeTable == visited {
return nil, errors.Errorf("invalid route: delegation cycle detected")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. Maybe you could also log more information about which route tables caused the cycle.

}
prefix = "/" + strings.Trim(prefix, "/")

if len(ours.GetMatcher().GetHeaders()) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think moving all ours.GetMatcher() the validation logic to a separate function would make this one more readable.

@@ -1,17 +1,17 @@
package translator_test
package translator
Copy link
Contributor

Choose a reason for hiding this comment

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

As a general principle I like to keep the isolation that separate packages provide. We test against an interface and don't have to update any test code when implementation details that should be transparent to clients change. It also surfaces limitations in the interface itself.

It looks like this change was done to get access to:

  • the error variables
  • the visitor

For the first, I don't see any harm in making them public. Regarding the second one, I see why you wouldn't want to expose the visitor to the outside. How about moving it to its own file and having a separate unit test for it, e.g. route_visitor.go + route_visitor_test.go?

},
},
},
expectedErr: missingPrefixErr,
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect there may be some copy/paste errors here and that if you fix the duplicate error messages this may fail. Worth to double-check.

Copy link
Member Author

Choose a reason for hiding this comment

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

these are correct, same error for both the regex and exact path cases

@solo-git-bot
Copy link

solo-git-bot bot commented Sep 5, 2019

Issues linked to changelog:
#1120
#1122

@ilackarms
Copy link
Member Author

/kick

it appears


Step #11 - "test": �[90m------------------------------�[0m
Step #11 - "test": �[91m�[1m• Failure [16.638 seconds]�[0m
Step #11 - "test": �[90mConsul + Vault Configuration Happy Path e2e �[0m�[91m�[1m[It] can do function routing with consul services �[0m
Step #11 - "test": �[37m/workspace/gopath/src/github.com/solo-io/gloo/test/consulvaulte2e/consul_vault_test.go:229�[0m
Step #11 - "test": 
Step #11 - "test":   �[91mTimed out after 15.000s.
Step #11 - "test":   Expected
Step #11 - "test":       <core.Status_State>: 2
Step #11 - "test":   to equal
Step #11 - "test":       <core.Status_State>: 1�[0m
Step #11 - "test": 
Step #11 - "test":   /workspace/gopath/src/github.com/solo-io/gloo/test/consulvaulte2e/consul_vault_test.go:251
Step #11 - "test": �[90m------------------------------�[0m
Step #11 - "test": 

is still a flake

Copy link
Contributor

@marcogschmidt marcogschmidt left a comment

Choose a reason for hiding this comment

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

LGTM

@soloio-bulldozer soloio-bulldozer bot merged commit 90a4e5a into master Sep 5, 2019
@soloio-bulldozer soloio-bulldozer bot deleted the v2-virtualservice-delegation branch September 5, 2019 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

race condition with glooctl install knative Enable delegate routing & use of RouteTable Resource in Gateway
2 participants