Documentation ¶
Index ¶
- func ResetStatus(crd *cosmosalpha.ScheduledVolumeSnapshot)
- type Candidate
- type Client
- type FullNodeControl
- func (control FullNodeControl) ConfirmPodDeletion(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot) error
- func (control FullNodeControl) ConfirmPodRestoration(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot) error
- func (control FullNodeControl) SignalPodDeletion(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot) error
- func (control FullNodeControl) SignalPodRestoration(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot) error
- type Getter
- type PodFilter
- type Scheduler
- type StatusSyncer
- type VolumeSnapshotControl
- func (control VolumeSnapshotControl) CreateSnapshot(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot, ...) error
- func (control VolumeSnapshotControl) DeleteOldSnapshots(ctx context.Context, log logr.Logger, crd *cosmosalpha.ScheduledVolumeSnapshot) error
- func (control VolumeSnapshotControl) FindCandidate(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot) (Candidate, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResetStatus ¶
func ResetStatus(crd *cosmosalpha.ScheduledVolumeSnapshot)
ResetStatus resets the CRD's status to appropriate values for the start of a reconcile loop.
Types ¶
type Candidate ¶
type Candidate = cosmosalpha.SnapshotCandidate
type Client ¶
type Client interface { Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error }
Client is a subset of client.Client.
type FullNodeControl ¶
type FullNodeControl struct {
// contains filtered or unexported fields
}
FullNodeControl manages a ScheduledVolumeSnapshot's spec.fullNodeRef.
func NewFullNodeControl ¶
func NewFullNodeControl(statusClient StatusSyncer, client client.Reader) *FullNodeControl
func (FullNodeControl) ConfirmPodDeletion ¶
func (control FullNodeControl) ConfirmPodDeletion(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot) error
ConfirmPodDeletion returns a nil error if the pod is deleted. Any non-nil error is transient, including if the pod has not been deleted yet. Assumes crd's status.candidate is set, otherwise this method panics.
func (FullNodeControl) ConfirmPodRestoration ¶
func (control FullNodeControl) ConfirmPodRestoration(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot) error
ConfirmPodRestoration verifies the pod has been restored.
func (FullNodeControl) SignalPodDeletion ¶
func (control FullNodeControl) SignalPodDeletion(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot) error
SignalPodDeletion updates the LocalFullNodeRef's status to indicate it should delete the pod candidate. The pod is gracefully removed to ensure the highest data integrity while taking a VolumeSnapshot. Assumes crd's status.candidate is set, otherwise this method panics. Any error returned can be treated as transient and retried.
func (FullNodeControl) SignalPodRestoration ¶
func (control FullNodeControl) SignalPodRestoration(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot) error
SignalPodRestoration updates the LocalFullNodeRef's status to indicate it should recreate the pod candidate. Any error returned can be treated as transient and retried.
type Getter ¶
type Getter interface {
Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
}
Getter is a subset of client.Client.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler calculates schedules using crontabs and currently running VolumeSnapshots.
func NewScheduler ¶
func (Scheduler) CalcNext ¶
func (s Scheduler) CalcNext(crd *cosmosalpha.ScheduledVolumeSnapshot) (time.Duration, error)
CalcNext the duration until it's time to take the next snapshot. A zero duration without an error indicates a VolumeSnapshot should be created. Updates crd.status with the last VolumeSnapshot status.
func (Scheduler) IsSnapshotReady ¶
func (s Scheduler) IsSnapshotReady(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot) (bool, error)
IsSnapshotReady returns true if the status.LastSnapshot is ready for use and updates the crd.status.lastSnapshot. A non-nil error can be treated as transient. If VolumeSnapshot is not found, this indicates a rare case where something deleted the VolumeSnapshot before detecting if it's ready. In that case, this method returns that the snapshot is ready.
type StatusSyncer ¶ added in v0.10.0
type VolumeSnapshotControl ¶
type VolumeSnapshotControl struct {
// contains filtered or unexported fields
}
VolumeSnapshotControl manages VolumeSnapshots
func NewVolumeSnapshotControl ¶
func NewVolumeSnapshotControl(client Client, filter PodFilter) *VolumeSnapshotControl
func (VolumeSnapshotControl) CreateSnapshot ¶
func (control VolumeSnapshotControl) CreateSnapshot(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot, candidate Candidate) error
CreateSnapshot creates VolumeSnapshot from the Candidate.PVCName and updates crd.status to reflect the created VolumeSnapshot. CreateSnapshot does not set an owner reference to avoid garbage collection if the CRD is deleted. Any error returned is considered transient and can be retried.
func (VolumeSnapshotControl) DeleteOldSnapshots ¶
func (control VolumeSnapshotControl) DeleteOldSnapshots(ctx context.Context, log logr.Logger, crd *cosmosalpha.ScheduledVolumeSnapshot) error
DeleteOldSnapshots deletes old VolumeSnapshots given crd's spec.limit. If limit not set, defaults to keeping the 3 most recent.
func (VolumeSnapshotControl) FindCandidate ¶
func (control VolumeSnapshotControl) FindCandidate(ctx context.Context, crd *cosmosalpha.ScheduledVolumeSnapshot) (Candidate, error)
FindCandidate finds a suitable candidate for creating a volume snapshot. Only selects a pod that is in-sync. Any errors returned can be treated as transient; worth a retry.