Skip to content

Comments

fix: use pod FQDN for replica-announce-ip and sentinel announce-ip#1685

Open
pcamminadi wants to merge 2 commits intoOT-CONTAINER-KIT:mainfrom
pcamminadi:fix/sentinel-and-replica-announce-hostname
Open

fix: use pod FQDN for replica-announce-ip and sentinel announce-ip#1685
pcamminadi wants to merge 2 commits intoOT-CONTAINER-KIT:mainfrom
pcamminadi:fix/sentinel-and-replica-announce-hostname

Conversation

@pcamminadi
Copy link

Description

When running Redis Replication with Sentinel behind a service mesh (e.g. Istio), pod IPs can be non-routable loopback addresses (such as 127.0.0.6). This causes two problems:

  1. Sentinel announce-ip was set to the master's address — the existing code used the ip variable (which holds the master's address) for sentinel announce-ip, instead of the sentinel pod's own address.
  2. Replicas had no replica-announce-ip — in replication/standalone mode, replicas never announced their address, so sentinels tracked them by their ephemeral (and potentially non-routable) pod IP.

This PR:

  • Adds resolveHostnames and announceHostnames fields to RedisReplicationSpec, matching the existing fields on SentinelConfig.
  • When both are set to "yes", replicas set replica-announce-ip to their pod FQDN.
  • Fixes the sentinel bootstrap to resolve its own FQDN for sentinel announce-ip instead of incorrectly using the master's address.
  • Propagates the new fields as RESOLVE_HOSTNAMES / ANNOUNCE_HOSTNAMES env vars to the Redis replication container.
  • Exposes the new fields in the redis-replication Helm chart.

Fixes #1635

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • Tests have been added/modified and all tests pass.
  • Functionality/bugs have been confirmed to be unchanged or fixed.
  • I have performed a self-review of my own code.
  • Documentation has been updated or added where necessary.

Additional Context

  • Default values ("no") preserve existing behavior — no env vars are injected unless the user explicitly sets the fields to "yes".
  • The sentinel's resolveHostnames/announceHostnames fields in SentinelConfig (common types) already existed; this PR only adds them at the RedisReplicationSpec level so the Redis agent can also use them.
  • Unit tests added for generateRedisReplicationContainerParams covering env var injection for all combinations of resolveHostnames/announceHostnames values, including appending to existing env vars.
  • Tested on a Kubernetes cluster with Istio service mesh, confirming that sentinels and replicas correctly announce their FQDNs and failover works as expected.

@pcamminadi pcamminadi force-pushed the fix/sentinel-and-replica-announce-hostname branch from 373c24a to c4c2225 Compare February 20, 2026 13:43
pcamminadi and others added 2 commits February 20, 2026 14:53
  When running Redis Replication with Sentinel behind a service mesh
  (e.g. Istio), pod IPs can be non-routable loopback addresses. This
  adds resolveHostnames/announceHostnames fields to RedisReplicationSpec
  so that replicas and sentinels announce their FQDN instead of their
  pod IP.

  Also fixes a bug where sentinel announce-ip was incorrectly set to
  the master's address instead of the sentinel's own address.

Signed-off-by: pcamminadi <53015959+pcamminadi@users.noreply.github.com>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…njection

  Verify that RESOLVE_HOSTNAMES and ANNOUNCE_HOSTNAMES env vars are only
  injected when explicitly set to "yes", and that they append correctly
  to existing env vars.

Signed-off-by: pcamminadi <53015959+pcamminadi@users.noreply.github.com>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sentinel PODs hold onto older IPs of replication PODs resulting in accessibility

1 participant