-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
feat: Added redis-role selector for consistent access to 'master' or 'slave' #785
base: master
Are you sure you want to change the base?
feat: Added redis-role selector for consistent access to 'master' or 'slave' #785
Conversation
87ccb4c
to
4e74d3f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #785 +/- ##
==========================================
+ Coverage 35.20% 38.93% +3.73%
==========================================
Files 19 19
Lines 3213 2738 -475
==========================================
- Hits 1131 1066 -65
+ Misses 2015 1596 -419
- Partials 67 76 +9 ☔ View full report in Codecov by Sentry. |
@iamabhishek-dubey @shubham-cmyk @drivebyer |
Could you please rebase from the master branch and address the failing checks? @wkd-woo. |
4e74d3f
to
16fcf61
Compare
I did :) |
the |
8cc24cf
to
337abec
Compare
@drivebyer Can you please check it out? |
The |
337abec
to
e8212a5
Compare
@drivebyer |
Actually, you should resolve the issues with the GitHub Actions checks and the Git conflicts. Additionally, I have already provided some review suggestions, which you may want to take a look at. |
e8212a5
to
b1d5d8b
Compare
49c3b0d
to
38e723d
Compare
943772b
to
42cd5fa
Compare
ced1147
to
b932df0
Compare
Hello there :) |
please rebase on the master && see the review |
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
Signed-off-by: wkd-woo <[email protected]>
49b2029
to
b99997d
Compare
@@ -36,13 +36,23 @@ func generateServiceDef(serviceMeta metav1.ObjectMeta, epp exporterPortProvider, | |||
} else { | |||
PortName = "redis-client" | |||
} | |||
selectorLabels := serviceMeta.GetLabels() | |||
if serviceMeta.GetName() == "redis-replication-leader" { |
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.
the svc always name:"redis-replication-leader", We should create svc based on the specific instance name.
@drivebyer @wkd-woo is there anything we could help with in order to get that important one merged? |
It hasn’t been updated for a while, so if you’re open to it, a new PR would also be welcome. |
@drivebyer does it needs a simple rebase or that are more issue to address (note that I usually not using go, but happy to help completing that one)? |
@drivebyer sorry to bring that again, really motivated to move forward but I lack the last input to make it happen :) |
Actually, part of this PR is implemented by #925, which adds labels to both master and slave pods. It updates the labels as the roles change. |
@drivebyer awesome! so the only thing left for the user is to define a proper service that matches the given logic? |
Yes |
Are you taking into account that when a failover occurs the labels have to be switched? This currently only occurs for the master which is set to slave. But the slave role is never set to master |
@drivebyer @zifeo @Leo791 |
Description
Redis Replication requires the Redis client to be able to access the master node without having to go through the sentinel client.
Sentinel tracks the redis master, but the endpoint of the redis pod is set to private IP inside the k8s cluster
There are restrictions on accessing the Redis service from outside the k8s cluster.
Of course, it is accessible with the current function of the operator, but the current function does not guarantee access to the redis-server of the master role.
Therefore, in Replication Topology, the ability to label the current pod to distinguish which pod is "leader(i.e master)" has been added,
The label was used as the selector to create a service that guarantees access to a specific role(leader or follower)
In addition, I thought it would be good to provide read-replica endpoint, so I added the function.
Summary
Added redis-role label to redis-replication pod.
And create a service that guarantees access to a specific role.
Related issue
#765
#629
#453
associated with a previous PR
#777
Type of change
New feature (non-breaking change which adds functionality)
Checklist
Additional Context
The pods are labeled.
The key called redis-role has master or slave as a value.
And a service is created with the value of the key as the selector.
The service will forward the request to the selecting pod.
In this case (redis-replication-leader), forward to "master".
Considering the load distribution in the production environment, I also wanted to provide read-replica endpoint as a service.
Labeled only realMaster as 'redis-role': 'master' using 'GetRedisNodesByRole()' -> 'checkAttachedSlave()'.
If it is 'ClusterSize:1', make an exception.