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

Using a readiness probe halts operator progress #1016

Open
com6056 opened this issue Jul 2, 2024 · 7 comments · May be fixed by #1038
Open

Using a readiness probe halts operator progress #1016

com6056 opened this issue Jul 2, 2024 · 7 comments · May be fixed by #1038
Labels
bug Something isn't working

Comments

@com6056
Copy link
Contributor

com6056 commented Jul 2, 2024

It seems like we check the ready state of all of the replicas here:

if int(sts.Status.ReadyReplicas) != replicas {

When you use a custom readiness probe though that checks cluster status, the operator can get into a stuck state during bootstrapping and scale in/out since the readiness probe will be failing until the operator actually takes action to create the cluster or add/remove nodes from the cluster.

Is there any way we can base the operator off of the liveness probes, or maybe only take into account readiness when we expect the cluster to be in a fully ready state?

@com6056 com6056 added the bug Something isn't working label Jul 2, 2024
@com6056
Copy link
Contributor Author

com6056 commented Jul 2, 2024

For example, a simple readiness probe to ensure pods only roll when it is safe to do so:

#!/bin/sh

state=$(redis-cli cluster info | grep cluster_state | cut -d: -f2 | tr -d '[:space:]')

if [ "$state" != ok ]; then
  echo "FAIL: Cluster state is $state"
  exit 1
fi

slots_assigned=$(redis-cli cluster info | grep cluster_slots_assigned | cut -d: -f2 | tr -d '[:space:]')
slots_ok=$(redis-cli cluster info | grep cluster_slots_ok | cut -d: -f2 | tr -d '[:space:]')

if [ "$slots_assigned" != "$slots_ok" ]; then
  echo "FAIL: Not all assigned cluster slots are ok"
  exit 1
fi

But this will fail until the cluster is actually created and it will fail on nodes being added/removed from the cluster, making it so the operator halts any progress.

@drivebyer
Copy link
Collaborator

Currently, we utilize this state from

RedisClusterReady RedisClusterState = "Ready"
to indicate whether the cluster is prepared. Do you find this sufficient for your use case? @com6056

@com6056
Copy link
Contributor Author

com6056 commented Jul 3, 2024

Unfortunately without a readiness probe, the StatefulSet has no protections against rolling the pods too fast, so we also need readiness probes (unless the operator can somehow add a feature to control how fast the pods roll in a RollingUpdate)

@com6056
Copy link
Contributor Author

com6056 commented Jul 3, 2024

I think #923 is somewhat related, although that talks about solving this in the operator itself versus just properly allowing something like a readiness probe to be used

@com6056
Copy link
Contributor Author

com6056 commented Jul 3, 2024

There is also another issue that occurs when you don't use readiness probes, scaling up the cluster causes requests to be sent to the new leader/follower pods even before they have joined the cluster, causing request errors.

@com6056 com6056 linked a pull request Aug 2, 2024 that will close this issue
4 tasks
@com6056
Copy link
Contributor Author

com6056 commented Aug 2, 2024

@drivebyer Still working on actually testing it, but curious what you think of #1038 as a potential way to fix this

@drivebyer
Copy link
Collaborator

@drivebyer Still working on actually testing it, but curious what you think of #1038 as a potential way to fix this

I will look into this by this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants