Skip to content

Commit

Permalink
set replica-announce-ip on pods so that operator works with istio ser…
Browse files Browse the repository at this point in the history
…vice mesh

wihtout this the redis IP is identified as 127.0.0.1
  • Loading branch information
cameronbraid committed Apr 5, 2020
1 parent e0d56b2 commit 0ddaee7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pkg/client/redis/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ func (c *client) SetCustomRedisConfig(ip string, configs map[string]string, auth
rClient := rediscli.NewClient(options)
defer rClient.Close()

if err := c.applyRedisConfig("replica-announce-ip", ip, rClient); err != nil {

This comment has been minimized.

Copy link
@polefishu

polefishu May 8, 2020

Contributor

There is no replica-announce-ip configuration in redis 3.2.2, I hope the operator supports redis 3.2.2+.

return err
}

for param, value := range configs {
//param, value, err := c.getConfigParameters(config)
//if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/service/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func (r *RedisClusterChecker) CheckRedisConfig(redisCluster *redisv1beta1.RedisC
return err
}

if _, ok := configs["replica-announce-ip"]; !ok {
return fmt.Errorf("configs conflict, expect: replica-announce-ip to be set")
}

// TODO when custom config use unit like mb gb, will return configs conflict
for key, value := range redisCluster.Spec.Config {
if value != configs[key] {
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/service/heal.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ func (r *RedisClusterHealer) SetSentinelCustomConfig(ip string, rc *redisv1beta1

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

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

0 comments on commit 0ddaee7

Please sign in to comment.