kubelet: add CheckpointContainer() to the runtime

Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
Adrian Reber 2020-12-08 08:30:35 +00:00
parent 3e6f50683f
commit 8c24857ba3
No known key found for this signature in database
GPG Key ID: 82C9378ED3C4906A
4 changed files with 29 additions and 0 deletions

View File

@ -119,6 +119,9 @@ type Runtime interface {
// This method just proxies a new runtimeConfig with the updated // This method just proxies a new runtimeConfig with the updated
// CIDR value down to the runtime shim. // CIDR value down to the runtime shim.
UpdatePodCIDR(podCIDR string) error UpdatePodCIDR(podCIDR string) error
// CheckpointContainer tells the runtime to checkpoint a container
// and store the resulting archive to the checkpoint directory.
CheckpointContainer(options *runtimeapi.CheckpointContainerRequest) error
} }
// StreamingRuntime is the interface implemented by runtimes that handle the serving of the // StreamingRuntime is the interface implemented by runtimes that handle the serving of the

View File

@ -362,6 +362,14 @@ func (f *FakeRuntime) DeleteContainer(containerID kubecontainer.ContainerID) err
return f.Err return f.Err
} }
func (f *FakeRuntime) CheckpointContainer(options *runtimeapi.CheckpointContainerRequest) error {
f.Lock()
defer f.Unlock()
f.CalledFunctions = append(f.CalledFunctions, "CheckpointContainer")
return f.Err
}
func (f *FakeRuntime) ImageStats() (*kubecontainer.ImageStats, error) { func (f *FakeRuntime) ImageStats() (*kubecontainer.ImageStats, error) {
f.Lock() f.Lock()
defer f.Unlock() defer f.Unlock()

View File

@ -126,6 +126,20 @@ func (mr *MockRuntimeMockRecorder) APIVersion() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "APIVersion", reflect.TypeOf((*MockRuntime)(nil).APIVersion)) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "APIVersion", reflect.TypeOf((*MockRuntime)(nil).APIVersion))
} }
// CheckpointContainer mocks base method.
func (m *MockRuntime) CheckpointContainer(options *v10.CheckpointContainerRequest) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CheckpointContainer", options)
ret0, _ := ret[0].(error)
return ret0
}
// CheckpointContainer indicates an expected call of CheckpointContainer.
func (mr *MockRuntimeMockRecorder) CheckpointContainer(options interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckpointContainer", reflect.TypeOf((*MockRuntime)(nil).CheckpointContainer), options)
}
// DeleteContainer mocks base method. // DeleteContainer mocks base method.
func (m *MockRuntime) DeleteContainer(containerID container.ContainerID) error { func (m *MockRuntime) DeleteContainer(containerID container.ContainerID) error {
m.ctrl.T.Helper() m.ctrl.T.Helper()

View File

@ -1100,3 +1100,7 @@ func (m *kubeGenericRuntimeManager) UpdatePodCIDR(podCIDR string) error {
}, },
}) })
} }
func (m *kubeGenericRuntimeManager) CheckpointContainer(options *runtimeapi.CheckpointContainerRequest) error {
return m.runtimeService.CheckpointContainer(options)
}