volumehelper

package
v1.18.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewVolumeHelperWithCache

func NewVolumeHelperWithCache(
	backup velerov1api.Backup,
	client crclient.Client,
	logger logrus.FieldLogger,
	pvcPodCache *podvolumeutil.PVCPodCache,
) (vhutil.VolumeHelper, error)

NewVolumeHelperWithCache creates a VolumeHelper using an externally managed PVC-to-Pod cache. This is used by plugins that build the cache lazily per-namespace (following the pattern from PR #9226). The cache can be nil, in which case PVC-to-Pod lookups will fall back to direct API calls.

func NewVolumeHelperWithNamespaces

func NewVolumeHelperWithNamespaces(
	volumePolicy *resourcepolicies.Policies,
	snapshotVolumes *bool,
	logger logrus.FieldLogger,
	client crclient.Client,
	defaultVolumesToFSBackup bool,
	backupExcludePVC bool,
	namespaces []string,
) (vhutil.VolumeHelper, error)

NewVolumeHelperWithNamespaces creates a VolumeHelper with a PVC-to-Pod cache for improved performance. The cache is built internally from the provided namespaces list. This avoids O(N*M) complexity when there are many PVCs and pods. See issue #9179 for details. Returns an error if cache building fails - callers should not proceed with backup in this case.

func ShouldPerformSnapshotWithBackup deprecated

func ShouldPerformSnapshotWithBackup(
	unstructured runtime.Unstructured,
	groupResource schema.GroupResource,
	backup velerov1api.Backup,
	crClient crclient.Client,
	logger logrus.FieldLogger,
) (bool, error)

ShouldPerformSnapshotWithBackup is used for third-party plugins. It supports to check whether the PVC or PodVolume should be backed up on demand. On the other hand, the volumeHelperImpl assume there is a VolumeHelper instance initialized before calling the ShouldPerformXXX functions.

Deprecated: Use ShouldPerformSnapshotWithVolumeHelper instead for better performance. ShouldPerformSnapshotWithVolumeHelper allows passing a pre-created VolumeHelper with an internal PVC-to-Pod cache, which avoids O(N*M) complexity when there are many PVCs and pods. See issue #9179 for details.

func ShouldPerformSnapshotWithVolumeHelper added in v1.18.0

func ShouldPerformSnapshotWithVolumeHelper(
	unstructured runtime.Unstructured,
	groupResource schema.GroupResource,
	backup velerov1api.Backup,
	crClient crclient.Client,
	logger logrus.FieldLogger,
	vh vhutil.VolumeHelper,
) (bool, error)

ShouldPerformSnapshotWithVolumeHelper is like ShouldPerformSnapshotWithBackup but accepts an optional VolumeHelper. If vh is non-nil, it will be used directly, avoiding the overhead of creating a new VolumeHelper on each call. This is useful for BIA plugins that process multiple PVCs during a single backup and want to reuse the same VolumeHelper (with its internal cache) across calls.

Types

This section is empty.

Jump to

Keyboard shortcuts

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