exposer

package
v1.13.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessModeFileSystem = "by-file-system"
	AccessModeBlock      = "by-block-device"
)

Variables

This section is empty.

Functions

func GetPodVolumeHostPath

func GetPodVolumeHostPath(ctx context.Context, pod *corev1.Pod, volumeName string,
	cli ctrlclient.Client, fs filesystem.Interface, log logrus.FieldLogger) (datapath.AccessPoint, error)

GetPodVolumeHostPath returns a path that can be accessed from the host for a given volume of a pod

Types

type CSISnapshotExposeParam

type CSISnapshotExposeParam struct {
	// SnapshotName is the original volume snapshot name
	SnapshotName string

	// SourceNamespace is the original namespace of the volume that the snapshot is taken for
	SourceNamespace string

	// AccessMode defines the mode to access the snapshot
	AccessMode string

	// StorageClass is the storage class of the volume that the snapshot is taken for
	StorageClass string

	// HostingPodLabels is the labels that are going to apply to the hosting pod
	HostingPodLabels map[string]string

	// OperationTimeout specifies the time wait for resources operations in Expose
	OperationTimeout time.Duration

	// ExposeTimeout specifies the timeout for the entire expose process
	ExposeTimeout time.Duration

	// VolumeSize specifies the size of the source volume
	VolumeSize resource.Quantity
}

CSISnapshotExposeParam define the input param for Expose of CSI snapshots

type CSISnapshotExposeWaitParam

type CSISnapshotExposeWaitParam struct {
	// NodeClient is the client that is used to find the hosting pod
	NodeClient client.Client
	NodeName   string
}

CSISnapshotExposeWaitParam define the input param for WaitExposed of CSI snapshots

type ExposeByPod

type ExposeByPod struct {
	HostingPod *corev1.Pod
	VolumeName string
}

ExposeByPod defines the result for the expose method that a hosting pod is created

type ExposeResult

type ExposeResult struct {
	ByPod ExposeByPod
}

ExposeResult defines the result of expose. Varying from the type of the expose, the result may be different.

type GenericRestoreExposer

type GenericRestoreExposer interface {
	// Expose starts the process to a restore expose, the expose process may take long time
	Expose(context.Context, corev1.ObjectReference, string, string, map[string]string, time.Duration) error

	// GetExposed polls the status of the expose.
	// If the expose is accessible by the current caller, it waits the expose ready and returns the expose result.
	// Otherwise, it returns nil as the expose result without an error.
	GetExposed(context.Context, corev1.ObjectReference, client.Client, string, time.Duration) (*ExposeResult, error)

	// RebindVolume unexposes the restored PV and rebind it to the target PVC
	RebindVolume(context.Context, corev1.ObjectReference, string, string, time.Duration) error

	// CleanUp cleans up any objects generated during the restore expose
	CleanUp(context.Context, corev1.ObjectReference)
}

GenericRestoreExposer is the interfaces for a generic restore exposer

func NewGenericRestoreExposer

func NewGenericRestoreExposer(kubeClient kubernetes.Interface, log logrus.FieldLogger) GenericRestoreExposer

NewGenericRestoreExposer creates a new instance of generic restore exposer

type SnapshotExposer

type SnapshotExposer interface {
	// Expose starts the process to expose a snapshot, the expose process may take long time
	Expose(context.Context, corev1.ObjectReference, interface{}) error
	// GetExposed polls the status of the expose.
	// If the expose is accessible by the current caller, it waits the expose ready and returns the expose result.
	// Otherwise, it returns nil as the expose result without an error.
	GetExposed(context.Context, corev1.ObjectReference, time.Duration, interface{}) (*ExposeResult, error)

	// CleanUp cleans up any objects generated during the snapshot expose
	CleanUp(context.Context, corev1.ObjectReference, string, string)
}

SnapshotExposer is the interfaces for a snapshot exposer

func NewCSISnapshotExposer

func NewCSISnapshotExposer(kubeClient kubernetes.Interface, csiSnapshotClient snapshotter.SnapshotV1Interface, log logrus.FieldLogger) SnapshotExposer

NewCSISnapshotExposer create a new instance of CSI snapshot exposer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL