Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c20a974
updated snapshotRep api spec
geoffrey1330 Apr 28, 2026
e75221a
replace VolumeIDs with PVCRefs in SnapshotReplication spec and contro…
geoffrey1330 Apr 28, 2026
8628569
rebased branch with main
geoffrey1330 May 5, 2026
ae86531
fix(storagenode): use per-cluster EndpointSlice name to prevent multi…
geoffrey1330 May 5, 2026
07d26d4
replace failbackLvol blocking waits with non-blocking per-volume phas…
geoffrey1330 May 5, 2026
95c5e3a
split advanceFailbackVolume into replication and deletion phase helpe…
geoffrey1330 May 5, 2026
9e8fe61
fix: split VolPhaseFailbackReplicateOnSource into separate DeleteTarg…
geoffrey1330 May 6, 2026
95478ae
fix: use NQN-extracted source lvol UUID for fresh cluster failback to…
geoffrey1330 May 6, 2026
3f651b4
refactor(failback): replace first replication_trigger with replicatio…
geoffrey1330 May 7, 2026
b4e369c
fix: add FailbackStartReplication and FailbackWaitReplication to CRD …
geoffrey1330 May 7, 2026
6f196a9
fix: use sourceClusterSecret for replication_start auth to match sour…
geoffrey1330 May 7, 2026
24bd10c
Merge branch 'main' into modify_snapshot_replication
geoffrey1330 May 7, 2026
b57b890
updated snapshot replication crd
geoffrey1330 May 7, 2026
98f2e1a
fix failback loop processing REP_ transfer lvols as failback candidat…
geoffrey1330 May 8, 2026
5e22a63
fix: mark volume Failed when replicate_lvol_on_target_cluster has no …
geoffrey1330 May 8, 2026
d73c191
feat: populate pvcRef in volume status from lvol pvc_name when pvcRef…
geoffrey1330 May 11, 2026
b5c3c3c
Merge branch 'main' into modify_snapshot_replication
geoffrey1330 May 22, 2026
1eb937c
ran make generate
geoffrey1330 May 22, 2026
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
62 changes: 54 additions & 8 deletions api/v1alpha1/snapshotreplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,36 @@ const (

// VolPhasePaused means replication is explicitly paused.
VolPhasePaused = "Paused"

// Failback sub-phases — each maps to a single non-blocking reconcile step.
// Source info is resolved once and stored in FailbackVolumeState so that
// every subsequent step can be re-entered safely after a crash or requeue.

// VolPhaseFailbackStartReplication means replication_start should be called
// on the target lvol with the source cluster as the replication destination.
VolPhaseFailbackStartReplication = "FailbackStartReplication"
// VolPhaseFailbackWaitReplication means the controller is polling for the
// first replication task (started via replication_start) to complete.
VolPhaseFailbackWaitReplication = "FailbackWaitReplication"
// VolPhaseFailbackSuspend means the target lvol should be suspended and
// replication_trigger called to capture the final delta snapshot.
VolPhaseFailbackSuspend = "FailbackSuspend"
// VolPhaseFailbackWaitSecond means the controller is polling for the second
// (post-suspend) replication task to complete.
VolPhaseFailbackWaitSecond = "FailbackWaitSecond"
// VolPhaseFailbackDeleteSource means the source lvol should be deleted.
VolPhaseFailbackDeleteSource = "FailbackDeleteSource"
// VolPhaseFailbackWaitSourceDeleted means the controller is polling for the
// source lvol to reach the deleted state.
VolPhaseFailbackWaitSourceDeleted = "FailbackWaitSourceDeleted"
// VolPhaseFailbackReplicateOnSource means replicate_lvol_on_source_cluster
// should be called, then the target lvol deleted.
VolPhaseFailbackReplicateOnSource = "FailbackReplicateOnSource"
// VolPhaseFailbackDeleteTarget means the target lvol should be deleted.
VolPhaseFailbackDeleteTarget = "FailbackDeleteTarget"
// VolPhaseFailbackWaitTargetDeleted means the controller is polling for the
// target lvol to reach the deleted state.
VolPhaseFailbackWaitTargetDeleted = "FailbackWaitTargetDeleted"
)

// Condition type constants used in SnapshotReplicationStatus.Conditions.
Expand Down Expand Up @@ -105,15 +135,15 @@ type SnapshotReplicationSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Include Volume IDs"
// Optional: only these volumes are included in failback.
// If empty, all volumes are candidates unless excluded below.
IncludeVolumeIDs []string `json:"includeVolumeIDs,omitempty"`
IncludePVCRefs []PersistentVolumeClaimRef `json:"includePVCRefs,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Exclude Volume IDs"
// Optional: volumes to exclude from failback.
ExcludeVolumeIDs []string `json:"excludeVolumeIDs,omitempty"`
// Optional: PVCs to exclude from failback.
ExcludePVCRefs []PersistentVolumeClaimRef `json:"excludePVCRefs,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Volume IDs"
// Optional: list of volumes to replicate. Empty means all volumes
VolumeIDs []string `json:"volumeIDs,omitempty"`
// Optional: list of PVCs to replicate. Empty means all volumes.
PVCRefs []PersistentVolumeClaimRef `json:"pvcRefs,omitempty"`
}

// SnapshotReplicationStatus defines the observed state of SnapshotReplication.
Expand All @@ -137,13 +167,25 @@ type SnapshotReplicationStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// FailbackVolumeState holds per-volume identifiers resolved once at the start
// of a failback and persisted so every subsequent phase can be re-entered
// safely after a crash or requeue without re-querying the source cluster.
type FailbackVolumeState struct {
SourcePoolUUID string `json:"sourcePoolUUID,omitempty"`
SourceLvolUUID string `json:"sourceLvolUUID,omitempty"`
IsFreshCluster bool `json:"isFreshCluster,omitempty"`
}

// VolumeReplicationStatus tracks the replication state of an individual volume
type VolumeReplicationStatus struct {
// Volume ID
VolumeID string `json:"volumeID"`
// PVCRef identifies the PVC being replicated
PVCRef PersistentVolumeClaimRef `json:"pvcRef"`

// VolumeID is the resolved backend volume UUID
VolumeID string `json:"volumeID,omitempty"`

// Phase is the current replication phase for this volume.
// +kubebuilder:validation:Enum=Pending;Running;TriggeringTargetReplication;WaitingForTargetReplication;ReplicatingToSource;WaitingForTargetDeletion;Completed;Failed;Paused
// +kubebuilder:validation:Enum=Pending;Running;TriggeringTargetReplication;WaitingForTargetReplication;ReplicatingToSource;WaitingForTargetDeletion;Completed;Failed;Paused;FailbackStartReplication;FailbackWaitReplication;FailbackSuspend;FailbackWaitSecond;FailbackDeleteSource;FailbackWaitSourceDeleted;FailbackReplicateOnSource;FailbackDeleteTarget;FailbackWaitTargetDeleted
Phase string `json:"phase,omitempty"`

// Last snapshot ID replicated for this volume
Expand All @@ -157,6 +199,10 @@ type VolumeReplicationStatus struct {

// Optional: list of errors encountered for this volume
Errors []ReplicationError `json:"errors,omitempty"`

// FailbackState stores identifiers resolved during failback initiation and
// used by all subsequent failback phases.
FailbackState *FailbackVolumeState `json:"failbackState,omitempty"`
}

// ReplicationError stores timestamped error messages
Expand Down
39 changes: 30 additions & 9 deletions api/v1alpha1/zz_generated.deepcopy.go

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

90 changes: 77 additions & 13 deletions config/crd/bases/storage.simplyblock.io_snapshotreplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,58 @@ spec:
enum:
- failback
type: string
excludeVolumeIDs:
description: 'Optional: volumes to exclude from failback.'
excludePVCRefs:
description: 'Optional: PVCs to exclude from failback.'
items:
type: string
properties:
name:
description: Name is the PVC name.
type: string
namespace:
description: Namespace overrides the backup resource namespace
for the PVC lookup.
type: string
required:
- name
type: object
type: array
includeVolumeIDs:
includePVCRefs:
description: |-
Optional: only these volumes are included in failback.
If empty, all volumes are candidates unless excluded below.
items:
type: string
properties:
name:
description: Name is the PVC name.
type: string
namespace:
description: Namespace overrides the backup resource namespace
for the PVC lookup.
type: string
required:
- name
type: object
type: array
interval:
description: 'snapshot replication interval in seconds (default: 300sec)'
format: int32
type: integer
pvcRefs:
description: 'Optional: list of PVCs to replicate. Empty means all
volumes.'
items:
properties:
name:
description: Name is the PVC name.
type: string
namespace:
description: Namespace overrides the backup resource namespace
for the PVC lookup.
type: string
required:
- name
type: object
type: array
sourceCluster:
description: Source cluster for the snapshots
type: string
Expand All @@ -89,12 +125,6 @@ spec:
description: snapshot replication timeout
format: int32
type: integer
volumeIDs:
description: 'Optional: list of volumes to replicate. Empty means
all volumes'
items:
type: string
type: array
required:
- sourceCluster
- targetCluster
Expand Down Expand Up @@ -193,6 +223,18 @@ spec:
- timestamp
type: object
type: array
failbackState:
description: |-
FailbackState stores identifiers resolved during failback initiation and
used by all subsequent failback phases.
properties:
isFreshCluster:
type: boolean
sourceLvolUUID:
type: string
sourcePoolUUID:
type: string
type: object
lastReplicationTime:
description: Timestamp of the last successful replication for
this volume
Expand All @@ -214,16 +256,38 @@ spec:
- Completed
- Failed
- Paused
- FailbackStartReplication
- FailbackWaitReplication
- FailbackSuspend
- FailbackWaitSecond
- FailbackDeleteSource
- FailbackWaitSourceDeleted
- FailbackReplicateOnSource
- FailbackDeleteTarget
- FailbackWaitTargetDeleted
type: string
pvcRef:
description: PVCRef identifies the PVC being replicated
properties:
name:
description: Name is the PVC name.
type: string
namespace:
description: Namespace overrides the backup resource namespace
for the PVC lookup.
type: string
required:
- name
type: object
replicatedCount:
description: Number of snapshots successfully replicated
format: int32
type: integer
volumeID:
description: Volume ID
description: VolumeID is the resolved backend volume UUID
type: string
required:
- volumeID
- pvcRef
type: object
type: array
type: object
Expand Down
Loading
Loading