Commit bd50f7c9 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #32202 from feiskyer/kuberuntime-runsandbox

Automatic merge from submit-queue Kubelet: rename CreatePodSandbox to RunPodSandbox in CRI As @yifan-gu pointed out in #31847, the name `CreatePodSandbox` doesn't reflect that the sandbox is running after the API succeeds. This PR renames it to `RunPodSandbox` to make this clear. CC @yujuhong @yifan-gu @kubernetes/sig-node
parents 43710a87 58a9da33
......@@ -50,9 +50,9 @@ type ContainerManager interface {
// 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)
// RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure
// the sandbox is in ready state.
RunPodSandbox(config *runtimeApi.PodSandboxConfig) (string, error)
// StopPodSandbox stops the sandbox. If there are any running containers in the
// sandbox, they should be force terminated.
StopPodSandbox(podSandboxID string) error
......
......@@ -99,11 +99,11 @@ func (r *FakeRuntimeService) Version(apiVersion string) (*runtimeApi.VersionResp
}, nil
}
func (r *FakeRuntimeService) CreatePodSandbox(config *runtimeApi.PodSandboxConfig) (string, error) {
func (r *FakeRuntimeService) RunPodSandbox(config *runtimeApi.PodSandboxConfig) (string, error) {
r.Lock()
defer r.Unlock()
r.Called = append(r.Called, "CreatePodSandbox")
r.Called = append(r.Called, "RunPodSandbox")
// PodSandboxID should be randomized for real container runtime, but here just use
// fixed name from BuildSandboxName() for easily making fake sandboxes.
......
......@@ -8,9 +8,9 @@ service RuntimeService {
// Version returns the runtime name, runtime version and runtime API version
rpc Version(VersionRequest) returns (VersionResponse) {}
// CreatePodSandbox creates a pod-level sandbox.
// The definition of PodSandbox is at https://github.com/kubernetes/kubernetes/pull/25899
rpc CreatePodSandbox(CreatePodSandboxRequest) returns (CreatePodSandboxResponse) {}
// RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure
// the sandbox is in ready state.
rpc RunPodSandbox(RunPodSandboxRequest) returns (RunPodSandboxResponse) {}
// StopPodSandbox stops the running sandbox. If there are any running
// containers in the sandbox, they should be forcibly terminated.
rpc StopPodSandbox(StopPodSandboxRequest) returns (StopPodSandboxResponse) {}
......@@ -188,12 +188,12 @@ message PodSandboxConfig {
optional LinuxPodSandboxConfig linux = 8;
}
message CreatePodSandboxRequest {
message RunPodSandboxRequest {
// The configuration for creating a PodSandBox.
optional PodSandboxConfig config = 1;
}
message CreatePodSandboxResponse {
message RunPodSandboxResponse {
// The id of the PodSandBox
optional string pod_sandbox_id = 1;
}
......
......@@ -37,12 +37,12 @@ const (
defaultSandboxGracePeriod int = 10
)
// CreatePodSandbox creates a pod-level sandbox.
// The definition of PodSandbox is at https://github.com/kubernetes/kubernetes/pull/25899
// RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure
// the sandbox is in ready state.
// For docker, PodSandbox is implemented by a container holding the network
// namespace for the pod.
// Note: docker doesn't use LogDirectory (yet).
func (ds *dockerService) CreatePodSandbox(config *runtimeApi.PodSandboxConfig) (string, error) {
func (ds *dockerService) RunPodSandbox(config *runtimeApi.PodSandboxConfig) (string, error) {
// Step 1: Pull the image for the sandbox.
// TODO: How should we handle pulling custom pod infra container image
// (with credentials)?
......
......@@ -36,7 +36,7 @@ func TestCreateSandbox(t *testing.T) {
Uid: &uid,
},
}
id, err := ds.CreatePodSandbox(config)
id, err := ds.RunPodSandbox(config)
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
......
......@@ -64,16 +64,17 @@ func (r *RemoteRuntimeService) Version(apiVersion string) (*runtimeApi.VersionRe
return typedVersion, err
}
// CreatePodSandbox creates a pod-level sandbox.
func (r *RemoteRuntimeService) CreatePodSandbox(config *runtimeApi.PodSandboxConfig) (string, error) {
// RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure
// the sandbox is in ready state.
func (r *RemoteRuntimeService) RunPodSandbox(config *runtimeApi.PodSandboxConfig) (string, error) {
ctx, cancel := getContextWithTimeout(r.timeout)
defer cancel()
resp, err := r.runtimeClient.CreatePodSandbox(ctx, &runtimeApi.CreatePodSandboxRequest{
resp, err := r.runtimeClient.RunPodSandbox(ctx, &runtimeApi.RunPodSandboxRequest{
Config: config,
})
if err != nil {
glog.Errorf("CreatePodSandbox from runtime service failed: %v", err)
glog.Errorf("RunPodSandbox from runtime service failed: %v", err)
return "", err
}
......
......@@ -33,8 +33,8 @@ func NewPodSandboxManager(PodSandboxManagerConfig) (kubeletApi.PodSandboxManager
return &PodSandboxManager{}, nil
}
// CreatePodSandbox creates a pod sandbox given a pod sandbox configuration.
func (*PodSandboxManager) CreatePodSandbox(*runtimeApi.PodSandboxConfig) (string, error) {
// RunPodSandbox creates and starts a pod sandbox given a pod sandbox configuration.
func (*PodSandboxManager) RunPodSandbox(*runtimeApi.PodSandboxConfig) (string, error) {
panic("not implemented")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment