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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/william/genrpc ssl port align #11813

Merged
merged 2 commits into from Oct 25, 2023

Conversation

qzhuyan
Copy link
Contributor

@qzhuyan qzhuyan commented Oct 24, 2023

Fixes

Summary

馃 Generated by Copilot at 6b9e8bc

This pull request introduces a new gen_rpc implementation for emqx nodes that supports SSL/TLS and two modes of port discovery. It also adds a new configuration option ssl_client_port and updates the helm charts to expose the new ports.

PR Checklist

Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:

  • Added tests for the changes
  • Added property-based tests for code which performs user input validation
  • Changed lines covered in coverage report
  • Change log has been added to changes/(ce|ee)/(feat|perf|fix)-<PR-id>.en.md files
  • For internal contributor: there is a jira ticket to track this change
  • Created PR to emqx-docs if documentation update is required, or link to a follow-up jira ticket
  • Schema changes are backward compatible

Checklist for CI (.github/workflows) changes

  • If changed package build workflow, pass this action (manual trigger)
  • Change log has been added to changes/ dir for user-facing artifacts update

@qzhuyan qzhuyan force-pushed the fix/william/genrpc-ssl-port-align branch from 6b9e8bc to 6346e0d Compare October 24, 2023 20:34
@qzhuyan qzhuyan marked this pull request as ready for review October 25, 2023 07:04
@qzhuyan qzhuyan requested review from Rory-Z and a team as code owners October 25, 2023 07:04
@qzhuyan qzhuyan merged commit 37dd44c into emqx:release-53 Oct 25, 2023
147 checks passed
Comment on lines +126 to +127
- name: genrpc2-auto
containerPort: 5370
Copy link
Member

Choose a reason for hiding this comment

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

there should be no need for this. ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need it for port port_discovery = stateless in gen_rpc, yes this is confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

with the override set in docker entrypoint, i don't think we need this port.

Comment on lines +126 to +127
- name: genrpc2-auto
containerPort: 5370
Copy link
Member

Choose a reason for hiding this comment

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

same here

@@ -89,6 +89,7 @@ jobs:
EMQX_RPC__CACERTFILE: /opt/emqx/etc/certs/cacert.pem
EMQX_RPC__CIPHERS: TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256
EMQX_RPC__TLS_VERSIONS: "[tlsv1.2]"
EMQX_RPC__PORT_DISCOVERY: manual
Copy link
Member

Choose a reason for hiding this comment

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

is this for redundance ? because it's set to manual in docker entrypoint script.
https://github.com/emqx/emqx/blob/master/deploy/docker/docker-entrypoint.sh#L52

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I thought it was auto-discovery as it is the default in the schema. I set it to manual want to test both. shall we remove it from docker-entrypoint? I don't see good reason to have it there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or we should change the schema default to manual

Copy link
Member

Choose a reason for hiding this comment

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

The override in docker entrypoint was added long ago, we keep it for backward compatibility reasons. (so that v4 and v5 has the same port mapping convention).

We cannot change the default in schema because for RPM/DEB/TGZ installation, it's offset based port mapping. --- also kept for backward compatibility reasons.

@@ -1151,6 +1151,7 @@ translation("emqx") ->
translation("gen_rpc") ->
[
{"default_client_driver", fun tr_gen_rpc_default_client_driver/1},
{"ssl_client_port", fun tr_gen_rpc_ssl_client_port/1},
Copy link
Member

@zmstone zmstone Oct 25, 2023

Choose a reason for hiding this comment

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

this is probably the only change needed.

or fix this instead: gen_rpc has a default value for ssl clients to connect to 5370
https://github.com/emqx/gen_rpc/blob/46dd22100391f3d87daca989cde7e2ecc52a17b5/src/gen_rpc.app.src#L35

but we have set the same server port on 5369 for both tcp and ssl:

{"tcp_server_port",
sc(
integer(),
#{
mapping => "gen_rpc.tcp_server_port",
default => 5369,
desc => ?DESC(rpc_tcp_server_port)
}
)},
{"ssl_server_port",
sc(
integer(),
#{
mapping => "gen_rpc.ssl_server_port",
default => 5369,
desc => ?DESC(rpc_ssl_server_port)

Copy link
Member

@zmstone zmstone Oct 25, 2023

Choose a reason for hiding this comment

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

for completeness, we should actually add tcp_client_port too
otherwise manual will not work if one wants to change port for server.

Copy link
Member

Choose a reason for hiding this comment

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

actually, to support manual strategy properly, it should not be a simple translation and user server port.
should rather make the tcp and ssl ports configurable for the clients.

Copy link
Member

@zmstone zmstone Oct 25, 2023

Choose a reason for hiding this comment

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

if we force all nodes in the cluster to use the same server port, then maybe just a translation is enough.

but please also add the same tr for tcp_client_port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants