clonepvc

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: AGPL-3.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClonePVCGroupOptions added in v0.0.15

type ClonePVCGroupOptions struct {
	GroupSnapshotName      string // Override the name of the created VolumeGroupSnapshot. Defaults to a generated name when empty.
	SnapshotClass          string // Override the VolumeGroupSnapshotClass used to snapshot the source volumes. Defaults to the cluster default when empty.
	WaitForSnapshotTimeout helpers.MaxWaitTime
	DestStorageClassName   string // Override the storage class used for the created volumes. Must be compatible with the snapshots.
	ForceBind              bool   // Force the cloned PVCs to be bound immediately. This should be set if the storage class does not have `volumeBindingMode: Immediate` set, because the member snapshots are deleted when the group snapshot is deleted.
	ForceBindTimeout       helpers.MaxWaitTime
	CleanupTimeout         helpers.MaxWaitTime
}

type ClonePVCGroupResult added in v0.0.15

type ClonePVCGroupResult struct {
	// GroupSnapshot is the created VolumeGroupSnapshot. The caller owns its lifecycle on success
	// (its creation time is the consistency point, and it must be deleted once the clones are no
	// longer needed - deleting it deletes the member snapshots).
	GroupSnapshot *volumegroupsnapshotv1.VolumeGroupSnapshot
	// ClonedPVCs maps each source PVC name to the PVC cloned from that member's snapshot.
	ClonedPVCs map[string]*corev1.PersistentVolumeClaim
}

type ClonePVCOptions

type ClonePVCOptions struct {
	WaitForSnapshotTimeout helpers.MaxWaitTime
	SnapshotClass          string // Override the VolumeSnapshotClass used to snapshot the source volume. Defaults to the cluster default when empty.
	DestStorageClassName   string // Override the storage class used for the created volume. Must be compatible with the snapshot.
	DestPvcNamePrefix      string // Override the prefix used for the created volume name
	ForceBind              bool   // Force the PVC to be bound immediately. This should be set if the storage class does not have `volumeBindingMode: Immediate` set, because the snapshot will be deleted after the PVC is created.
	ForceBindTimeout       helpers.MaxWaitTime
	CleanupTimeout         helpers.MaxWaitTime
}

type MockProviderInterface

type MockProviderInterface struct {
	mock.Mock
}

MockProviderInterface is an autogenerated mock type for the ProviderInterface type

func NewMockProviderInterface

func NewMockProviderInterface(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockProviderInterface

NewMockProviderInterface creates a new instance of MockProviderInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockProviderInterface) ClonePVC

func (_m *MockProviderInterface) ClonePVC(ctx *contexts.Context, namespace string, pvcName string, opts ClonePVCOptions) (*v1.PersistentVolumeClaim, error)

ClonePVC provides a mock function with given fields: ctx, namespace, pvcName, opts

func (*MockProviderInterface) ClonePVCGroup added in v0.0.15

func (_m *MockProviderInterface) ClonePVCGroup(ctx *contexts.Context, namespace string, selector metav1.LabelSelector, opts ClonePVCGroupOptions) (*ClonePVCGroupResult, error)

ClonePVCGroup provides a mock function with given fields: ctx, namespace, selector, opts

func (*MockProviderInterface) EXPECT

type MockProviderInterface_ClonePVCGroup_Call added in v0.0.15

type MockProviderInterface_ClonePVCGroup_Call struct {
	*mock.Call
}

MockProviderInterface_ClonePVCGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClonePVCGroup'

func (*MockProviderInterface_ClonePVCGroup_Call) Return added in v0.0.15

func (*MockProviderInterface_ClonePVCGroup_Call) Run added in v0.0.15

func (*MockProviderInterface_ClonePVCGroup_Call) RunAndReturn added in v0.0.15

type MockProviderInterface_ClonePVC_Call

type MockProviderInterface_ClonePVC_Call struct {
	*mock.Call
}

MockProviderInterface_ClonePVC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClonePVC'

func (*MockProviderInterface_ClonePVC_Call) Return

func (*MockProviderInterface_ClonePVC_Call) Run

type MockProviderInterface_Expecter

type MockProviderInterface_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockProviderInterface_Expecter) ClonePVC

func (_e *MockProviderInterface_Expecter) ClonePVC(ctx interface{}, namespace interface{}, pvcName interface{}, opts interface{}) *MockProviderInterface_ClonePVC_Call

ClonePVC is a helper method to define mock.On call

  • ctx *contexts.Context
  • namespace string
  • pvcName string
  • opts ClonePVCOptions

func (*MockProviderInterface_Expecter) ClonePVCGroup added in v0.0.15

func (_e *MockProviderInterface_Expecter) ClonePVCGroup(ctx interface{}, namespace interface{}, selector interface{}, opts interface{}) *MockProviderInterface_ClonePVCGroup_Call

ClonePVCGroup is a helper method to define mock.On call

  • ctx *contexts.Context
  • namespace string
  • selector metav1.LabelSelector
  • opts ClonePVCGroupOptions

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(coreClient core.ClientInterface, esClient externalsnapshotter.ClientInterface) *Provider

func (*Provider) ClonePVC

func (p *Provider) ClonePVC(ctx *contexts.Context, namespace, pvcName string, opts ClonePVCOptions) (clonedPvc *corev1.PersistentVolumeClaim, err error)

Snapshots a given volume and clones it. Callers are responsible for ensuring consistency.

func (*Provider) ClonePVCGroup added in v0.0.15

func (p *Provider) ClonePVCGroup(ctx *contexts.Context, namespace string, selector metav1.LabelSelector, opts ClonePVCGroupOptions) (result *ClonePVCGroupResult, err error)

ClonePVCGroup atomically snapshots a label-selected group of volumes via a VolumeGroupSnapshot and clones each member into a new PVC. Callers are responsible for ensuring consistency of the source volumes. It is the group analog of ClonePVC and shares the same per-snapshot create-and-force-bind machinery.

On success the created VolumeGroupSnapshot is returned (not deleted) so the caller can pin its creation instant and clean it up later; deleting it deletes the member snapshots, so ForceBind should be set unless the destination storage class binds immediately. On error everything created is cleaned up.

type ProviderInterface

type ProviderInterface interface {
	ClonePVC(ctx *contexts.Context, namespace, pvcName string, opts ClonePVCOptions) (clonedPvc *corev1.PersistentVolumeClaim, err error)
	ClonePVCGroup(ctx *contexts.Context, namespace string, selector metav1.LabelSelector, opts ClonePVCGroupOptions) (result *ClonePVCGroupResult, err error)
}

ProviderInterface clones PVCs from CSI snapshots. ClonePVC clones a single volume (via an individual VolumeSnapshot); ClonePVCGroup clones a label-selected set atomically (via a VolumeGroupSnapshot). Both share the same dependencies and the same per-snapshot create-and-force-bind machinery, so they live on one provider.

Jump to

Keyboard shortcuts

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