@@ -37,73 +37,74 @@ package cri
3737import (
3838 "time"
3939
40+ "google.golang.org/grpc"
4041 runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
4142)
4243
4344// RuntimeVersioner contains methods for runtime name, version and API version.
4445type RuntimeVersioner interface {
4546 // Version returns the runtime name, runtime version and runtime API version
46- Version (apiVersion string ) (* runtimeapi.VersionResponse , error )
47+ Version (apiVersion string , opts ... grpc. CallOption ) (* runtimeapi.VersionResponse , error )
4748}
4849
4950// ContainerManager contains methods to manipulate containers managed by a
5051// container runtime. The methods are thread-safe.
5152type ContainerManager interface {
5253 // CreateContainer creates a new container in specified PodSandbox.
53- CreateContainer (podSandboxID string , config * runtimeapi.ContainerConfig , sandboxConfig * runtimeapi.PodSandboxConfig ) (string , error )
54+ CreateContainer (podSandboxID string , config * runtimeapi.ContainerConfig , sandboxConfig * runtimeapi.PodSandboxConfig , opts ... grpc. CallOption ) (string , error )
5455 // StartContainer starts the container.
55- StartContainer (containerID string ) error
56+ StartContainer (containerID string , opts ... grpc. CallOption ) error
5657 // StopContainer stops a running container with a grace period (i.e., timeout).
57- StopContainer (containerID string , timeout int64 ) error
58+ StopContainer (containerID string , timeout int64 , opts ... grpc. CallOption ) error
5859 // RemoveContainer removes the container.
59- RemoveContainer (containerID string ) error
60+ RemoveContainer (containerID string , opts ... grpc. CallOption ) error
6061 // ListContainers lists all containers by filters.
61- ListContainers (filter * runtimeapi.ContainerFilter ) ([]* runtimeapi.Container , error )
62+ ListContainers (filter * runtimeapi.ContainerFilter , opts ... grpc. CallOption ) ([]* runtimeapi.Container , error )
6263 // ContainerStatus returns the status of the container.
63- ContainerStatus (containerID string ) (* runtimeapi.ContainerStatus , error )
64+ ContainerStatus (containerID string , opts ... grpc. CallOption ) (* runtimeapi.ContainerStatus , error )
6465 // UpdateContainerResources updates the cgroup resources for the container.
65- UpdateContainerResources (containerID string , resources * runtimeapi.LinuxContainerResources ) error
66+ UpdateContainerResources (containerID string , resources * runtimeapi.LinuxContainerResources , opts ... grpc. CallOption ) error
6667 // ExecSync executes a command in the container, and returns the stdout output.
6768 // If command exits with a non-zero exit code, an error is returned.
68- ExecSync (containerID string , cmd []string , timeout time.Duration ) (stdout []byte , stderr []byte , err error )
69+ ExecSync (containerID string , cmd []string , timeout time.Duration , opts ... grpc. CallOption ) (stdout []byte , stderr []byte , err error )
6970 // Exec prepares a streaming endpoint to execute a command in the container, and returns the address.
70- Exec (* runtimeapi.ExecRequest ) (* runtimeapi.ExecResponse , error )
71+ Exec (req * runtimeapi.ExecRequest , opts ... grpc. CallOption ) (* runtimeapi.ExecResponse , error )
7172 // Attach prepares a streaming endpoint to attach to a running container, and returns the address.
72- Attach (req * runtimeapi.AttachRequest ) (* runtimeapi.AttachResponse , error )
73+ Attach (req * runtimeapi.AttachRequest , opts ... grpc. CallOption ) (* runtimeapi.AttachResponse , error )
7374 // ReopenContainerLog asks runtime to reopen the stdout/stderr log file
7475 // for the container. If it returns error, new container log file MUST NOT
7576 // be created.
76- ReopenContainerLog (ContainerID string ) error
77+ ReopenContainerLog (ContainerID string , opts ... grpc. CallOption ) error
7778}
7879
7980// PodSandboxManager contains methods for operating on PodSandboxes. The methods
8081// are thread-safe.
8182type PodSandboxManager interface {
8283 // RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure
8384 // the sandbox is in ready state.
84- RunPodSandbox (config * runtimeapi.PodSandboxConfig , runtimeHandler string ) (string , error )
85+ RunPodSandbox (config * runtimeapi.PodSandboxConfig , runtimeHandler string , opts ... grpc. CallOption ) (string , error )
8586 // StopPodSandbox stops the sandbox. If there are any running containers in the
8687 // sandbox, they should be force terminated.
87- StopPodSandbox (podSandboxID string ) error
88+ StopPodSandbox (podSandboxID string , opts ... grpc. CallOption ) error
8889 // RemovePodSandbox removes the sandbox. If there are running containers in the
8990 // sandbox, they should be forcibly removed.
90- RemovePodSandbox (podSandboxID string ) error
91+ RemovePodSandbox (podSandboxID string , opts ... grpc. CallOption ) error
9192 // PodSandboxStatus returns the Status of the PodSandbox.
92- PodSandboxStatus (podSandboxID string ) (* runtimeapi.PodSandboxStatus , error )
93+ PodSandboxStatus (podSandboxID string , opts ... grpc. CallOption ) (* runtimeapi.PodSandboxStatus , error )
9394 // ListPodSandbox returns a list of Sandbox.
94- ListPodSandbox (filter * runtimeapi.PodSandboxFilter ) ([]* runtimeapi.PodSandbox , error )
95+ ListPodSandbox (filter * runtimeapi.PodSandboxFilter , opts ... grpc. CallOption ) ([]* runtimeapi.PodSandbox , error )
9596 // PortForward prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.
96- PortForward (* runtimeapi.PortForwardRequest ) (* runtimeapi.PortForwardResponse , error )
97+ PortForward (req * runtimeapi.PortForwardRequest , opts ... grpc. CallOption ) (* runtimeapi.PortForwardResponse , error )
9798}
9899
99100// ContainerStatsManager contains methods for retrieving the container
100101// statistics.
101102type ContainerStatsManager interface {
102103 // ContainerStats returns stats of the container. If the container does not
103104 // exist, the call returns an error.
104- ContainerStats (containerID string ) (* runtimeapi.ContainerStats , error )
105+ ContainerStats (containerID string , opts ... grpc. CallOption ) (* runtimeapi.ContainerStats , error )
105106 // ListContainerStats returns stats of all running containers.
106- ListContainerStats (filter * runtimeapi.ContainerStatsFilter ) ([]* runtimeapi.ContainerStats , error )
107+ ListContainerStats (filter * runtimeapi.ContainerStatsFilter , opts ... grpc. CallOption ) ([]* runtimeapi.ContainerStats , error )
107108}
108109
109110// RuntimeService interface should be implemented by a container runtime.
@@ -115,23 +116,23 @@ type RuntimeService interface {
115116 ContainerStatsManager
116117
117118 // UpdateRuntimeConfig updates runtime configuration if specified
118- UpdateRuntimeConfig (runtimeConfig * runtimeapi.RuntimeConfig ) error
119+ UpdateRuntimeConfig (runtimeConfig * runtimeapi.RuntimeConfig , opts ... grpc. CallOption ) error
119120 // Status returns the status of the runtime.
120- Status () (* runtimeapi.RuntimeStatus , error )
121+ Status (opts ... grpc. CallOption ) (* runtimeapi.RuntimeStatus , error )
121122}
122123
123124// ImageManagerService interface should be implemented by a container image
124125// manager.
125126// The methods should be thread-safe.
126127type ImageManagerService interface {
127128 // ListImages lists the existing images.
128- ListImages (filter * runtimeapi.ImageFilter ) ([]* runtimeapi.Image , error )
129+ ListImages (filter * runtimeapi.ImageFilter , opts ... grpc. CallOption ) ([]* runtimeapi.Image , error )
129130 // ImageStatus returns the status of the image.
130- ImageStatus (image * runtimeapi.ImageSpec ) (* runtimeapi.Image , error )
131+ ImageStatus (image * runtimeapi.ImageSpec , opts ... grpc. CallOption ) (* runtimeapi.Image , error )
131132 // PullImage pulls an image with the authentication config.
132- PullImage (image * runtimeapi.ImageSpec , auth * runtimeapi.AuthConfig , podSandboxConfig * runtimeapi.PodSandboxConfig ) (string , error )
133+ PullImage (image * runtimeapi.ImageSpec , auth * runtimeapi.AuthConfig , podSandboxConfig * runtimeapi.PodSandboxConfig , opts ... grpc. CallOption ) (string , error )
133134 // RemoveImage removes the image.
134- RemoveImage (image * runtimeapi.ImageSpec ) error
135+ RemoveImage (image * runtimeapi.ImageSpec , opts ... grpc. CallOption ) error
135136 // ImageFsInfo returns information of the filesystem that is used to store images.
136- ImageFsInfo () ([]* runtimeapi.FilesystemUsage , error )
137+ ImageFsInfo (opts ... grpc. CallOption ) ([]* runtimeapi.FilesystemUsage , error )
137138}
0 commit comments