Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions apis/kubedb/v1/redis_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,81 @@ type RedisStatus struct {
Conditions []kmapi.Condition `json:"conditions,omitempty"`
// +optional
AuthSecret *Age `json:"authSecret,omitempty"`
// DisasterRecovery reports the cross data center (DC-DR) state for a distributed Redis.
// +optional
DisasterRecovery *RedisDisasterRecoveryStatus `json:"disasterRecovery,omitempty"`
}

// RedisDRPhase is the cross data center DR phase of a distributed Redis.
type RedisDRPhase string

const (
RedisDRPhaseSteady RedisDRPhase = "Steady"
RedisDRPhaseFailingOver RedisDRPhase = "FailingOver"
RedisDRPhaseFailingBack RedisDRPhase = "FailingBack"
RedisDRPhaseDegraded RedisDRPhase = "Degraded"
)

// RedisDisasterRecoveryStatus reports the per data center DC-DR view of a
// distributed Redis. The cross-DC decision is owned by the dr-controlplane
// primary-DC Lease; this status reflects it on the single Database object. Each
// Member DC runs a self-contained Redis (its own gossip ring or Sentinel quorum);
// the standby DC's master async-replicates from the active DC's master.
type RedisDisasterRecoveryStatus struct {
// ActiveDC is the data center that currently holds the primary DC Lease and runs the writable master.
// +optional
ActiveDC string `json:"activeDC,omitempty"`

// Phase is the DC-DR phase.
// +optional
Phase RedisDRPhase `json:"phase,omitempty"`

// DataCenters is the per data center view, one entry per Member DC.
// +optional
DataCenters []RedisDCStatus `json:"dataCenters,omitempty"`

// LastTransitionTime is when ActiveDC last changed.
// +optional
LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"`
}

// RedisDCStatus is one data center's local view inside a distributed Redis.
type RedisDCStatus struct {
// ClusterName is the data center, named by its OCM managed cluster (the same
// clusterName used in the PlacementPolicy distributionRule).
ClusterName string `json:"clusterName"`

// Role is Member or Arbiter. An Arbiter DC holds only the dr-controlplane etcd
// member and runs no Redis.
// +optional
Role string `json:"role,omitempty"`

// Master is this DC's local Redis master pod.
// +optional
Master string `json:"master,omitempty"`

// Writable is true when this DC's master is the cluster's writable primary.
// +optional
Writable bool `json:"writable,omitempty"`

// LinkStatus is this DC master's cross-DC replication link health, for example up or
// down. In Sentinel/Standalone it is the master_link_status from INFO replication; in
// Cluster mode it reflects the external logical-sync workload health (up while the
// inbound sync has a ready pod). It is empty on the active DC, which has no upstream.
// +optional
LinkStatus string `json:"linkStatus,omitempty"`

// LagBytes is this DC's cross-DC replication lag behind the active DC. In
// Sentinel/Standalone it is the active master's master_repl_offset minus this DC
// master's replicated offset (bytes). In Cluster mode, where replication is a logical
// sync with no comparable byte offset, it is the count of heartbeat writes the active
// DC has produced that this DC has not yet replayed; zero means fully caught up.
// +optional
LagBytes *int64 `json:"lagBytes,omitempty"`

// Healthy reflects whether this DC's health Lease is fresh.
// +optional
Healthy bool `json:"healthy,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
53 changes: 53 additions & 0 deletions apis/kubedb/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions apis/ops/v1alpha1/redis_ops_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,29 @@ type RedisHorizontalScalingSpec struct {
// cluster-announce-ip, cluster-announce-port, cluster-announce-bus-port, cluster-announce-tls-port
// While scaling up shard or replica just provide the missing announces.
Announce *Announce `json:"announce,omitempty"`

// DataCenters scales individual data centers of a distributed DC-DR Redis. Each
// entry sets that data center's local node count (and, for Cluster mode, its shard
// count); data centers not listed are left unchanged. Use this instead of the
// top-level Shards/Replicas for a DC-DR cluster, where each data center is a
// self-contained Redis scaled independently.
// +optional
DataCenters []RedisHorizontalScalingDC `json:"dataCenters,omitempty"`
}

// RedisHorizontalScalingDC is a per data center scaling target for a distributed
// DC-DR Redis.
type RedisHorizontalScalingDC struct {
// ClusterName is the data center, named by its OCM managed cluster, matching a
// Member distributionRule in the Redis PlacementPolicy.
ClusterName string `json:"clusterName"`
// Replicas is the desired local node count for this data center (Sentinel and
// Standalone), or the desired replicas per shard for Cluster mode.
// +optional
Replicas *int32 `json:"replicas,omitempty"`
// Shards is the desired shard count for this data center in Cluster mode.
// +optional
Shards *int32 `json:"shards,omitempty"`
}

// RedisVerticalScalingSpec is the spec for Redis vertical scaling
Expand Down
33 changes: 33 additions & 0 deletions apis/ops/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading