-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: add control api for discovery module #3742
Conversation
The conflict needs to be solved so that the CI can run. |
if discovery_type then | ||
local discovery = require("apisix.discovery.init").discovery | ||
local dump_apis = {} | ||
for key, _ in pairs(discovery_type) do |
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.
It seems we can use for key, dis_mod in pairs(discovery) do
directly?
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.
Good idea!
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.
if use for key, dis_mod in pairs(discovery) do
, the dis_mod
is function
type, not a table object.
So, we can't do it.
t/control/discovery.t
Outdated
GET /v1/discovery/eureka/dump | ||
--- error_code: 200 | ||
--- response_body_unlike | ||
^{}$ |
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.
ditto
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.
Y
The CI fails because of #3747 |
docs/en/latest/discovery.md
Outdated
@@ -92,6 +95,11 @@ Then implement the `_M.init_worker()` function for initialization and the `_M.no | |||
end | |||
|
|||
|
|||
function _M.dump_data() | |||
... ... |
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.
I think an example return data shoul be written here.
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.
for example ?
function _M.dump_data()
return {config = your_config, services = your_services, other = ... }
end
What this PR does / why we need it:
Just implement the
_M.dump_data()
function for discovery module, then call the control api for dumping running details online.The dump api uri template:
eg:
Pre-submission checklist: