mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-13 11:34:54 +00:00
* Update CRDs and CLI to support in-place restore (#10038) Update CRDs(Restore, DataDownload, PodVolumeRestore) and restore create CLI to support in-place restore Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com> * Update Kopia(filesystem) uploader to support incremental and deleteExtraFile during restore (#10066) Update Kopia(filesystem) uploader to support incremental and deleteExtraFile during restore Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com> * Update Restore Exposer and PVC CSI to support in-place restore (#10104) 1. Update Restore Exposer to support exposing with existing PV for in-place restore 2. Update PVC CSI RIA to continue the restore process for in-place restore Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com> * Update Block uploader to support increase restore (#10244) Update Block uploader to support increase restore Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com> * Update Exposer to recreate the target PV if the volume mode is different with the restore PVC (#10257) Update Exposer to recreate the target PV if the volume mode is different with t he restore PVC Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com> * Preserve PVC selected-node annotation via carrier annotation for in-place restore For in-place volume data restore, the existing PVC is deleted and recreated. For StorageClasses with the WaitForFirstConsumer volume binding mode, losing the volume.kubernetes.io/selected-node annotation could let the scheduler place the recreated workload Pod in a different zone than the original PV, leaving it stuck in ContainerCreating. Instead of relying on RestoreItemAction execution order (the generic PVC RIA unconditionally strips the selected-node annotation), the PVC CSI RIA now captures the annotation from the existing PVC right before deleting it and carries it on the target PVC via the Velero-internal restore.velero.io/inplace-restore-selected-node annotation. The restore engine translates the carrier back to the Kubernetes annotation after all RestoreItemActions have run and always strips the carrier so it never lands on the cluster. This makes the behavior independent of RIA ordering: the Kubernetes annotation is stripped by default on every path (including when the target PVC does not exist and Velero falls back to provisioning a new PVC), and preservation only happens when the CSI RIA explicitly captured a value from the existing PVC. Signed-off-by: chlins <chlins.zhang@gmail.com> * Update the control path to make the in-place incremental restore with block data mover work E2E (#10410) Update the control path to make the in-place incremental restore with block data mover work E2E Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com> --------- Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com> Signed-off-by: chlins <chlins.zhang@gmail.com> Co-authored-by: chlins <chlins.zhang@gmail.com>
421 lines
15 KiB
Go
421 lines
15 KiB
Go
// Code generated by mockery; DO NOT EDIT.
|
|
// github.com/vektra/mockery
|
|
// template: testify
|
|
|
|
package mocks
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
"github.com/vmware-tanzu/velero/pkg/exposer"
|
|
"k8s.io/api/core/v1"
|
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
|
)
|
|
|
|
// NewGenericRestoreExposer creates a new instance of GenericRestoreExposer. 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 NewGenericRestoreExposer(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *GenericRestoreExposer {
|
|
mock := &GenericRestoreExposer{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|
|
|
|
// GenericRestoreExposer is an autogenerated mock type for the GenericRestoreExposer type
|
|
type GenericRestoreExposer struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type GenericRestoreExposer_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *GenericRestoreExposer) EXPECT() *GenericRestoreExposer_Expecter {
|
|
return &GenericRestoreExposer_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// CleanUp provides a mock function for the type GenericRestoreExposer
|
|
func (_mock *GenericRestoreExposer) CleanUp(context1 context.Context, objectReference v1.ObjectReference, param *exposer.GenericRestoreCleanUpParam) {
|
|
_mock.Called(context1, objectReference, param)
|
|
return
|
|
}
|
|
|
|
// GenericRestoreExposer_CleanUp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CleanUp'
|
|
type GenericRestoreExposer_CleanUp_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// CleanUp is a helper method to define mock.On call
|
|
// - context1 context.Context
|
|
// - objectReference v1.ObjectReference
|
|
// - param *exposer.GenericRestoreCleanUpParam
|
|
func (_e *GenericRestoreExposer_Expecter) CleanUp(context1 interface{}, objectReference interface{}, param interface{}) *GenericRestoreExposer_CleanUp_Call {
|
|
return &GenericRestoreExposer_CleanUp_Call{Call: _e.mock.On("CleanUp", context1, objectReference, param)}
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_CleanUp_Call) Run(run func(context1 context.Context, objectReference v1.ObjectReference, param *exposer.GenericRestoreCleanUpParam)) *GenericRestoreExposer_CleanUp_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 v1.ObjectReference
|
|
if args[1] != nil {
|
|
arg1 = args[1].(v1.ObjectReference)
|
|
}
|
|
var arg2 *exposer.GenericRestoreCleanUpParam
|
|
if args[2] != nil {
|
|
arg2 = args[2].(*exposer.GenericRestoreCleanUpParam)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_CleanUp_Call) Return() *GenericRestoreExposer_CleanUp_Call {
|
|
_c.Call.Return()
|
|
return _c
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_CleanUp_Call) RunAndReturn(run func(context1 context.Context, objectReference v1.ObjectReference, param *exposer.GenericRestoreCleanUpParam)) *GenericRestoreExposer_CleanUp_Call {
|
|
_c.Run(run)
|
|
return _c
|
|
}
|
|
|
|
// DiagnoseExpose provides a mock function for the type GenericRestoreExposer
|
|
func (_mock *GenericRestoreExposer) DiagnoseExpose(context1 context.Context, objectReference v1.ObjectReference) string {
|
|
ret := _mock.Called(context1, objectReference)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DiagnoseExpose")
|
|
}
|
|
|
|
var r0 string
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, v1.ObjectReference) string); ok {
|
|
r0 = returnFunc(context1, objectReference)
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// GenericRestoreExposer_DiagnoseExpose_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DiagnoseExpose'
|
|
type GenericRestoreExposer_DiagnoseExpose_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// DiagnoseExpose is a helper method to define mock.On call
|
|
// - context1 context.Context
|
|
// - objectReference v1.ObjectReference
|
|
func (_e *GenericRestoreExposer_Expecter) DiagnoseExpose(context1 interface{}, objectReference interface{}) *GenericRestoreExposer_DiagnoseExpose_Call {
|
|
return &GenericRestoreExposer_DiagnoseExpose_Call{Call: _e.mock.On("DiagnoseExpose", context1, objectReference)}
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_DiagnoseExpose_Call) Run(run func(context1 context.Context, objectReference v1.ObjectReference)) *GenericRestoreExposer_DiagnoseExpose_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 v1.ObjectReference
|
|
if args[1] != nil {
|
|
arg1 = args[1].(v1.ObjectReference)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_DiagnoseExpose_Call) Return(s string) *GenericRestoreExposer_DiagnoseExpose_Call {
|
|
_c.Call.Return(s)
|
|
return _c
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_DiagnoseExpose_Call) RunAndReturn(run func(context1 context.Context, objectReference v1.ObjectReference) string) *GenericRestoreExposer_DiagnoseExpose_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Expose provides a mock function for the type GenericRestoreExposer
|
|
func (_mock *GenericRestoreExposer) Expose(context1 context.Context, objectReference v1.ObjectReference, genericRestoreExposeParam exposer.GenericRestoreExposeParam) error {
|
|
ret := _mock.Called(context1, objectReference, genericRestoreExposeParam)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Expose")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, v1.ObjectReference, exposer.GenericRestoreExposeParam) error); ok {
|
|
r0 = returnFunc(context1, objectReference, genericRestoreExposeParam)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// GenericRestoreExposer_Expose_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Expose'
|
|
type GenericRestoreExposer_Expose_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Expose is a helper method to define mock.On call
|
|
// - context1 context.Context
|
|
// - objectReference v1.ObjectReference
|
|
// - genericRestoreExposeParam exposer.GenericRestoreExposeParam
|
|
func (_e *GenericRestoreExposer_Expecter) Expose(context1 interface{}, objectReference interface{}, genericRestoreExposeParam interface{}) *GenericRestoreExposer_Expose_Call {
|
|
return &GenericRestoreExposer_Expose_Call{Call: _e.mock.On("Expose", context1, objectReference, genericRestoreExposeParam)}
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_Expose_Call) Run(run func(context1 context.Context, objectReference v1.ObjectReference, genericRestoreExposeParam exposer.GenericRestoreExposeParam)) *GenericRestoreExposer_Expose_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 v1.ObjectReference
|
|
if args[1] != nil {
|
|
arg1 = args[1].(v1.ObjectReference)
|
|
}
|
|
var arg2 exposer.GenericRestoreExposeParam
|
|
if args[2] != nil {
|
|
arg2 = args[2].(exposer.GenericRestoreExposeParam)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_Expose_Call) Return(err error) *GenericRestoreExposer_Expose_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_Expose_Call) RunAndReturn(run func(context1 context.Context, objectReference v1.ObjectReference, genericRestoreExposeParam exposer.GenericRestoreExposeParam) error) *GenericRestoreExposer_Expose_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// GetExposed provides a mock function for the type GenericRestoreExposer
|
|
func (_mock *GenericRestoreExposer) GetExposed(context1 context.Context, objectReference v1.ObjectReference, client1 client.Client, s string, duration time.Duration) (*exposer.ExposeResult, error) {
|
|
ret := _mock.Called(context1, objectReference, client1, s, duration)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetExposed")
|
|
}
|
|
|
|
var r0 *exposer.ExposeResult
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, v1.ObjectReference, client.Client, string, time.Duration) (*exposer.ExposeResult, error)); ok {
|
|
return returnFunc(context1, objectReference, client1, s, duration)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, v1.ObjectReference, client.Client, string, time.Duration) *exposer.ExposeResult); ok {
|
|
r0 = returnFunc(context1, objectReference, client1, s, duration)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*exposer.ExposeResult)
|
|
}
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context, v1.ObjectReference, client.Client, string, time.Duration) error); ok {
|
|
r1 = returnFunc(context1, objectReference, client1, s, duration)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// GenericRestoreExposer_GetExposed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetExposed'
|
|
type GenericRestoreExposer_GetExposed_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// GetExposed is a helper method to define mock.On call
|
|
// - context1 context.Context
|
|
// - objectReference v1.ObjectReference
|
|
// - client1 client.Client
|
|
// - s string
|
|
// - duration time.Duration
|
|
func (_e *GenericRestoreExposer_Expecter) GetExposed(context1 interface{}, objectReference interface{}, client1 interface{}, s interface{}, duration interface{}) *GenericRestoreExposer_GetExposed_Call {
|
|
return &GenericRestoreExposer_GetExposed_Call{Call: _e.mock.On("GetExposed", context1, objectReference, client1, s, duration)}
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_GetExposed_Call) Run(run func(context1 context.Context, objectReference v1.ObjectReference, client1 client.Client, s string, duration time.Duration)) *GenericRestoreExposer_GetExposed_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 v1.ObjectReference
|
|
if args[1] != nil {
|
|
arg1 = args[1].(v1.ObjectReference)
|
|
}
|
|
var arg2 client.Client
|
|
if args[2] != nil {
|
|
arg2 = args[2].(client.Client)
|
|
}
|
|
var arg3 string
|
|
if args[3] != nil {
|
|
arg3 = args[3].(string)
|
|
}
|
|
var arg4 time.Duration
|
|
if args[4] != nil {
|
|
arg4 = args[4].(time.Duration)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
arg3,
|
|
arg4,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_GetExposed_Call) Return(exposeResult *exposer.ExposeResult, err error) *GenericRestoreExposer_GetExposed_Call {
|
|
_c.Call.Return(exposeResult, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_GetExposed_Call) RunAndReturn(run func(context1 context.Context, objectReference v1.ObjectReference, client1 client.Client, s string, duration time.Duration) (*exposer.ExposeResult, error)) *GenericRestoreExposer_GetExposed_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// PeekExposed provides a mock function for the type GenericRestoreExposer
|
|
func (_mock *GenericRestoreExposer) PeekExposed(context1 context.Context, objectReference v1.ObjectReference) error {
|
|
ret := _mock.Called(context1, objectReference)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for PeekExposed")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, v1.ObjectReference) error); ok {
|
|
r0 = returnFunc(context1, objectReference)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// GenericRestoreExposer_PeekExposed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PeekExposed'
|
|
type GenericRestoreExposer_PeekExposed_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// PeekExposed is a helper method to define mock.On call
|
|
// - context1 context.Context
|
|
// - objectReference v1.ObjectReference
|
|
func (_e *GenericRestoreExposer_Expecter) PeekExposed(context1 interface{}, objectReference interface{}) *GenericRestoreExposer_PeekExposed_Call {
|
|
return &GenericRestoreExposer_PeekExposed_Call{Call: _e.mock.On("PeekExposed", context1, objectReference)}
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_PeekExposed_Call) Run(run func(context1 context.Context, objectReference v1.ObjectReference)) *GenericRestoreExposer_PeekExposed_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 v1.ObjectReference
|
|
if args[1] != nil {
|
|
arg1 = args[1].(v1.ObjectReference)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_PeekExposed_Call) Return(err error) *GenericRestoreExposer_PeekExposed_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_PeekExposed_Call) RunAndReturn(run func(context1 context.Context, objectReference v1.ObjectReference) error) *GenericRestoreExposer_PeekExposed_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// RebindVolume provides a mock function for the type GenericRestoreExposer
|
|
func (_mock *GenericRestoreExposer) RebindVolume(context1 context.Context, objectReference v1.ObjectReference, genericRestoreRebindVolumeParam exposer.GenericRestoreRebindVolumeParam) error {
|
|
ret := _mock.Called(context1, objectReference, genericRestoreRebindVolumeParam)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for RebindVolume")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, v1.ObjectReference, exposer.GenericRestoreRebindVolumeParam) error); ok {
|
|
r0 = returnFunc(context1, objectReference, genericRestoreRebindVolumeParam)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// GenericRestoreExposer_RebindVolume_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RebindVolume'
|
|
type GenericRestoreExposer_RebindVolume_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// RebindVolume is a helper method to define mock.On call
|
|
// - context1 context.Context
|
|
// - objectReference v1.ObjectReference
|
|
// - genericRestoreRebindVolumeParam exposer.GenericRestoreRebindVolumeParam
|
|
func (_e *GenericRestoreExposer_Expecter) RebindVolume(context1 interface{}, objectReference interface{}, genericRestoreRebindVolumeParam interface{}) *GenericRestoreExposer_RebindVolume_Call {
|
|
return &GenericRestoreExposer_RebindVolume_Call{Call: _e.mock.On("RebindVolume", context1, objectReference, genericRestoreRebindVolumeParam)}
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_RebindVolume_Call) Run(run func(context1 context.Context, objectReference v1.ObjectReference, genericRestoreRebindVolumeParam exposer.GenericRestoreRebindVolumeParam)) *GenericRestoreExposer_RebindVolume_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 v1.ObjectReference
|
|
if args[1] != nil {
|
|
arg1 = args[1].(v1.ObjectReference)
|
|
}
|
|
var arg2 exposer.GenericRestoreRebindVolumeParam
|
|
if args[2] != nil {
|
|
arg2 = args[2].(exposer.GenericRestoreRebindVolumeParam)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_RebindVolume_Call) Return(err error) *GenericRestoreExposer_RebindVolume_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *GenericRestoreExposer_RebindVolume_Call) RunAndReturn(run func(context1 context.Context, objectReference v1.ObjectReference, genericRestoreRebindVolumeParam exposer.GenericRestoreRebindVolumeParam) error) *GenericRestoreExposer_RebindVolume_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|