volume

package
v0.113.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// NoPVCNameSpecified is used by the caller to indicate that the PVC name
	// should be auto-generated
	NoPVCNameSpecified = ""

	RegionZoneSeparator = "__"
)

Variables

This section is empty.

Functions

func CreatePV

func CreatePV(
	ctx context.Context,
	kubeCli kubernetes.Interface,
	vol *blockstorage.Volume,
	volType blockstorage.Type,
	annotations map[string]string,
	accessmodes []corev1.PersistentVolumeAccessMode,
	volumemode *corev1.PersistentVolumeMode,
) (string, error)

CreatePV creates a PersistentVolume and returns its name For retry idempotency, checks whether PV associated with volume already exists

func CreatePVC

func CreatePVC(
	ctx context.Context,
	kubeCli kubernetes.Interface,
	ns,
	name string,
	sizeInBytes int64,
	targetVolID string,
	annotations map[string]string,
	accessmodes []corev1.PersistentVolumeAccessMode,
	volumemode *corev1.PersistentVolumeMode,
) (string, error)

CreatePVC creates a PersistentVolumeClaim and returns its name An empty 'targetVolID' indicates the caller would like the PV to be dynamically provisioned An empty 'name' indicates the caller would like the name to be auto-generated An error indicating that the PVC already exists is ignored (for idempotency)

func CreatePVCFromSnapshot

func CreatePVCFromSnapshot(ctx context.Context, args *CreatePVCFromSnapshotArgs) (string, error)

CreatePVCFromSnapshot will restore a volume and returns the resulting PersistentVolumeClaim and any error that happened in the process.

func DeletePVC

func DeletePVC(cli kubernetes.Interface, namespace, pvcName string) error

DeletePVC deletes the given PVC immediately and waits with timeout until it is returned as deleted

Types

type CreatePVCFromSnapshotArgs

type CreatePVCFromSnapshotArgs struct {
	KubeCli          kubernetes.Interface
	DynCli           dynamic.Interface
	Namespace        string
	VolumeName       string
	StorageClassName string
	SnapshotName     string
	RestoreSize      string
	Labels           map[string]string
	Annotations      map[string]string
	VolumeMode       *corev1.PersistentVolumeMode
	AccessModes      []corev1.PersistentVolumeAccessMode
	GroupVersion     schema.GroupVersion
}

CreatePVCFromSnapshotArgs describes the arguments for CreatePVCFromSnapshot 'VolumeName' is the name of the PVC that will be restored from the snapshot. 'StorageClassName' is the name of the storage class used to create the PVC. 'SnapshotName' is the name of the VolumeSnapshot that will be used for restoring. 'Namespace' is the namespace of the VolumeSnapshot. The PVC will be restored to the same namepsace. 'RestoreSize' will override existing restore size from snapshot content if provided. 'Labels' will be added to the PVC. 'Annotations' will be added to the PVC.

Jump to

Keyboard shortcuts

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