drvolume

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: 13 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

View Source
const (
	LabelManagedBy      = "app.kubernetes.io/managed-by"
	LabelManagedByValue = "backup-tool"
	LabelDomain         = "backup-tool.home.arpa"
	LabelBackupName     = LabelDomain + "/backup-name"
	LabelDRType         = LabelDomain + "/dr-type"
)

Tool-owned labels set on the DR PVC and on every backup snapshot of it, so that downstream consumers (e.g. tape-archiver) can select them with a label selector. Important: these are a contract with external consumers. Changing them breaks existing selectors!

Variables

This section is empty.

Functions

func ToolOwnedLabels added in v0.0.21

func ToolOwnedLabels(backupName, drType string) map[string]string

ToolOwnedLabels returns the labels that identify the DR PVC and backup snapshots of a backup.

func ValidateBackupLabels added in v0.0.21

func ValidateBackupLabels(backupName, drType string, snapshotLabels map[string]string) error

ValidateBackupLabels checks everything that ends up in the DR PVC and backup snapshot labels, so that a bad value is caught before any resources are created.

func ValidateSnapshotLabels added in v0.0.21

func ValidateSnapshotLabels(labels map[string]string) error

ValidateSnapshotLabels checks user-supplied backup snapshot labels. Keys and values must be valid Kubernetes labels, and keys may not collide with the tool-owned labels.

Types

type DRVolume

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

func (*DRVolume) SnapshotAndWaitReady

func (drv *DRVolume) SnapshotAndWaitReady(ctx *contexts.Context, snapshotName string, opts DRVolumeSnapshotAndWaitOptions) error

type DRVolumeCreateOptions

type DRVolumeCreateOptions struct {
	VolumeStorageClass string   `yaml:"volumeStorageClass,omitempty"`
	CNPGClusterNames   []string `yaml:"cnpgClusterNames,omitempty"`
	// SnapshotLabels are added to every backup snapshot of the DR volume, in addition to the tool-owned
	// and common labels. Tool-owned label keys are reserved.
	SnapshotLabels map[string]string `yaml:"snapshotLabels,omitempty"`
}

type DRVolumeInterface

type DRVolumeInterface interface {
	SnapshotAndWaitReady(ctx *contexts.Context, snapshotName string, opts DRVolumeSnapshotAndWaitOptions) error
	// contains filtered or unexported methods
}

type DRVolumeSnapshotAndWaitOptions

type DRVolumeSnapshotAndWaitOptions struct {
	ReadyTimeout  helpers.MaxWaitTime `yaml:"snapshotReadyTimeout,omitempty"`
	SnapshotClass string              `yaml:"snapshotClass,omitempty"`
}

type MockDRVolumeInterface

type MockDRVolumeInterface struct {
	mock.Mock
}

MockDRVolumeInterface is an autogenerated mock type for the DRVolumeInterface type

func NewMockDRVolumeInterface

func NewMockDRVolumeInterface(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockDRVolumeInterface

NewMockDRVolumeInterface creates a new instance of MockDRVolumeInterface. 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 (*MockDRVolumeInterface) EXPECT

func (*MockDRVolumeInterface) SnapshotAndWaitReady

func (_m *MockDRVolumeInterface) SnapshotAndWaitReady(ctx *contexts.Context, snapshotName string, opts DRVolumeSnapshotAndWaitOptions) error

SnapshotAndWaitReady provides a mock function with given fields: ctx, snapshotName, opts

type MockDRVolumeInterface_Expecter

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

func (*MockDRVolumeInterface_Expecter) SnapshotAndWaitReady

func (_e *MockDRVolumeInterface_Expecter) SnapshotAndWaitReady(ctx interface{}, snapshotName interface{}, opts interface{}) *MockDRVolumeInterface_SnapshotAndWaitReady_Call

SnapshotAndWaitReady is a helper method to define mock.On call

  • ctx *contexts.Context
  • snapshotName string
  • opts DRVolumeSnapshotAndWaitOptions

type MockDRVolumeInterface_SnapshotAndWaitReady_Call

type MockDRVolumeInterface_SnapshotAndWaitReady_Call struct {
	*mock.Call
}

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

func (*MockDRVolumeInterface_SnapshotAndWaitReady_Call) Return

func (*MockDRVolumeInterface_SnapshotAndWaitReady_Call) Run

type MockDRVolumeInterface_setPVC_Call

type MockDRVolumeInterface_setPVC_Call struct {
	*mock.Call
}

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

func (*MockDRVolumeInterface_setPVC_Call) Return

func (*MockDRVolumeInterface_setPVC_Call) Run

func (*MockDRVolumeInterface_setPVC_Call) RunAndReturn

type MockDRVolumeInterface_setSnapshotLabels_Call added in v0.0.21

type MockDRVolumeInterface_setSnapshotLabels_Call struct {
	*mock.Call
}

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

func (*MockDRVolumeInterface_setSnapshotLabels_Call) Return added in v0.0.21

func (*MockDRVolumeInterface_setSnapshotLabels_Call) Run added in v0.0.21

func (*MockDRVolumeInterface_setSnapshotLabels_Call) RunAndReturn added in v0.0.21

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) EXPECT

func (*MockProviderInterface) NewDRVolume

func (_m *MockProviderInterface) NewDRVolume(ctx *contexts.Context, namespace string, name string, drType string, configuredSize resource.Quantity, opts DRVolumeCreateOptions) (DRVolumeInterface, error)

NewDRVolume provides a mock function with given fields: ctx, namespace, name, drType, configuredSize, opts

type MockProviderInterface_Expecter

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

func (*MockProviderInterface_Expecter) NewDRVolume

func (_e *MockProviderInterface_Expecter) NewDRVolume(ctx interface{}, namespace interface{}, name interface{}, drType interface{}, configuredSize interface{}, opts interface{}) *MockProviderInterface_NewDRVolume_Call

NewDRVolume is a helper method to define mock.On call

  • ctx *contexts.Context
  • namespace string
  • name string
  • drType string
  • configuredSize resource.Quantity
  • opts DRVolumeCreateOptions

type MockProviderInterface_NewDRVolume_Call

type MockProviderInterface_NewDRVolume_Call struct {
	*mock.Call
}

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

func (*MockProviderInterface_NewDRVolume_Call) Return

func (*MockProviderInterface_NewDRVolume_Call) Run

type Provider

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

func NewProvider

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

func (*Provider) NewDRVolume

func (p *Provider) NewDRVolume(ctx *contexts.Context, namespace, name, drType string, configuredSize resource.Quantity, opts DRVolumeCreateOptions) (DRVolumeInterface, error)

TODO handle expansion? The DR volume and its backup snapshots are labeled with the tool-owned labels (identifying the backup name and DR type) and the client's common labels. Backup snapshots also get opts.SnapshotLabels.

type ProviderInterface

type ProviderInterface interface {
	NewDRVolume(ctx *contexts.Context, namespace, name, drType string, configuredSize resource.Quantity, opts DRVolumeCreateOptions) (DRVolumeInterface, error)
}

Jump to

Keyboard shortcuts

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