Use host IP instead of localhost for setting redis cluster

What does this MR do and why?

This MR fixes the connection issue faced in https://gitlab.com/gitlab-org/gitlab/-/jobs/4313521103#L780 which is part of pipeline (https://gitlab.com/gitlab-org/gitlab/-/pipelines/872295832).

The connection error was seen for all jobs. It should say rediscluster since that is the service alias.

Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:7001 (Errno::ECONNREFUSED)

In the same logs, there are IP address for this node updated to 127.0.0.1 which could be due to the node IP being hard-coded as localhost. I think this might have messed with the docker internal routing.

Compared, with the grokzen/redis-cluster image, it uses the docker host IP instead. Let's try this out.

Validation

I pushed the image to my own project (https://gitlab.com/schin1/redis-cluster-setup/container_registry/4216193) and applied it to .use-pg13 jobs in gitlab!121221 (ab7fdc3b).

The equivalent job now passes (https://gitlab.com/gitlab-org/gitlab/-/jobs/4313884282) with no connectivity errors. Looking at the entire pipeline (https://gitlab.com/gitlab-org/gitlab/-/pipelines/872373206), pg13 jobs are mostly passing (not all pg13 jobs use .use-pg13) compared to the pg12 and pg14 ones which are using the current broken image.

Checklist

Edited by Sylvester Chin

Merge request reports

Loading