plumb context from CRI calls through kubelet
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package cri
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@@ -25,40 +26,40 @@ import (
|
||||
// RuntimeVersioner contains methods for runtime name, version and API version.
|
||||
type RuntimeVersioner interface {
|
||||
// Version returns the runtime name, runtime version and runtime API version
|
||||
Version(apiVersion string) (*runtimeapi.VersionResponse, error)
|
||||
Version(ctx context.Context, apiVersion string) (*runtimeapi.VersionResponse, error)
|
||||
}
|
||||
|
||||
// ContainerManager contains methods to manipulate containers managed by a
|
||||
// container runtime. The methods are thread-safe.
|
||||
type ContainerManager interface {
|
||||
// CreateContainer creates a new container in specified PodSandbox.
|
||||
CreateContainer(podSandboxID string, config *runtimeapi.ContainerConfig, sandboxConfig *runtimeapi.PodSandboxConfig) (string, error)
|
||||
CreateContainer(ctx context.Context, podSandboxID string, config *runtimeapi.ContainerConfig, sandboxConfig *runtimeapi.PodSandboxConfig) (string, error)
|
||||
// StartContainer starts the container.
|
||||
StartContainer(containerID string) error
|
||||
StartContainer(ctx context.Context, containerID string) error
|
||||
// StopContainer stops a running container with a grace period (i.e., timeout).
|
||||
StopContainer(containerID string, timeout int64) error
|
||||
StopContainer(ctx context.Context, containerID string, timeout int64) error
|
||||
// RemoveContainer removes the container.
|
||||
RemoveContainer(containerID string) error
|
||||
RemoveContainer(ctx context.Context, containerID string) error
|
||||
// ListContainers lists all containers by filters.
|
||||
ListContainers(filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error)
|
||||
ListContainers(ctx context.Context, filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error)
|
||||
// ContainerStatus returns the status of the container.
|
||||
ContainerStatus(containerID string, verbose bool) (*runtimeapi.ContainerStatusResponse, error)
|
||||
ContainerStatus(ctx context.Context, containerID string, verbose bool) (*runtimeapi.ContainerStatusResponse, error)
|
||||
// UpdateContainerResources updates ContainerConfig of the container synchronously.
|
||||
// If runtime fails to transactionally update the requested resources, an error is returned.
|
||||
UpdateContainerResources(containerID string, resources *runtimeapi.ContainerResources) error
|
||||
UpdateContainerResources(ctx context.Context, containerID string, resources *runtimeapi.ContainerResources) error
|
||||
// ExecSync executes a command in the container, and returns the stdout output.
|
||||
// If command exits with a non-zero exit code, an error is returned.
|
||||
ExecSync(containerID string, cmd []string, timeout time.Duration) (stdout []byte, stderr []byte, err error)
|
||||
ExecSync(ctx context.Context, containerID string, cmd []string, timeout time.Duration) (stdout []byte, stderr []byte, err error)
|
||||
// Exec prepares a streaming endpoint to execute a command in the container, and returns the address.
|
||||
Exec(*runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error)
|
||||
Exec(context.Context, *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error)
|
||||
// Attach prepares a streaming endpoint to attach to a running container, and returns the address.
|
||||
Attach(req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error)
|
||||
Attach(ctx context.Context, req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error)
|
||||
// ReopenContainerLog asks runtime to reopen the stdout/stderr log file
|
||||
// for the container. If it returns error, new container log file MUST NOT
|
||||
// be created.
|
||||
ReopenContainerLog(ContainerID string) error
|
||||
ReopenContainerLog(ctx context.Context, ContainerID string) error
|
||||
// CheckpointContainer checkpoints a container
|
||||
CheckpointContainer(options *runtimeapi.CheckpointContainerRequest) error
|
||||
CheckpointContainer(ctx context.Context, options *runtimeapi.CheckpointContainerRequest) error
|
||||
// GetContainerEvents gets container events from the CRI runtime
|
||||
GetContainerEvents(containerEventsCh chan *runtimeapi.ContainerEventResponse) error
|
||||
}
|
||||
@@ -68,19 +69,19 @@ type ContainerManager interface {
|
||||
type PodSandboxManager interface {
|
||||
// RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure
|
||||
// the sandbox is in ready state.
|
||||
RunPodSandbox(config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error)
|
||||
RunPodSandbox(ctx context.Context, config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error)
|
||||
// StopPodSandbox stops the sandbox. If there are any running containers in the
|
||||
// sandbox, they should be force terminated.
|
||||
StopPodSandbox(podSandboxID string) error
|
||||
StopPodSandbox(pctx context.Context, odSandboxID string) error
|
||||
// RemovePodSandbox removes the sandbox. If there are running containers in the
|
||||
// sandbox, they should be forcibly removed.
|
||||
RemovePodSandbox(podSandboxID string) error
|
||||
RemovePodSandbox(ctx context.Context, podSandboxID string) error
|
||||
// PodSandboxStatus returns the Status of the PodSandbox.
|
||||
PodSandboxStatus(podSandboxID string, verbose bool) (*runtimeapi.PodSandboxStatusResponse, error)
|
||||
PodSandboxStatus(ctx context.Context, podSandboxID string, verbose bool) (*runtimeapi.PodSandboxStatusResponse, error)
|
||||
// ListPodSandbox returns a list of Sandbox.
|
||||
ListPodSandbox(filter *runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error)
|
||||
ListPodSandbox(ctx context.Context, filter *runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error)
|
||||
// PortForward prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.
|
||||
PortForward(*runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error)
|
||||
PortForward(context.Context, *runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error)
|
||||
}
|
||||
|
||||
// ContainerStatsManager contains methods for retrieving the container
|
||||
@@ -88,14 +89,14 @@ type PodSandboxManager interface {
|
||||
type ContainerStatsManager interface {
|
||||
// ContainerStats returns stats of the container. If the container does not
|
||||
// exist, the call returns an error.
|
||||
ContainerStats(containerID string) (*runtimeapi.ContainerStats, error)
|
||||
ContainerStats(ctx context.Context, containerID string) (*runtimeapi.ContainerStats, error)
|
||||
// ListContainerStats returns stats of all running containers.
|
||||
ListContainerStats(filter *runtimeapi.ContainerStatsFilter) ([]*runtimeapi.ContainerStats, error)
|
||||
ListContainerStats(ctx context.Context, filter *runtimeapi.ContainerStatsFilter) ([]*runtimeapi.ContainerStats, error)
|
||||
// PodSandboxStats returns stats of the pod. If the pod does not
|
||||
// exist, the call returns an error.
|
||||
PodSandboxStats(podSandboxID string) (*runtimeapi.PodSandboxStats, error)
|
||||
PodSandboxStats(ctx context.Context, podSandboxID string) (*runtimeapi.PodSandboxStats, error)
|
||||
// ListPodSandboxStats returns stats of all running pods.
|
||||
ListPodSandboxStats(filter *runtimeapi.PodSandboxStatsFilter) ([]*runtimeapi.PodSandboxStats, error)
|
||||
ListPodSandboxStats(ctx context.Context, filter *runtimeapi.PodSandboxStatsFilter) ([]*runtimeapi.PodSandboxStats, error)
|
||||
}
|
||||
|
||||
// RuntimeService interface should be implemented by a container runtime.
|
||||
@@ -107,9 +108,9 @@ type RuntimeService interface {
|
||||
ContainerStatsManager
|
||||
|
||||
// UpdateRuntimeConfig updates runtime configuration if specified
|
||||
UpdateRuntimeConfig(runtimeConfig *runtimeapi.RuntimeConfig) error
|
||||
UpdateRuntimeConfig(ctx context.Context, runtimeConfig *runtimeapi.RuntimeConfig) error
|
||||
// Status returns the status of the runtime.
|
||||
Status(verbose bool) (*runtimeapi.StatusResponse, error)
|
||||
Status(ctx context.Context, verbose bool) (*runtimeapi.StatusResponse, error)
|
||||
}
|
||||
|
||||
// ImageManagerService interface should be implemented by a container image
|
||||
@@ -117,13 +118,13 @@ type RuntimeService interface {
|
||||
// The methods should be thread-safe.
|
||||
type ImageManagerService interface {
|
||||
// ListImages lists the existing images.
|
||||
ListImages(filter *runtimeapi.ImageFilter) ([]*runtimeapi.Image, error)
|
||||
ListImages(ctx context.Context, filter *runtimeapi.ImageFilter) ([]*runtimeapi.Image, error)
|
||||
// ImageStatus returns the status of the image.
|
||||
ImageStatus(image *runtimeapi.ImageSpec, verbose bool) (*runtimeapi.ImageStatusResponse, error)
|
||||
ImageStatus(ctx context.Context, image *runtimeapi.ImageSpec, verbose bool) (*runtimeapi.ImageStatusResponse, error)
|
||||
// PullImage pulls an image with the authentication config.
|
||||
PullImage(image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, podSandboxConfig *runtimeapi.PodSandboxConfig) (string, error)
|
||||
PullImage(ctx context.Context, image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, podSandboxConfig *runtimeapi.PodSandboxConfig) (string, error)
|
||||
// RemoveImage removes the image.
|
||||
RemoveImage(image *runtimeapi.ImageSpec) error
|
||||
RemoveImage(ctx context.Context, image *runtimeapi.ImageSpec) error
|
||||
// ImageFsInfo returns information of the filesystem that is used to store images.
|
||||
ImageFsInfo() ([]*runtimeapi.FilesystemUsage, error)
|
||||
ImageFsInfo(ctx context.Context) ([]*runtimeapi.FilesystemUsage, error)
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package testing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
@@ -131,7 +132,7 @@ func (r *FakeImageService) popError(f string) error {
|
||||
}
|
||||
|
||||
// ListImages returns the list of images from FakeImageService or error if it was previously set.
|
||||
func (r *FakeImageService) ListImages(filter *runtimeapi.ImageFilter) ([]*runtimeapi.Image, error) {
|
||||
func (r *FakeImageService) ListImages(_ context.Context, filter *runtimeapi.ImageFilter) ([]*runtimeapi.Image, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -154,7 +155,7 @@ func (r *FakeImageService) ListImages(filter *runtimeapi.ImageFilter) ([]*runtim
|
||||
}
|
||||
|
||||
// ImageStatus returns the status of the image from the FakeImageService.
|
||||
func (r *FakeImageService) ImageStatus(image *runtimeapi.ImageSpec, verbose bool) (*runtimeapi.ImageStatusResponse, error) {
|
||||
func (r *FakeImageService) ImageStatus(_ context.Context, image *runtimeapi.ImageSpec, verbose bool) (*runtimeapi.ImageStatusResponse, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -167,7 +168,7 @@ func (r *FakeImageService) ImageStatus(image *runtimeapi.ImageSpec, verbose bool
|
||||
}
|
||||
|
||||
// PullImage emulate pulling the image from the FakeImageService.
|
||||
func (r *FakeImageService) PullImage(image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, podSandboxConfig *runtimeapi.PodSandboxConfig) (string, error) {
|
||||
func (r *FakeImageService) PullImage(_ context.Context, image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, podSandboxConfig *runtimeapi.PodSandboxConfig) (string, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -188,7 +189,7 @@ func (r *FakeImageService) PullImage(image *runtimeapi.ImageSpec, auth *runtimea
|
||||
}
|
||||
|
||||
// RemoveImage removes image from the FakeImageService.
|
||||
func (r *FakeImageService) RemoveImage(image *runtimeapi.ImageSpec) error {
|
||||
func (r *FakeImageService) RemoveImage(_ context.Context, image *runtimeapi.ImageSpec) error {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -204,7 +205,7 @@ func (r *FakeImageService) RemoveImage(image *runtimeapi.ImageSpec) error {
|
||||
}
|
||||
|
||||
// ImageFsInfo returns information of the filesystem that is used to store images.
|
||||
func (r *FakeImageService) ImageFsInfo() ([]*runtimeapi.FilesystemUsage, error) {
|
||||
func (r *FakeImageService) ImageFsInfo(_ context.Context) ([]*runtimeapi.FilesystemUsage, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
|
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package testing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
@@ -162,7 +163,7 @@ func NewFakeRuntimeService() *FakeRuntimeService {
|
||||
}
|
||||
|
||||
// Version returns version information from the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) Version(apiVersion string) (*runtimeapi.VersionResponse, error) {
|
||||
func (r *FakeRuntimeService) Version(_ context.Context, apiVersion string) (*runtimeapi.VersionResponse, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -180,7 +181,7 @@ func (r *FakeRuntimeService) Version(apiVersion string) (*runtimeapi.VersionResp
|
||||
}
|
||||
|
||||
// Status returns runtime status of the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) Status(verbose bool) (*runtimeapi.StatusResponse, error) {
|
||||
func (r *FakeRuntimeService) Status(_ context.Context, verbose bool) (*runtimeapi.StatusResponse, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -193,7 +194,7 @@ func (r *FakeRuntimeService) Status(verbose bool) (*runtimeapi.StatusResponse, e
|
||||
}
|
||||
|
||||
// RunPodSandbox emulates the run of the pod sandbox in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error) {
|
||||
func (r *FakeRuntimeService) RunPodSandbox(_ context.Context, config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -246,7 +247,7 @@ func (r *FakeRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig,
|
||||
}
|
||||
|
||||
// StopPodSandbox emulates the stop of pod sandbox in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) StopPodSandbox(podSandboxID string) error {
|
||||
func (r *FakeRuntimeService) StopPodSandbox(_ context.Context, podSandboxID string) error {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -265,7 +266,7 @@ func (r *FakeRuntimeService) StopPodSandbox(podSandboxID string) error {
|
||||
}
|
||||
|
||||
// RemovePodSandbox emulates removal of the pod sadbox in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) RemovePodSandbox(podSandboxID string) error {
|
||||
func (r *FakeRuntimeService) RemovePodSandbox(_ context.Context, podSandboxID string) error {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -281,7 +282,7 @@ func (r *FakeRuntimeService) RemovePodSandbox(podSandboxID string) error {
|
||||
}
|
||||
|
||||
// PodSandboxStatus returns pod sandbox status from the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) PodSandboxStatus(podSandboxID string, verbose bool) (*runtimeapi.PodSandboxStatusResponse, error) {
|
||||
func (r *FakeRuntimeService) PodSandboxStatus(_ context.Context, podSandboxID string, verbose bool) (*runtimeapi.PodSandboxStatusResponse, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -300,7 +301,7 @@ func (r *FakeRuntimeService) PodSandboxStatus(podSandboxID string, verbose bool)
|
||||
}
|
||||
|
||||
// ListPodSandbox returns the list of pod sandboxes in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) ListPodSandbox(filter *runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error) {
|
||||
func (r *FakeRuntimeService) ListPodSandbox(_ context.Context, filter *runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -338,7 +339,7 @@ func (r *FakeRuntimeService) ListPodSandbox(filter *runtimeapi.PodSandboxFilter)
|
||||
}
|
||||
|
||||
// PortForward emulates the set up of port forward in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) PortForward(*runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error) {
|
||||
func (r *FakeRuntimeService) PortForward(context.Context, *runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -351,7 +352,7 @@ func (r *FakeRuntimeService) PortForward(*runtimeapi.PortForwardRequest) (*runti
|
||||
}
|
||||
|
||||
// CreateContainer emulates container creation in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) CreateContainer(podSandboxID string, config *runtimeapi.ContainerConfig, sandboxConfig *runtimeapi.PodSandboxConfig) (string, error) {
|
||||
func (r *FakeRuntimeService) CreateContainer(_ context.Context, podSandboxID string, config *runtimeapi.ContainerConfig, sandboxConfig *runtimeapi.PodSandboxConfig) (string, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -385,7 +386,7 @@ func (r *FakeRuntimeService) CreateContainer(podSandboxID string, config *runtim
|
||||
}
|
||||
|
||||
// StartContainer emulates start of a container in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) StartContainer(containerID string) error {
|
||||
func (r *FakeRuntimeService) StartContainer(_ context.Context, containerID string) error {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -407,7 +408,7 @@ func (r *FakeRuntimeService) StartContainer(containerID string) error {
|
||||
}
|
||||
|
||||
// StopContainer emulates stop of a container in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) StopContainer(containerID string, timeout int64) error {
|
||||
func (r *FakeRuntimeService) StopContainer(_ context.Context, containerID string, timeout int64) error {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -431,7 +432,7 @@ func (r *FakeRuntimeService) StopContainer(containerID string, timeout int64) er
|
||||
}
|
||||
|
||||
// RemoveContainer emulates remove of a container in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) RemoveContainer(containerID string) error {
|
||||
func (r *FakeRuntimeService) RemoveContainer(_ context.Context, containerID string) error {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -447,7 +448,7 @@ func (r *FakeRuntimeService) RemoveContainer(containerID string) error {
|
||||
}
|
||||
|
||||
// ListContainers returns the list of containers in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) ListContainers(filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error) {
|
||||
func (r *FakeRuntimeService) ListContainers(_ context.Context, filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -490,7 +491,7 @@ func (r *FakeRuntimeService) ListContainers(filter *runtimeapi.ContainerFilter)
|
||||
}
|
||||
|
||||
// ContainerStatus returns the container status given the container ID in FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) ContainerStatus(containerID string, verbose bool) (*runtimeapi.ContainerStatusResponse, error) {
|
||||
func (r *FakeRuntimeService) ContainerStatus(_ context.Context, containerID string, verbose bool) (*runtimeapi.ContainerStatusResponse, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -509,7 +510,7 @@ func (r *FakeRuntimeService) ContainerStatus(containerID string, verbose bool) (
|
||||
}
|
||||
|
||||
// UpdateContainerResources returns the container resource in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) UpdateContainerResources(string, *runtimeapi.ContainerResources) error {
|
||||
func (r *FakeRuntimeService) UpdateContainerResources(context.Context, string, *runtimeapi.ContainerResources) error {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -518,7 +519,7 @@ func (r *FakeRuntimeService) UpdateContainerResources(string, *runtimeapi.Contai
|
||||
}
|
||||
|
||||
// ExecSync emulates the sync execution of a command in a container in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) ExecSync(containerID string, cmd []string, timeout time.Duration) (stdout []byte, stderr []byte, err error) {
|
||||
func (r *FakeRuntimeService) ExecSync(_ context.Context, containerID string, cmd []string, timeout time.Duration) (stdout []byte, stderr []byte, err error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -528,7 +529,7 @@ func (r *FakeRuntimeService) ExecSync(containerID string, cmd []string, timeout
|
||||
}
|
||||
|
||||
// Exec emulates the execution of a command in a container in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) Exec(*runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) {
|
||||
func (r *FakeRuntimeService) Exec(context.Context, *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -541,7 +542,7 @@ func (r *FakeRuntimeService) Exec(*runtimeapi.ExecRequest) (*runtimeapi.ExecResp
|
||||
}
|
||||
|
||||
// Attach emulates the attach request in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) Attach(req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error) {
|
||||
func (r *FakeRuntimeService) Attach(_ context.Context, req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -554,7 +555,7 @@ func (r *FakeRuntimeService) Attach(req *runtimeapi.AttachRequest) (*runtimeapi.
|
||||
}
|
||||
|
||||
// UpdateRuntimeConfig emulates the update of a runtime config for the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) UpdateRuntimeConfig(runtimeCOnfig *runtimeapi.RuntimeConfig) error {
|
||||
func (r *FakeRuntimeService) UpdateRuntimeConfig(_ context.Context, runtimeCOnfig *runtimeapi.RuntimeConfig) error {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -574,7 +575,7 @@ func (r *FakeRuntimeService) SetFakeContainerStats(containerStats []*runtimeapi.
|
||||
}
|
||||
|
||||
// ContainerStats returns the container stats in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) ContainerStats(containerID string) (*runtimeapi.ContainerStats, error) {
|
||||
func (r *FakeRuntimeService) ContainerStats(_ context.Context, containerID string) (*runtimeapi.ContainerStats, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -591,7 +592,7 @@ func (r *FakeRuntimeService) ContainerStats(containerID string) (*runtimeapi.Con
|
||||
}
|
||||
|
||||
// ListContainerStats returns the list of all container stats given the filter in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) ListContainerStats(filter *runtimeapi.ContainerStatsFilter) ([]*runtimeapi.ContainerStats, error) {
|
||||
func (r *FakeRuntimeService) ListContainerStats(_ context.Context, filter *runtimeapi.ContainerStatsFilter) ([]*runtimeapi.ContainerStats, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -635,7 +636,7 @@ func (r *FakeRuntimeService) SetFakePodSandboxStats(podStats []*runtimeapi.PodSa
|
||||
}
|
||||
|
||||
// PodSandboxStats returns the sandbox stats in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) PodSandboxStats(podSandboxID string) (*runtimeapi.PodSandboxStats, error) {
|
||||
func (r *FakeRuntimeService) PodSandboxStats(_ context.Context, podSandboxID string) (*runtimeapi.PodSandboxStats, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -652,7 +653,7 @@ func (r *FakeRuntimeService) PodSandboxStats(podSandboxID string) (*runtimeapi.P
|
||||
}
|
||||
|
||||
// ListPodSandboxStats returns the list of all pod sandbox stats given the filter in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) ListPodSandboxStats(filter *runtimeapi.PodSandboxStatsFilter) ([]*runtimeapi.PodSandboxStats, error) {
|
||||
func (r *FakeRuntimeService) ListPodSandboxStats(_ context.Context, filter *runtimeapi.PodSandboxStatsFilter) ([]*runtimeapi.PodSandboxStats, error) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -682,7 +683,7 @@ func (r *FakeRuntimeService) ListPodSandboxStats(filter *runtimeapi.PodSandboxSt
|
||||
}
|
||||
|
||||
// ReopenContainerLog emulates call to the reopen container log in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) ReopenContainerLog(containerID string) error {
|
||||
func (r *FakeRuntimeService) ReopenContainerLog(_ context.Context, containerID string) error {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
@@ -696,7 +697,7 @@ func (r *FakeRuntimeService) ReopenContainerLog(containerID string) error {
|
||||
}
|
||||
|
||||
// CheckpointContainer emulates call to checkpoint a container in the FakeRuntimeService.
|
||||
func (r *FakeRuntimeService) CheckpointContainer(options *runtimeapi.CheckpointContainerRequest) error {
|
||||
func (r *FakeRuntimeService) CheckpointContainer(_ context.Context, options *runtimeapi.CheckpointContainerRequest) error {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
|
Reference in New Issue
Block a user