Documentation
¶
Index ¶
- Constants
- func ToolOwnedLabels(backupName, drType string) map[string]string
- func ValidateBackupLabels(backupName, drType string, snapshotLabels map[string]string) error
- func ValidateSnapshotLabels(labels map[string]string) error
- type DRVolume
- type DRVolumeCreateOptions
- type DRVolumeInterface
- type DRVolumeSnapshotAndWaitOptions
- type MockDRVolumeInterface
- type MockDRVolumeInterface_Expecter
- type MockDRVolumeInterface_SnapshotAndWaitReady_Call
- func (_c *MockDRVolumeInterface_SnapshotAndWaitReady_Call) Return(_a0 error) *MockDRVolumeInterface_SnapshotAndWaitReady_Call
- func (_c *MockDRVolumeInterface_SnapshotAndWaitReady_Call) Run(run func(ctx *contexts.Context, snapshotName string, ...)) *MockDRVolumeInterface_SnapshotAndWaitReady_Call
- func (_c *MockDRVolumeInterface_SnapshotAndWaitReady_Call) RunAndReturn(run func(*contexts.Context, string, DRVolumeSnapshotAndWaitOptions) error) *MockDRVolumeInterface_SnapshotAndWaitReady_Call
- type MockDRVolumeInterface_setPVC_Call
- func (_c *MockDRVolumeInterface_setPVC_Call) Return() *MockDRVolumeInterface_setPVC_Call
- func (_c *MockDRVolumeInterface_setPVC_Call) Run(run func(pvc *v1.PersistentVolumeClaim)) *MockDRVolumeInterface_setPVC_Call
- func (_c *MockDRVolumeInterface_setPVC_Call) RunAndReturn(run func(*v1.PersistentVolumeClaim)) *MockDRVolumeInterface_setPVC_Call
- type MockDRVolumeInterface_setSnapshotLabels_Call
- func (_c *MockDRVolumeInterface_setSnapshotLabels_Call) Return() *MockDRVolumeInterface_setSnapshotLabels_Call
- func (_c *MockDRVolumeInterface_setSnapshotLabels_Call) Run(run func(labels map[string]string)) *MockDRVolumeInterface_setSnapshotLabels_Call
- func (_c *MockDRVolumeInterface_setSnapshotLabels_Call) RunAndReturn(run func(map[string]string)) *MockDRVolumeInterface_setSnapshotLabels_Call
- type MockProviderInterface
- type MockProviderInterface_Expecter
- type MockProviderInterface_NewDRVolume_Call
- func (_c *MockProviderInterface_NewDRVolume_Call) Return(_a0 DRVolumeInterface, _a1 error) *MockProviderInterface_NewDRVolume_Call
- func (_c *MockProviderInterface_NewDRVolume_Call) Run(...) *MockProviderInterface_NewDRVolume_Call
- func (_c *MockProviderInterface_NewDRVolume_Call) RunAndReturn(...) *MockProviderInterface_NewDRVolume_Call
- type Provider
- type ProviderInterface
Constants ¶
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
ToolOwnedLabels returns the labels that identify the DR PVC and backup snapshots of a backup.
func ValidateBackupLabels ¶ added in v0.0.21
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
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 ¶
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 ¶
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 (_m *MockDRVolumeInterface) EXPECT() *MockDRVolumeInterface_Expecter
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 ¶
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 (_c *MockDRVolumeInterface_SnapshotAndWaitReady_Call) Return(_a0 error) *MockDRVolumeInterface_SnapshotAndWaitReady_Call
func (*MockDRVolumeInterface_SnapshotAndWaitReady_Call) Run ¶
func (_c *MockDRVolumeInterface_SnapshotAndWaitReady_Call) Run(run func(ctx *contexts.Context, snapshotName string, opts DRVolumeSnapshotAndWaitOptions)) *MockDRVolumeInterface_SnapshotAndWaitReady_Call
func (*MockDRVolumeInterface_SnapshotAndWaitReady_Call) RunAndReturn ¶
func (_c *MockDRVolumeInterface_SnapshotAndWaitReady_Call) RunAndReturn(run func(*contexts.Context, string, DRVolumeSnapshotAndWaitOptions) error) *MockDRVolumeInterface_SnapshotAndWaitReady_Call
type MockDRVolumeInterface_setPVC_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 (_c *MockDRVolumeInterface_setPVC_Call) Return() *MockDRVolumeInterface_setPVC_Call
func (*MockDRVolumeInterface_setPVC_Call) Run ¶
func (_c *MockDRVolumeInterface_setPVC_Call) Run(run func(pvc *v1.PersistentVolumeClaim)) *MockDRVolumeInterface_setPVC_Call
func (*MockDRVolumeInterface_setPVC_Call) RunAndReturn ¶
func (_c *MockDRVolumeInterface_setPVC_Call) RunAndReturn(run func(*v1.PersistentVolumeClaim)) *MockDRVolumeInterface_setPVC_Call
type MockDRVolumeInterface_setSnapshotLabels_Call ¶ added in v0.0.21
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 (_c *MockDRVolumeInterface_setSnapshotLabels_Call) Return() *MockDRVolumeInterface_setSnapshotLabels_Call
func (*MockDRVolumeInterface_setSnapshotLabels_Call) Run ¶ added in v0.0.21
func (_c *MockDRVolumeInterface_setSnapshotLabels_Call) Run(run func(labels map[string]string)) *MockDRVolumeInterface_setSnapshotLabels_Call
func (*MockDRVolumeInterface_setSnapshotLabels_Call) RunAndReturn ¶ added in v0.0.21
func (_c *MockDRVolumeInterface_setSnapshotLabels_Call) RunAndReturn(run func(map[string]string)) *MockDRVolumeInterface_setSnapshotLabels_Call
type MockProviderInterface ¶
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 (_m *MockProviderInterface) EXPECT() *MockProviderInterface_Expecter
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 ¶
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 (_c *MockProviderInterface_NewDRVolume_Call) Return(_a0 DRVolumeInterface, _a1 error) *MockProviderInterface_NewDRVolume_Call
func (*MockProviderInterface_NewDRVolume_Call) Run ¶
func (_c *MockProviderInterface_NewDRVolume_Call) Run(run func(ctx *contexts.Context, namespace string, name string, drType string, configuredSize resource.Quantity, opts DRVolumeCreateOptions)) *MockProviderInterface_NewDRVolume_Call
func (*MockProviderInterface_NewDRVolume_Call) RunAndReturn ¶
func (_c *MockProviderInterface_NewDRVolume_Call) RunAndReturn(run func(*contexts.Context, string, string, string, resource.Quantity, DRVolumeCreateOptions) (DRVolumeInterface, error)) *MockProviderInterface_NewDRVolume_Call
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)
}