-
Notifications
You must be signed in to change notification settings - Fork 327
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
chore(kuma-cp) generify proxy template matching #588
chore(kuma-cp) generify proxy template matching #588
Conversation
eb307ad
to
2733c5b
Compare
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.
If not part of this PR, let's open a separate issue to refactor matching algorithm to be consistent with SelectConnectionPolicies()
, namely
- ranking should distinguish between exact matches and wildcard ('*') matches
Refactored to support * and gateways. Please take a look. |
// when | ||
actual := policy.SelectDataplanePolicy(given.proxy.Dataplane, given.policies) | ||
// then | ||
if given.expected == nil { |
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.
Wouldn't Expect(actual).To(Equal(given.expected))
be enough for both cases ?
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.
Apparently it is not
Refusing to compare <nil> to <nil>.
Be explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.
Spec: mesh_proto.Dataplane{ | ||
Networking: &mesh_proto.Dataplane_Networking{ | ||
Inbound: []*mesh_proto.Dataplane_Networking_Inbound{ | ||
{}, |
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.
Why do we want to test against invalid inbound listeners ?
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.
It was in the previous test, but I agree - it doesn't make sense, deleted.
Summary
Introduce DataplanePolicy and generify matching for ProxyTemplate. This enables us to reuse the same logic for TrafficTrace as well as soon to be refactored TrafficLog