Skip to content

Commit

Permalink
Merge pull request #344 from iamabhishek-dubey/ip-fix
Browse files Browse the repository at this point in the history
[BugFix]Fixed IP check logic for conversion
  • Loading branch information
sandy724 authored Oct 7, 2022
2 parents 16d57f1 + 0226c39 commit dcc4c8f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions k8sutils/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ func getRedisServerIP(redisInfo RedisDetails) string {

redisIP := redisPod.Status.PodIP
// If we're NOT IPv4, assume were IPv6..
if net.ParseIP(redisIP).To4() == nil {
logger.Info("Redis is IPv6", "ip", redisIP, "ipv6", net.ParseIP(redisIP).To16())
redisIP = fmt.Sprintf("[%s]", redisIP)
if redisIP != "" {
if net.ParseIP(redisIP).To4() == nil {
logger.Info("Redis is IPv6", "ip", redisIP, "ipv6", net.ParseIP(redisIP).To16())
redisIP = fmt.Sprintf("[%s]", redisIP)
}
}

logger.Info("Successfully got the ip for redis", "ip", redisIP)
Expand Down

0 comments on commit dcc4c8f

Please sign in to comment.