-
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
fix(acme): sanity test can work with "kong" storage in Hybrid mode #10852
Conversation
Currently, there is a technical limitation in hybrid mode, that is, the DP side cannot perform any write database operation. However, when the sanity test is executed and the account identifier information is needed to write to storage, we will skip this operation (after a private discussion with @wangchong) and return 200 directly in this situation. This will not have any substantial impact on the functionality.
1086eb1
to
a46604d
Compare
kong/plugins/acme/handler.lua
Outdated
-- creating account through proxy side with "kong" storage in Hybrid mode is not supported | ||
-- if this is just a sanity test, we always return 200 status | ||
if captures[1] == "x" and kong.configuration.role == "data_plane" and conf.storage == "kong" then | ||
return kong.response.exit(200, { message = "ok" }) |
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 it's impossible to go through the process, should we instead return 422 or something?
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.
@fffonion I believe we got it wrong yesterday. The correct fix should be to always return 404 instead of 200.
dcd73e3
to
0285e36
Compare
-- creating account through proxy side with "kong" storage in Hybrid mode is not supported | ||
-- if this is just a sanity test, we always return 404 status | ||
if captures[1] == "x" and kong.configuration.role == "data_plane" and conf.storage == "kong" then | ||
return kong.response.exit(404, "Not found\n") |
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.
Actually, we do not need to include a reason phrase here(it's added automatically) and the second arg is the response body.
return kong.response.exit(404, "Not found\n") | |
return kong.response.exit(404) |
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.
actually we need that body as well, since we check it in our sanity test
https://github.com/Kong/kong/blob/master/kong/plugins/acme/api.lua#L103
0285e36
to
3801192
Compare
merge on green |
Summary
Currently, there is a technical limitation in hybrid mode, that is, the DP side cannot perform any write database operation. However, when the sanity test is executed and the account identifier information is needed to write to storage, we will skip this operation (after a private discussion with @fffonion) and always return 404 directly with all storages. This will not have any substantial impact on the functionality.
Checklist
Full changelog
Issue reference
Fix FTI-4909