Documentation ¶
Index ¶
- Constants
- func AddCommonClaimLabels(pvc *corev1.PersistentVolumeClaim)
- func AddCommonLabels(obj metav1.Object)
- func AddOwnershipLabel(label string, obj, owner metav1.Object)
- func GetCommonDriver(ctx context.Context, c client.Client, pvcs ...*corev1.PersistentVolumeClaim) (*string, error)
- func GetCompatibleVolumeSnapshotClass(ctx context.Context, c client.Client, log logr.Logger, ...) (*string, error)
- func GetDriverFromVolume(ctx context.Context, c client.Client, pvc *corev1.PersistentVolumeClaim) (*string, error)
- func GetGlobalCloneStrategyOverride(ctx context.Context, c client.Client) (*cdiv1.CDICloneStrategy, error)
- func GetStorageClassForClaim(ctx context.Context, c client.Client, pvc *corev1.PersistentVolumeClaim) (*storagev1.StorageClass, error)
- func IsDataSourcePVC(kind string) bool
- func IsDataSourceSnapshot(kind string) bool
- func IsSourceClaimReady(ctx context.Context, args *IsSourceClaimReadyArgs) (bool, error)
- func SameVolumeMode(pvc1 *corev1.PersistentVolumeClaim, others ...*corev1.PersistentVolumeClaim) bool
- type CSIClonePhase
- type ChooseStrategyArgs
- type ChooseStrategyResult
- type HostClonePhase
- type IsSourceClaimReadyArgs
- type Phase
- type PhaseStatus
- type PlanArgs
- type Planner
- func (p *Planner) AddCoreWatches(log logr.Logger) error
- func (p *Planner) ChooseStrategy(ctx context.Context, args *ChooseStrategyArgs) (*ChooseStrategyResult, error)
- func (p *Planner) Cleanup(ctx context.Context, log logr.Logger, owner client.Object) error
- func (p *Planner) Plan(ctx context.Context, args *PlanArgs) ([]Phase, error)
- type PrepClaimPhase
- type RebindPhase
- type SnapshotClonePhase
- type SnapshotPhase
- type StatusReporter
Constants ¶
const ( // PendingPhaseName is the phase when the clone is pending PendingPhaseName = "Pending" // SucceededPhaseName is the phase when the clone is succeeded SucceededPhaseName = "Succeeded" // ErrorPhaseName is the phase when the clone is in error ErrorPhaseName = "Error" )
const ( // CloneValidationFailed reports that a clone wasn't admitted by our validation mechanism (reason) CloneValidationFailed = "CloneValidationFailed" // MessageCloneValidationFailed reports that a clone wasn't admitted by our validation mechanism (message) MessageCloneValidationFailed = "The clone doesn't meet the validation requirements" // CloneWithoutSource reports that the source of a clone doesn't exists (reason) CloneWithoutSource = "CloneWithoutSource" // MessageCloneWithoutSource reports that the source of a clone doesn't exists (message) MessageCloneWithoutSource = "The source %s %s doesn't exist" // NoVolumeSnapshotClass reports that no compatible volumesnapshotclass was found (reason) NoVolumeSnapshotClass = "NoVolumeSnapshotClass" // MessageNoVolumeSnapshotClass reports that no compatible volumesnapshotclass was found (message) MessageNoVolumeSnapshotClass = "No compatible volumesnapshotclass found" // IncompatibleVolumeModes reports that the volume modes of source and target are incompatible (reason) IncompatibleVolumeModes = "IncompatibleVolumeModes" // MessageIncompatibleVolumeModes reports that the volume modes of source and target are incompatible (message) MessageIncompatibleVolumeModes = "The volume modes of source and target are incompatible" // NoVolumeExpansion reports that no volume expansion is possible (reason) NoVolumeExpansion = "NoVolumeExpansion" // MessageNoVolumeExpansion reports that no volume expansion is possible (message) MessageNoVolumeExpansion = "No volume expansion is possible" // NoProvisionerMatch reports that the storageclass provisioner does not match the volumesnapshotcontent driver (reason) NoProvisionerMatch = "NoProvisionerMatch" // MessageNoProvisionerMatch reports that the storageclass provisioner does not match the volumesnapshotcontent driver (message) MessageNoProvisionerMatch = "The storageclass provisioner does not match the volumesnapshotcontent driver" // IncompatibleProvisioners reports that the provisioners are incompatible (reason) IncompatibleProvisioners = "IncompatibleProvisioners" // MessageIncompatibleProvisioners reports that the provisioners are incompatible (message) MessageIncompatibleProvisioners = "Provisioners are incompatible" )
const CSIClonePhaseName = "CSIClone"
CSIClonePhaseName is the name of the csi clone phase
const HostClonePhaseName = "HostClone"
HostClonePhaseName is the name of the host clone phase
const PrepClaimPhaseName = "PrepClaim"
PrepClaimPhaseName is the name of the prep claim phase
const RebindPhaseName = "Rebind"
RebindPhaseName is the name of the rebind phase
const SnapshotClonePhaseName = "SnapshotClone"
SnapshotClonePhaseName is the name of the snapshot clone phase
const SnapshotPhaseName = "Snapshot"
SnapshotPhaseName is the name of the snapshot phase
Variables ¶
This section is empty.
Functions ¶
func AddCommonClaimLabels ¶
func AddCommonClaimLabels(pvc *corev1.PersistentVolumeClaim)
AddCommonClaimLabels adds common labels to a pvc
func AddCommonLabels ¶
AddCommonLabels adds common labels to a resource
func AddOwnershipLabel ¶
AddOwnershipLabel adds owner label
func GetCommonDriver ¶
func GetCommonDriver(ctx context.Context, c client.Client, pvcs ...*corev1.PersistentVolumeClaim) (*string, error)
GetCommonDriver returns the name of the CSI driver shared by all PVCs
func GetCompatibleVolumeSnapshotClass ¶
func GetCompatibleVolumeSnapshotClass(ctx context.Context, c client.Client, log logr.Logger, recorder record.EventRecorder, pvcs ...*corev1.PersistentVolumeClaim) (*string, error)
GetCompatibleVolumeSnapshotClass returns a VolumeSnapshotClass name that works for all PVCs Note the last PVC passed is considered the target PVC for logs and events
func GetDriverFromVolume ¶
func GetDriverFromVolume(ctx context.Context, c client.Client, pvc *corev1.PersistentVolumeClaim) (*string, error)
GetDriverFromVolume returns the CSI driver name for a PVC
func GetGlobalCloneStrategyOverride ¶
func GetGlobalCloneStrategyOverride(ctx context.Context, c client.Client) (*cdiv1.CDICloneStrategy, error)
GetGlobalCloneStrategyOverride returns the global clone strategy override
func GetStorageClassForClaim ¶
func GetStorageClassForClaim(ctx context.Context, c client.Client, pvc *corev1.PersistentVolumeClaim) (*storagev1.StorageClass, error)
GetStorageClassForClaim returns the storageclass for a PVC
func IsDataSourcePVC ¶
IsDataSourcePVC checks for PersistentVolumeClaim source kind
func IsDataSourceSnapshot ¶
IsDataSourceSnapshot checks for Snapshot source kind
func IsSourceClaimReady ¶
func IsSourceClaimReady(ctx context.Context, args *IsSourceClaimReadyArgs) (bool, error)
IsSourceClaimReady checks that PVC exists, is bound, and is not being used
func SameVolumeMode ¶
func SameVolumeMode(pvc1 *corev1.PersistentVolumeClaim, others ...*corev1.PersistentVolumeClaim) bool
SameVolumeMode returns true if all pvcs have the same volume mode
Types ¶
type CSIClonePhase ¶
type CSIClonePhase struct { Owner client.Object Namespace string SourceName string DesiredClaim *corev1.PersistentVolumeClaim OwnershipLabel string Client client.Client Log logr.Logger Recorder record.EventRecorder }
CSIClonePhase is responsible for csi cloning a pvc
func (*CSIClonePhase) Name ¶
func (p *CSIClonePhase) Name() string
Name returns the name of the phase
type ChooseStrategyArgs ¶
type ChooseStrategyArgs struct { Log logr.Logger TargetClaim *corev1.PersistentVolumeClaim DataSource *cdiv1.VolumeCloneSource }
ChooseStrategyArgs are args for ChooseStrategy function
type ChooseStrategyResult ¶
type ChooseStrategyResult struct { Strategy cdiv1.CDICloneStrategy FallbackReason *string }
ChooseStrategyResult is result returned by ChooseStrategy function
type HostClonePhase ¶
type HostClonePhase struct { Owner client.Object Namespace string SourceName string DesiredClaim *corev1.PersistentVolumeClaim ImmediateBind bool OwnershipLabel string Preallocation bool PriorityClassName string Client client.Client Log logr.Logger Recorder record.EventRecorder }
HostClonePhase creates and monitors a dumb clone operation
func (*HostClonePhase) Name ¶
func (p *HostClonePhase) Name() string
Name returns the name of the phase
func (*HostClonePhase) Reconcile ¶
Reconcile creates the desired pvc and waits for the operation to complete
func (*HostClonePhase) Status ¶
func (p *HostClonePhase) Status(ctx context.Context) (*PhaseStatus, error)
Status returns the phase status
type IsSourceClaimReadyArgs ¶
type IsSourceClaimReadyArgs struct { Target client.Object SourceNamespace string SourceName string Client client.Client Log logr.Logger Recorder record.EventRecorder }
IsSourceClaimReadyArgs are arguments for IsSourceClaimReady
type PhaseStatus ¶
PhaseStatus contains phase status data
type PlanArgs ¶
type PlanArgs struct { Log logr.Logger TargetClaim *corev1.PersistentVolumeClaim DataSource *cdiv1.VolumeCloneSource Strategy cdiv1.CDICloneStrategy }
PlanArgs are args to plan clone op for populator
type Planner ¶
type Planner struct { RootObjectType client.ObjectList OwnershipLabel string UIDField string Image string PullPolicy corev1.PullPolicy InstallerLabels map[string]string Client client.Client Recorder record.EventRecorder Controller controller.Controller GetCache func() cache.Cache // contains filtered or unexported fields }
Planner plans clone operations
func (*Planner) AddCoreWatches ¶
AddCoreWatches watches "core" types
func (*Planner) ChooseStrategy ¶
func (p *Planner) ChooseStrategy(ctx context.Context, args *ChooseStrategyArgs) (*ChooseStrategyResult, error)
ChooseStrategy picks the strategy for a clone op
type PrepClaimPhase ¶
type PrepClaimPhase struct { Owner client.Object DesiredClaim *corev1.PersistentVolumeClaim Image string PullPolicy corev1.PullPolicy InstallerLabels map[string]string OwnershipLabel string Client client.Client Log logr.Logger Recorder record.EventRecorder }
PrepClaimPhase is responsible for prepping a PVC for rebind
func (*PrepClaimPhase) Name ¶
func (p *PrepClaimPhase) Name() string
Name returns the name of the phase
type RebindPhase ¶
type RebindPhase struct { SourceNamespace string SourceName string TargetNamespace string TargetName string Client client.Client Log logr.Logger Recorder record.EventRecorder }
RebindPhase binds a PV from one PVC to another
type SnapshotClonePhase ¶
type SnapshotClonePhase struct { Owner client.Object Namespace string SourceName string DesiredClaim *corev1.PersistentVolumeClaim OwnershipLabel string Client client.Client Log logr.Logger Recorder record.EventRecorder }
SnapshotClonePhase waits for a snapshot to be ready and creates a PVC from it
func (*SnapshotClonePhase) Name ¶
func (p *SnapshotClonePhase) Name() string
Name returns the name of the phase
type SnapshotPhase ¶
type SnapshotPhase struct { Owner client.Object SourceNamespace string SourceName string TargetName string VolumeSnapshotClass string OwnershipLabel string Client client.Client Log logr.Logger Recorder record.EventRecorder }
SnapshotPhase snapshots a PVC
func (*SnapshotPhase) Name ¶
func (p *SnapshotPhase) Name() string
Name returns the name of the phase
type StatusReporter ¶
type StatusReporter interface {
Status(context.Context) (*PhaseStatus, error)
}
StatusReporter allows a phase to report status