-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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(plugin): add an optional instance_name field for plugin entity #10077
Conversation
3ae0ff3
to
ebe8176
Compare
b78a761
to
05f1294
Compare
05f1294
to
104a95b
Compare
104a95b
to
6c112c1
Compare
6c112c1
to
8be8225
Compare
It looks good, did you consider the clustering compatibility? Refer to #9972 . |
@vm-001 I think Kong should validate that WDYT? |
Kong will has more and more official plugins during its iteration. I'm concerned if I do so, then a valid |
@@ -1386,7 +1386,7 @@ function _M.new(connector, schema, errors) | |||
}) | |||
|
|||
local conflict_key = unique_escaped | |||
if has_composite_cache_key then | |||
if has_composite_cache_key and not unique_field.is_endpoint_key then |
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.
When doing the operation upsert by field, if that field is used as endpoint_key, then it is most likely unique(based Kong RESTful style), and should be used as SQL conflict condition, instead of using the composite cache_key.
Yes, it is unfortunate that Alternatives to
Do we need to think about name more broadly if we in a future use this to make it possible to run same plugin multiple times? |
Let's do a very simple poll in the community. Adding emoji on this comment to vote. 🚀 to vote |
Sorry to come up with another suggestion. What we're naming is the plugin instance, so why not be explicit and use |
I was thinking about that too. But my personal self hates the long names with underscores and it means a lot more to type with everyone (users/customers included). Internally we talk about instances, but I am not sure if that is right term either. We don't create instances of plugins, we just call the same static "class" like plugin with different configuration. Of course here by instance we mean applying logic (aka run on this route/service/consumer or global or combination) and the configuration which to call the plugin. All that said, I am fine with Edit: on the otherhand if we allow to run same plugin multiple times, the instance_name is quite good. |
Yes that is unfortunate. If I were to choose without thinking about legacy and tooling we would have |
Imo, this is the right hint. It is really just a way to customize the identifier to a plugin instance. Also bearing in mind that we may eventually have support for multiple plugin instances, this is the right path 👍🏻 |
2ba1d1f
to
5fac9f3
Compare
6ef363c
to
c35a10d
Compare
Should we add a field in |
Seems this file is not needed anymore. Will confirm tomorrow. |
Summary
Currently, a Plugin instance must be identified by id, and users are unable to give a custom name for a Plugin instance. This is very user-unfriendly, and causes users confusion on Kong Manager.
Therefore, adding an optional
instance_name
field for Plugin entity could address this kind of situation.Not only the
instance_name
can be used in the request body for CRUD of/plugins/{id}
, but also/plugins/{instance_name}
/services/{service}/plugins/{instance_name}
/routes/{route}/plugins/{instance_name}
Checklist
Full changelog
Issue reference
KAG-134