-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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/plugins mesh field 1/2 #3930
Conversation
3a46a2b
to
d87b725
Compare
@kikito You have added a new top-level field to the Plugins entity in the db, but in the schemas you added it as a subfield of the |
kong/db/schema/typedefs.lua
Outdated
typedefs.mesh_two_way = Schema.define { | ||
type = "string", | ||
default = "two-way", | ||
one_of = { "inbound", "outbound", "two-way" }, |
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.
<opinion> use twice
or both
instead of two-way
</opinion>
The auth plugins are all Conceptually: currently the available values are tied to the default value. And I think they should be separate. |
I was imagining all the auth plugins would be |
In service mesh it is different. The forward proxy already knows that authentication is going to fail, so it stops the traffic on a sidecar (Kong proxy) before even entering the network. Eg. traffic is stopped on forward proxy's incoming traffic and not on the to be called service's reverse proxy incoming traffic. I'd like to call these forward and reverse proxies, e.g. plugin is executed on forward proxy or reverse proxy or both. Most of the auth plugins will be executed on service mesh only on forward proxy e.g. The traffic that is trying to enter the mesh. After The traffic has entered the mesh, it is trusted traffic by mutual tls. All The plugins still have same incoming and outgoing nginx phases. It is just a matter that will the plugin run on one proxy (and which) or both. I would use |
After talking with James, I got new info, so new proposal for naming:
Because we don't know before actual connection is made (and after the access phase is already executed) whether or not we are in service mesh, we call everything by default a gateway. All forward proxies in service mesh are gateways (gw to the mesh or non mesh too) and all reverse proxies in service mesh are mesh nodes. So only the incoming can be a mesh node in service mesh (because it knows it even before access phase). If there is no service mesh, then all Kong nodes are gateways, and usually they are reverse proxies (e.g. ingress). The role cannot change between different Nginx phases (by a design decision, it is not impossible, but makes it easier to understand). So if you think about this, then all our current plugins should be marked run-on="gateway". But we may adjust some (the zipkin tracing to be "both"). We do not have mesh only plugins, e.g. run only on incoming (reverse proxy) mesh, because that would make plugin a incoming mesh only (e.g. you couldn't use the plugin in single Kong cluster or between nodes that are not mesh nodes) And as explained the outgoing (the forward proxy in mesh) doesn't know if it connects to mesh or not (until after balancer is executed, e.g. header filter phase and there on), the outgoing is gateway. |
That said ^
But we cannot run plugin only in outgoing mesh, because it knows it too late. In future we can add possibility to run plugin only on outgoing mesh header_filter, body_filter and log phases (and respective stream phases) BUT never only on outgoing mesh nodes access phase. |
^ the above is the default hard coded plugin level settings. The next question obviously is that do we allow change these defaults on plugin instance level, e.g. plugin.config.run_on=mesh overrides the hardcoded plugin.run_on=gateway. |
Okay, another take on this:
The The And then we have Plugin configuration (if the user for some weird reason wants to run it differently than the sane default): This is how to add dynamic config for origin:
A new column in plugins table called
or perhaps move back to: |
993808d
to
f12804b
Compare
8c62662
to
fec1317
Compare
7b0f95a
to
c9d2088
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.
One correction needed.
c9d2088
to
43bfaa2
Compare
This PR includes:
mesh_mode
to tag plugins withinbound
,outbound
ortwo-way
. Note thattwo-way
plugin instances can be individually tagged asinbound
oroutbound
on creation, but plugins tagged asinbound
can only haveinbound
instances, and the same goes foroutbound
pluggins.I have tagged 15 plugins as
two-way
on this PR. There are multiple commits with explanations for my reasons.