Skip to content

Commit 0ddaee7

Browse files
committed
set replica-announce-ip on pods so that operator works with istio service mesh
wihtout this the redis IP is identified as 127.0.0.1
1 parent e0d56b2 commit 0ddaee7

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

pkg/client/redis/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ func (c *client) SetCustomRedisConfig(ip string, configs map[string]string, auth
272272
rClient := rediscli.NewClient(options)
273273
defer rClient.Close()
274274

275+
if err := c.applyRedisConfig("replica-announce-ip", ip, rClient); err != nil {
276+
return err
277+
}
278+
275279
for param, value := range configs {
276280
//param, value, err := c.getConfigParameters(config)
277281
//if err != nil {

pkg/controller/service/check.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ func (r *RedisClusterChecker) CheckRedisConfig(redisCluster *redisv1beta1.RedisC
6262
return err
6363
}
6464

65+
if _, ok := configs["replica-announce-ip"]; !ok {
66+
return fmt.Errorf("configs conflict, expect: replica-announce-ip to be set")
67+
}
68+
6569
// TODO when custom config use unit like mb gb, will return configs conflict
6670
for key, value := range redisCluster.Spec.Config {
6771
if value != configs[key] {

pkg/controller/service/heal.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ func (r *RedisClusterHealer) SetSentinelCustomConfig(ip string, rc *redisv1beta1
124124

125125
// SetRedisCustomConfig will call redis to set the configuration given in config
126126
func (r *RedisClusterHealer) SetRedisCustomConfig(ip string, rc *redisv1beta1.RedisCluster, auth *util.AuthConfig) error {
127-
if len(rc.Spec.Config) == 0 && len(auth.Password) == 0 {
128-
return nil
129-
}
127+
// if len(rc.Spec.Config) == 0 && len(auth.Password) == 0 {
128+
// return nil
129+
// }
130130

131131
//if len(auth.Password) != 0 {
132132
// rc.Spec.Config["requirepass"] = auth.Password

0 commit comments

Comments
 (0)