Skip to content
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

Merged
merged 4 commits into from
May 12, 2023

Conversation

ms2008
Copy link
Contributor

@ms2008 ms2008 commented May 12, 2023

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

  • Fixed sanity test can't work with "kong" storage in Hybrid mode

Issue reference

Fix FTI-4909

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.
-- 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" })
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@ms2008 ms2008 force-pushed the fix/acme-sanity-test branch 2 times, most recently from dcd73e3 to 0285e36 Compare May 12, 2023 08:18
-- 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")
Copy link
Contributor

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.

Suggested change
return kong.response.exit(404, "Not found\n")
return kong.response.exit(404)

Copy link
Contributor

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

@fffonion
Copy link
Contributor

merge on green

@fffonion fffonion merged commit 74658d9 into master May 12, 2023
@fffonion fffonion deleted the fix/acme-sanity-test branch May 12, 2023 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants