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(clustering/rpc) support cluster_use_proxy option for clustering rpc protocol #13971

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

chobits
Copy link
Contributor

@chobits chobits commented Dec 3, 2024

Summary

The original hybrid mode connections like full sync (sync v1) support forward proxy via the option cluster_use_proxy. While clustering RPC protocol does not support this, this commit introduces this feature to RPC protocol.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix KAG-5555

@github-actions github-actions bot added core/clustering cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Dec 3, 2024
@pull-request-size pull-request-size bot added size/M and removed size/S labels Dec 3, 2024
Comment on lines +478 to +488
if self.conf.cluster_use_proxy then
local proxy_opts = parse_proxy_url(self.conf.proxy_server)
opts.proxy_opts = {
wss_proxy = proxy_opts.proxy_url,
wss_proxy_authorization = proxy_opts.proxy_authorization,
}

ngx_log(ngx_DEBUG, "[rpc] using proxy ", proxy_opts.proxy_url,
" to connect control plane")
end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic comes from kong/clustering//utils.lua: local ok, err = c:connect(uri, opts).

if conf.cluster_use_proxy then
local proxy_opts = parse_proxy_url(conf.proxy_server)
opts.proxy_opts = {
wss_proxy = proxy_opts.proxy_url,
wss_proxy_authorization = proxy_opts.proxy_authorization,
}
ngx_log(ngx_DEBUG, _log_prefix,
"using proxy ", proxy_opts.proxy_url, " to connect control plane")
end

@chobits chobits marked this pull request as draft December 3, 2024 07:50
@chobits chobits marked this pull request as ready for review December 4, 2024 02:17
@chobits
Copy link
Contributor Author

chobits commented Dec 4, 2024

record flakiness: https://github.com/Kong/kong/actions/runs/12151750267/job/33886933473?pr=13971, then rerun

Click to expand image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee core/clustering size/M skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant