fix: etcd sync data checker should work#11430
Conversation
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
Signed-off-by: ashing <[email protected]>
| this is a warning message for test2 | ||
| clickhouse body: INSERT INTO t FORMAT JSONEachRow | ||
| clickhouse headers: x-clickhouse-key:dpwomMlEsHH2L7wSUi6YiQ== | ||
| clickhouse headers: x-clickhouse-key:a |
There was a problem hiding this comment.
#11076
The modification of error-log-logger-clickhouse.t in this PR is wrong. The header sent to clickhouse should be decrypted.
| } | ||
| --- response_body | ||
| {"key":"/apisix/plugin_metadata/example-plugin","value":{"ikey":1,"skey":"val"}} | ||
| {"key":"/apisix/plugin_metadata/example-plugin","value":{"id":"example-plugin","ikey":1,"skey":"val"}} |
There was a problem hiding this comment.
In the admin api, we have added an id field to the plugin metadata, so the response here needs to be added.
| properties = { | ||
| log_format = { | ||
| type = "object" | ||
| } | ||
| }, |
There was a problem hiding this comment.
What does this change have to do with etcd?
There was a problem hiding this comment.
Originally sls-logger didn't add the metadata_schema, and then because the etcd checker didn't take effect before, it couldn't detect the problem.
As for the metadata schema, I refer to file-logger.
apisix/apisix/plugins/file-logger.lua
Lines 63 to 70 in 2f6fd50
|
One PR is only for one task. |
Description
Fixes # (issue)
Background
the
load_full_datafunction in the fileconfig_etcd.lua(load all exist data from etcd when apisix start),checkerdoes not depend onitem_schemato have a valueapisix/apisix/core/config_etcd.lua
Lines 540 to 546 in 507df12
But in the
sync_datafunction (watch new events from etcd when apisix running),checkerrelies onitem_schemashould have value.apisix/apisix/core/config_etcd.lua
Line 668 in 507df12
As a result, the plugin metadata resource cannot reach the checker logic when etcd watch.
apisix/apisix/plugin.lua
Lines 816 to 821 in 507df12
So we need to fix it.
about the test case:
The admin api is not used for the operation, because the admin api will directly fail to verify the schema and cannot go to the etcd checker logic.
error-log-logger-clickhouse.t: The request header sent to clickhouse should be decrypted to be correct.
Checklist