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

feat(kuma-cp) XDS extensions and new matcher strategy #1493

Merged
merged 3 commits into from
Feb 2, 2021

Conversation

jakubdyszkiewicz
Copy link
Contributor

Summary

Introducing Hooks, a way to extend Kuma with XDS modification. You can create a new project, have Kuma as a dependency, build a Bootstrap plugin that plugs in XDS hook.

Right now I created one Hook that operates on ResourceSet which allows essentially to do everything you want with XDS resources (add, modify, remove).
The ResourceSetHook may have a slight performance hit, because you need to iterate over all resources of one type. Let's say you want to modify inbound listener, you need to iterate over all listeners. I don't think this is noticeable performance hit, but I left a room to introduce more specific Hooks for builders if needed.

I also introduced a new matching strategy. Instead of matching DataplanePolicy on any inbound and applying on a all resources of the dataplane, you can now match DataplanePolicy on individual inbounds.

Documentation

  • No docs, internal changes

@jakubdyszkiewicz jakubdyszkiewicz requested a review from a team as a code owner January 29, 2021 13:26
@@ -49,6 +49,56 @@ func SelectDataplanePolicy(dataplane *mesh.DataplaneResource, policies []Datapla
return bestPolicy
}

// SelectInboundDataplanePolicies given a Dataplane definition and a list of DataplanePolicy returns the "best matching" DataplanePolicy for each inbound separately.
// A DataplanePolicy for an inbound is considered a match if the inbound matches all the tags listed in selector of the DataplanePolicy.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should tags have weights?
I mean should kuma.io/zone should be outweighting app/version ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, I think we even talked about this once, but

  1. That complicates the matching mechanism, we would need to add some parameterization of tag weights - seems like a breaking change
  2. Definitely out of scope of this PR, since it touches all matchers

If I were to improve something about the matching mechanism in Kuma, I'd try to support negate cases or aggregation of many policies instead of "only match the most specific"

@jakubdyszkiewicz jakubdyszkiewicz merged commit 9781c38 into master Feb 2, 2021
@jakubdyszkiewicz jakubdyszkiewicz deleted the chore/xds-extensions branch February 2, 2021 12:00
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.

3 participants