-
-
Notifications
You must be signed in to change notification settings - Fork 20
Sentinels: Accept options to connect to master #61
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
base: main
Are you sure you want to change the base?
Conversation
@role = role | ||
@protocol = protocol |
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 removed the @protocol
instance variable because, AFAIK, it is only used to connect to the master, and at this point we still don't know which one will be.
@ssl = !!master_options&.key?(:ssl_context) | ||
@scheme = "redis#{@ssl ? 's' : ''}" |
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 don't kinda like this, any ideas?
@@ -116,7 +119,6 @@ def resolve_slave | |||
protected | |||
|
|||
def assign_default_tags(tags) | |||
tags[:protocol] = @protocol.to_s |
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'm not sure what is this for. I hope I'm not breaking anything.
@protocol.client(stream) | ||
|
||
endpoint.protocol.client(stream) |
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.
Here we use the endpoint protocol to connect to the endpoint, I think this is more correct and removes the need for the instance variable.
I tried to use
SentinelClient
on my project and found I couldn't connect to Sentinels + TLS or ACL. The reason is there no way to provide connection options for the master, only for the sentinels. So sentinels can be protected with TLS and ACL andasync-reds
will connect to them, but after resolving master,SentinelClient
will only connect to master if it is not protected by TLS nor ACL.I wrote this script to test the changes:
Types of Changes
Contribution
I didn't add tests because those must involve much more than just writing the tests. It would require creating a new docker compose file, new certificates, config files, etc.