Current Behavior
Part 1
We created an etcd client to handle plugin metadata in:
|
local plugin_metadatas, err = core.config.new("/plugin_metadata", |
|
{ |
|
automatic = true, |
|
checker = check_plugin_metadata |
|
} |
|
) |
in
check_plugin_metadata function, we need a
item.id(expectation is the plugin name) to check metadata schema of specific plugin.
|
check_plugin_metadata = function(item) |
|
local ok, err = check_single_plugin_schema(item.id, item, |
|
core.schema.TYPE_METADATA, true) |
but plugin metadata don't have a id field in our admin api, so when apisix startup with a exist plugin metadata, the checker will be triggered in
config_etcd:load_full_data
|
if data_valid and self.checker then |
|
data_valid, err = self.checker(item.value) |
|
if not data_valid then |
|
log.error("failed to check item data of [", self.key, |
|
"] err:", err, " ,val: ", json.delay_encode(item.value)) |
|
end |
|
end |
and then checker failed with this log:
Part 2
When watch a new data from etcd, config_etcd.lua only check configuration that has configure with a item_schema
|
if res.value and self.item_schema then |
|
local ok, err = check_schema(self.item_schema, res.value) |
|
if not ok then |
|
self:upgrade_version(res.modifiedIndex) |
|
|
|
return false, "failed to check item data of [" |
|
.. self.key .. "] err:" .. err |
|
end |
|
|
|
if self.checker then |
|
local ok, err = self.checker(res.value) |
|
if not ok then |
|
self:upgrade_version(res.modifiedIndex) |
|
|
|
return false, "failed to check item data of [" |
|
.. self.key .. "] err:" .. err |
|
end |
|
end |
|
end |
because
plugin_metadata only set
checker field without
item_schema, so the new plugin metadata watch from etcd don't validate by schema too.
Expected Behavior
No response
Error Logs
No response
Steps to Reproduce
/
Environment
/
Current Behavior
Part 1
We created an etcd client to handle plugin metadata in:
apisix/apisix/plugin.lua
Lines 816 to 821 in 64b81c4
in
check_plugin_metadatafunction, we need aitem.id(expectation is the plugin name) to check metadata schema of specific plugin.apisix/apisix/plugin.lua
Lines 1040 to 1042 in 64b81c4
but plugin metadata don't have a id field in our admin api, so when apisix startup with a exist plugin metadata, the checker will be triggered in
config_etcd:load_full_dataapisix/apisix/core/config_etcd.lua
Lines 489 to 495 in 64b81c4
and then checker failed with this log:
Part 2
When watch a new data from etcd,
config_etcd.luaonly check configuration that has configure with aitem_schemaapisix/apisix/core/config_etcd.lua
Lines 667 to 685 in 64b81c4
because
plugin_metadataonly setcheckerfield withoutitem_schema, so the new plugin metadata watch from etcd don't validate by schema too.Expected Behavior
No response
Error Logs
No response
Steps to Reproduce
/
Environment
/