Skip to content

Add Redis status.disasterRecovery and per-DC HorizontalScaling.dataCenters for cross-DC DR - #1793

Open
tamalsaha wants to merge 3 commits into
masterfrom
dc-dr-redis
Open

tamalsaha wants to merge 3 commits into
masterfrom
dc-dr-redis

Conversation

@tamalsaha

@tamalsaha tamalsaha commented Jun 30, 2026 •

Copy link
Copy Markdown
Member

What

The apimachinery API surface for cross data center disaster recovery (DC-DR) of the distributed Redis / Valkey engine. This is the release-first piece; the operator and redis-coordinator bump to it.

1. status.disasterRecovery (Redis status)

  • RedisDisasterRecoveryStatus on RedisStatus.disasterRecovery: activeDC, phase (RedisDRPhase: Steady/FailingOver/FailingBack/Degraded), per-DC dataCenters, lastTransitionTime.
  • RedisDCStatus (one per Member DC): clusterName (the OCM managed cluster / DC), role (Member or Arbiter), master (the DC's Redis master pod), writable, linkStatus (cross-DC master_link_status), lagBytes (active master master_repl_offset minus this DC master's replicated offset), and healthy.

The cross-DC failover decision is owned by the dr-controlplane primary-DC Lease; this status only reflects it on the single distributed object. Redis keeps its quorum (gossip or Sentinel) intra-DC; the standby DC's master async-replicates from the active DC's master, so the lag metric is a replication-offset gap.

2. HorizontalScaling.dataCenters (Redis ops)

  • RedisHorizontalScalingSpec.DataCenters ([]RedisHorizontalScalingDC) lets a distributed DC-DR Redis be scaled per data center: each entry sets that DC's local node count (and, for Cluster mode, its shard count); DCs not listed are unchanged. Each DC is a self-contained Redis scaled independently, so this replaces the top-level Shards/Replicas for a DC-DR cluster.

Notes

  • zz_generated.deepcopy.go updated by hand to match the generated shape (same pattern as the Postgres DR types).
  • Status-only and additive on the spec side (a new optional ops field); backward compatible.
  • go build ./apis/kubedb/v1/ ./apis/ops/v1alpha1/ and gofmt -l are clean.

Consumed by

kubedb/redis#658 (operator), kubedb/redis#659 (per-DC day-2 ops), kubedb/redis#660 (Cluster-mode sync + per-DC horizontal scaling), kubedb/redis-coordinator#164 (fence), and docs kubedb/docs#943.

Add the per data center DC-DR view to the Redis status, mirroring the
Postgres DC-DR API. The cross-DC failover decision is owned by the
dr-controlplane primary-DC Lease; this status reflects it on the single
distributed Redis object.

RedisDisasterRecoveryStatus carries the active DC, the DR phase, and a
per Member DC view (RedisDCStatus): the DC master pod, whether it is the
writable primary, the cross-DC replication link health (master_link_status)
and offset lag in bytes (active master_repl_offset minus this DC master's
replicated offset), and DC health. Update the generated deepcopy.

Signed-off-by: Tamal Saha <tamal@appscode.com>
kodiak-appscode[bot]
kodiak-appscode Bot previously approved these changes Jun 30, 2026
Add RedisHorizontalScalingSpec.DataCenters ([]RedisHorizontalScalingDC) so
a distributed DC-DR Redis can be scaled per data center: each entry sets a
DC's local node count (and, for Cluster mode, its shard count); DCs not
listed are unchanged. Each DC is a self-contained Redis scaled
independently, so this replaces the top-level Shards/Replicas for a DC-DR
cluster. Update the generated deepcopy.

Signed-off-by: Tamal Saha <tamal@appscode.com>
kodiak-appscode[bot]
kodiak-appscode Bot previously approved these changes Jul 1, 2026
@tamalsaha tamalsaha changed the title Add Redis status.disasterRecovery for cross-DC DR Add Redis status.disasterRecovery and per-DC HorizontalScaling.dataCenters for cross-DC DR Jul 1, 2026
…Status

Clarify that for a Cluster-mode DC-DR Redis, where cross-DC replication is an
external logical sync with no comparable byte offset, LagBytes is the count of
heartbeat writes the active DC has produced that this DC has not yet replayed
(zero means caught up), and LinkStatus reflects the sync workload health rather
than a native master_link_status.

Signed-off-by: Tamal Saha <tamal@appscode.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.

1 participant