Skip to content

Commit

Permalink
Fix command line for Redis liveness probe
Browse files Browse the repository at this point in the history
redis-cli requires the command argument to be passed after the
credentials. Also (at least on 6.x versions) it does not properly return
an error status on authentication failures. This causes the liveness
probe to always return success. Fix this by checking for a PONG response
to a PING.
  • Loading branch information
mpihlak committed Mar 20, 2023
1 parent fe8090a commit f358664
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example/operator/custom-startup-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
data:
startup.sh: |
#!/bin/bash
redis-cli -h 127.0.0.1 -p ${REDIS_PORT} ping --user pinger --pass pingpass --no-auth-warning
redis-cli -h 127.0.0.1 -p ${REDIS_PORT} --user pinger --pass pingpass --no-auth-warning ping | grep PONG
---
apiVersion: databases.spotahome.com/v1
kind: RedisFailover
Expand Down
2 changes: 1 addition & 1 deletion operator/redisfailover/service/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func generateRedisStatefulSet(rf *redisfailoverv1.RedisFailover, labels map[stri
Command: []string{
"sh",
"-c",
fmt.Sprintf("redis-cli -h $(hostname) -p %[1]v ping --user pinger --pass pingpass --no-auth-warning", rf.Spec.Redis.Port),
fmt.Sprintf("redis-cli -h $(hostname) -p %[1]v --user pinger --pass pingpass --no-auth-warning ping | grep PONG", rf.Spec.Redis.Port),
},
},
},
Expand Down

0 comments on commit f358664

Please sign in to comment.