-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support Redis cluster topology for the Redis scaler #883
Comments
@mboutet are you willing to contribute this feature? |
Yes, I could look into it. That would be a great way to start properly leaning Go. I have no definite timeline right now. I will first familiarize myself with the codebase. |
@mboutet excellent, great! In that case, I'd recommend you to look at upcoming v2 codebase https://github.com/kedacore/keda/tree/v2 |
Hi @mboutet any update on this issue? |
@turbaszek, I haven't done any work on this yet. I was thinking of waiting for the v2 codebase to be officially released to start working on this. Of course, don't hesitate to start the implementation on this if you want. |
Can I give it a try if that's okay? |
Yes of course! I haven't done anything on my side. |
I did a bit of homework and could think of two approaches to this:
diff --git a/pkg/scalers/redis_scaler.go b/pkg/scalers/redis_scaler.go
index bd9da22..1db3459 100644
--- a/pkg/scalers/redis_scaler.go
+++ b/pkg/scalers/redis_scaler.go
@@ -24,8 +24,10 @@ const (
)
type redisScaler struct {
- metadata *redisMetadata
- client *redis.Client
+ metadata *redisMetadata
+ client *redis.Client
+ clusterClient *redis.ClusterClient
+ clusterEnabled bool
} Then, based on
Would really appreciate any alternatives or suggestions. |
Although I'm not a fan of the name I think a flag sounds ok for me, wdyt @zroubalik? What about Are you able to contribute this @goku321? |
Definitely @tomkerkhove. Will start working on it. |
What would the trigger's OpenAPI spec looks like? Right now, the parameters are: Perhaps having different scalers (from the user's perspective at least) would be better/cleaner so that the trigger specs only contain what's relevant for the normal redis configuration or for the clustered configuration. |
I'm not a redis expert so I expected those to be identical, but if it's different than a different scaler feels best indeed |
When |
This is supported already. |
Support Redis cluster topology for the Redis scaler
See discussion for context: #872 (comment)
Use-Case
Right now, the Redis scaler only supports non-clustered Redis topology. In our stack, however, we use Redis cluster to provide horizontal scalability and HA. Some cloud providers such as AWS and Azure also offer Redis cluster in their offering.
See https://redis.io/topics/cluster-spec and https://redis.io/topics/cluster-tutorial for more info on the Redis cluster topology.
Specification
address
field of the trigger spec (one for each node).Since the cluster topology requires the client to be cluster-aware, I don't know if this would be a separate scaler or if it could be integrated with the current Redis scaler with some more fields in the trigger (perhaps
topology = normal (default), OR cluster
andaddresses
(iftopology
iscluster
). In our applications, simply swapping for a cluster-aware client was the only require step in order to support this topology (redis-py-cluster
instead ofredis-py
).The text was updated successfully, but these errors were encountered: