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

skipper: discover redis shards without fetching full cluster state #2934

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

AlexanderYastrebov
Copy link
Member

@AlexanderYastrebov AlexanderYastrebov commented Feb 13, 2024

Skipper supports Redis based Cluster Ratelimits and
dynamic discovery of Redis instances using Kubernetes Service,
see https://github.com/zalando/skipper/blob/master/docs/tutorials/ratelimit.md#redis-based-cluster-ratelimits

Dynamic discovery relies on Kubernetes Dataclient that also fetches
Ingresses and RouteGroups and creates routes from them.

This change enables dynamic discovery of Redis instances using
Kubernetes without fetching Ingresses and RouteGroups.

When -kubernetes flag is not set but -enable-swarm,
-kubernetes-redis-service-namespace, -kubernetes-redis-service-name and
-kubernetes-redis-service-port are provided then Skipper creates
Kubernetes dataclient to discover Redis instances
but does not use this dataclient for routing.

The change adds LoadEndpointAddresses to Kubernetes dataclient that is
similar to caching GetEndpointAddresses but does not rely on
previous call to Load or LoadAll to allow discovery of
Redis shards without fetching full cluster state.

Fixes #2476

@AlexanderYastrebov AlexanderYastrebov added the major moderate risk, for example new API, small filter changes that have no risk like refactoring or logs label Feb 13, 2024
@AlexanderYastrebov AlexanderYastrebov force-pushed the standalone-redis-updater-3 branch from 106e764 to 114eac9 Compare February 13, 2024 13:30
@AlexanderYastrebov AlexanderYastrebov changed the title skipper: use kubernetes cluster client to discover redis shards skipper: discover redis shards without fetching full cluster state Feb 13, 2024
@AlexanderYastrebov AlexanderYastrebov force-pushed the standalone-redis-updater-3 branch 5 times, most recently from 7f9f986 to 43f7221 Compare February 14, 2024 20:32
@AlexanderYastrebov AlexanderYastrebov marked this pull request as ready for review February 14, 2024 20:33
@AlexanderYastrebov AlexanderYastrebov force-pushed the standalone-redis-updater-3 branch 4 times, most recently from 5d8e4f9 to a3da67c Compare February 14, 2024 20:54
@AlexanderYastrebov AlexanderYastrebov force-pushed the standalone-redis-updater-3 branch 5 times, most recently from be8804c to 9d9056f Compare February 15, 2024 11:14
Skipper supports Redis based Cluster Ratelimits and
dynamic discovery of Redis instances using Kubernetes Service,
see https://github.com/zalando/skipper/blob/master/docs/tutorials/ratelimit.md#redis-based-cluster-ratelimits

Dynamic discovery relies on Kubernetes Dataclient that also fetches
Ingresses and RouteGroups and creates routes from them.

This change enables dynamic discovery of Redis instances using
Kubernetes without fetching Ingresses and RouteGroups.

When `-kubernetes` flag is not set but `-enable-swarm`,
`-kubernetes-redis-service-namespace`, `-kubernetes-redis-service-name` and
`-kubernetes-redis-service-port` are provided then Skipper creates
Kubernetes dataclient to discover Redis instances
but does not use this dataclient for routing.

The change adds LoadEndpointAddresses to Kubernetes dataclient that is
similar to caching GetEndpointAddresses but does not rely on
previous call to Load or LoadAll to allow discovery of
Redis shards without fetching full cluster state.

Fixes #2476

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
@AlexanderYastrebov AlexanderYastrebov force-pushed the standalone-redis-updater-3 branch from 9d9056f to 540da27 Compare February 15, 2024 11:30

When working with Redis swarm, use Kubernetes service selector. Configure it with `-kubernetes-redis-service-namespace` and `-kubernetes-redis-service-name` flags.
#### HTTP Endpoint
Copy link
Member

Choose a reason for hiding this comment

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

👍

@szuecs
Copy link
Member

szuecs commented Feb 15, 2024

👍

1 similar comment
@AlexanderYastrebov
Copy link
Member Author

👍

@AlexanderYastrebov AlexanderYastrebov merged commit 37c474a into master Feb 16, 2024
14 checks passed
@AlexanderYastrebov AlexanderYastrebov deleted the standalone-redis-updater-3 branch February 16, 2024 10:58
AlexanderYastrebov added a commit that referenced this pull request Feb 23, 2024
Routesrv supports dynamic discovery of Redis instances using Kubernetes Service,
see https://github.com/zalando/skipper/blob/master/docs/tutorials/ratelimit.md#redis-based-cluster-ratelimits

Dynamic discovery relies on Kubernetes Dataclient that also fetches
Ingresses and RouteGroups and creates routes from them.

This change enables dynamic discovery of Redis instances using
Kubernetes without fetching Ingresses and RouteGroups.

When -kubernetes flag is not set but
-kubernetes-redis-service-namespace, -kubernetes-redis-service-name and
-kubernetes-redis-service-port are provided then `routesrv` creates
Kubernetes dataclient to discover Redis instances
but does not use this dataclient to load routes.

See previous #2934

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major moderate risk, for example new API, small filter changes that have no risk like refactoring or logs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow redis shards discovery without full-fledged k8s dataclient
2 participants