kubelet/api: extract PodSandboxManager interface

Splits `RuntimeService` interface into smaller interfaces
to make testing easier and to delineate responsibilities.
This commit is contained in:
Tamer Tas 2016-08-16 00:38:35 +03:00
parent f715aa475c
commit f031f09efc

View File

@ -47,12 +47,9 @@ type ContainerManager interface {
Exec(containerID string, cmd []string, tty bool, stdin io.Reader, stdout, stderr io.WriteCloser) error
}
// RuntimeService interface should be implemented by a container runtime.
// The methods should be thread-safe.
type RuntimeService interface {
RuntimeVersioner
ContainerManager
// PodSandboxManager contains methods for operating on PodSandboxes. The methods
// are thread-safe.
type PodSandboxManager interface {
// CreatePodSandbox creates a pod-level sandbox.
// The definition of PodSandbox is at https://github.com/kubernetes/kubernetes/pull/25899
CreatePodSandbox(config *runtimeApi.PodSandboxConfig) (string, error)
@ -68,6 +65,14 @@ type RuntimeService interface {
ListPodSandbox(filter *runtimeApi.PodSandboxFilter) ([]*runtimeApi.PodSandbox, error)
}
// RuntimeService interface should be implemented by a container runtime.
// The methods should be thread-safe.
type RuntimeService interface {
RuntimeVersioner
ContainerManager
PodSandboxManager
}
// ImageManagerService interface should be implemented by a container image
// manager.
// The methods should be thread-safe.