Documentation ¶
Overview ¶
VolSync data movers are created by implementing the interfaces in this package. Each data mover must implement the Builder interface that constructs instances of the Mover (interface) given a ReplicationSource or ReplicationDestination CR. These builders must be created and Register()-ed with the Catalog at startup time for that mover type to be available.
When an RS or RD CR is reconciled, the Builders in the Catalog are tried in sequence. If one successfully returns a Mover, that mover is used to perform the reconcile.
Movers implement the actual synchronization of data and return a Result from each invocation. When one of the Mover's functions returns Completed(), the operation (either synchronization or cleanup of a previous synchronization is considered to be completed).
Index ¶
Constants ¶
const ( // SnapshotBindTimeout is the amount of time we should wait before warning // that a VolumeSnapshot object is not bound to a VolumeSnapshotContent // object. SnapshotBindTimeout = 30 * time.Second // PVCBindTimeout is the time we should wait before warning that a PVC // object is not bound to a PV. PVCBindTimeout = 120 * time.Second // ServiceAddressTimeout is the time we should wait before warning that a // Service has not been assigned an address ServiceAddressTimeout = 15 * time.Second )
const ( EvRTransferStarted = "TransferStarted" EvRTransferFailed = "TransferFailed" // Warning EvRSnapCreated = "VolumeSnapshotCreated" EvRSnapNotBound = "VolumeSnapshotNotBound" // Warning EvRPVCCreated = "PersistentVolumeClaimCreated" EvRPVCNotBound = "PersistentVolumeClaimNotBound" // Warning EvRSvcAddress = "ServiceAddressAssigned" EvRSvcNoAddress = "NoServiceAddressAssigned" // Warning )
Event "reason" strings: Why are we sending an event?
const ( EvANone = "" // No action EvACreateMover = "CreateMover" EvADeleteMover = "DeleteMover" EvACreatePVC = "CreatePersistentVolumeClaim" EvACreateSnap = "CreateVolumeSnapshot" )
Event "action" strings: Things the controller "does"
Variables ¶
var ( ErrNoMoverFound = fmt.Errorf("a replication method must be specified") ErrMultipleMoversFound = fmt.Errorf("only one replication method can be supplied") )
var Catalog []Builder
Catalog is the list of the available Builders for the controller to use when attempting to find an appropriate mover to service the RS/RD CR.
Functions ¶
Types ¶
type Builder ¶
type Builder interface { // FromSource attempts to construct a Mover from the provided // ReplicationSource. If the RS does not reference the Builder's mover type, // this function should return (nil, nil). FromSource(client client.Client, logger logr.Logger, eventRecorder events.EventRecorder, source *volsyncv1alpha1.ReplicationSource) (Mover, error) // FromDestination attempts to construct a Mover from the provided // ReplicationDestination. If the RS does not reference the Builder's mover // type, this function should return (nil, nil). FromDestination(client client.Client, logger logr.Logger, eventRecorder events.EventRecorder, destination *volsyncv1alpha1.ReplicationDestination) (Mover, error) // VersionInfo returns a string describing the version of this mover. In // most cases, this is the container image/tag that will be used. VersionInfo() string }
Builder is used to construct Mover instances for the different data mover types.
type Mover ¶
type Mover interface { // The name of this data mover Name() string // Synchronize begins or continues a synchronization attempt. Attempts will // continue at least until the Result indicates that the synchronization is // complete. Must be idempotent. Synchronize(ctx context.Context) (Result, error) // Cleanup begins or continues the post-synchronization cleanup of temporary // resources. Must be idempotent. Cleanup(ctx context.Context) (Result, error) }
Mover is a common interface that all data movers implement
func GetDestinationMoverFromCatalog ¶ added in v0.5.0
func GetDestinationMoverFromCatalog(client client.Client, logger logr.Logger, eventRecorder events.EventRecorder, destination *volsyncv1alpha1.ReplicationDestination) (Mover, error)
func GetSourceMoverFromCatalog ¶ added in v0.5.0
func GetSourceMoverFromCatalog(client client.Client, logger logr.Logger, eventRecorder events.EventRecorder, source *volsyncv1alpha1.ReplicationSource) (Mover, error)
type Result ¶
type Result struct { // Completed is set to true if the synchronization has completed. RetryAfter // will be ignored. Completed bool // Image is the resulting data image (PVC or Snapshot) that has been created // by the Synchronize() operation. Image *corev1.TypedLocalObjectReference // RetryAfter is used to indicate whether synchronization should be // explicitly retried, and when. Setting to nil (default) does not cause an // explicit retry, but Synchronize() will be retried when a watched object // is modified. Setting to 0 indicates an immediate retry. Other values // provide a delay. RetryAfter *time.Duration }
Result indicates the outcome of a synchronization attempt
func CompleteWithImage ¶
func CompleteWithImage(image *corev1.TypedLocalObjectReference) Result
CompleteWithImage indicates that the operation has completed, and it provides the synchronized image to the controller.
func InProgress ¶
func InProgress() Result
InProgress result indicates that the requested operation is still ongoing, but it does not request an explicit requeueing.
func RetryAfter ¶
RetryAfter indicates the operation is ongoing and requests explicit requeueing after the provided duration.
func (Result) ReconcileResult ¶
ReconcileResult converts a Result into controllerruntime's reconcile result structure