CRI: rename DeletePodSandbox to RemovePodSandbox

This makes it consistent with other calls (e.g., RemoveContainer, RemoveImage).
This commit is contained in:
Yu-Ju Hong 2016-08-03 15:08:10 -07:00
parent 7c326672c1
commit 5c06d7e620
6 changed files with 66 additions and 66 deletions

View File

@ -33,9 +33,9 @@ type RuntimeService interface {
// StopPodSandbox stops the sandbox. If there are any running containers in the // StopPodSandbox stops the sandbox. If there are any running containers in the
// sandbox, they should be force terminated. // sandbox, they should be force terminated.
StopPodSandbox(podSandboxID string) error StopPodSandbox(podSandboxID string) error
// DeletePodSandbox deletes the sandbox. If there are running containers in the // RemovePodSandbox removes the sandbox. If there are running containers in the
// sandbox, they should be forcibly deleted. // sandbox, they should be forcibly removed.
DeletePodSandbox(podSandboxID string) error RemovePodSandbox(podSandboxID string) error
// PodSandboxStatus returns the Status of the PodSandbox. // PodSandboxStatus returns the Status of the PodSandbox.
PodSandboxStatus(podSandboxID string) (*runtimeApi.PodSandboxStatus, error) PodSandboxStatus(podSandboxID string) (*runtimeApi.PodSandboxStatus, error)
// ListPodSandbox returns a list of Sandbox. // ListPodSandbox returns a list of Sandbox.

View File

@ -144,11 +144,11 @@ func (r *FakeRuntimeService) StopPodSandbox(podSandboxID string) error {
return nil return nil
} }
func (r *FakeRuntimeService) DeletePodSandbox(podSandboxID string) error { func (r *FakeRuntimeService) RemovePodSandbox(podSandboxID string) error {
r.Lock() r.Lock()
defer r.Unlock() defer r.Unlock()
r.Called = append(r.Called, "DeletePodSandbox") r.Called = append(r.Called, "RemovePodSandbox")
// Remove the pod sandbox // Remove the pod sandbox
delete(r.Sandboxes, podSandboxID) delete(r.Sandboxes, podSandboxID)

View File

@ -39,8 +39,8 @@ It has these top-level messages:
CreatePodSandboxResponse CreatePodSandboxResponse
StopPodSandboxRequest StopPodSandboxRequest
StopPodSandboxResponse StopPodSandboxResponse
DeletePodSandboxRequest RemovePodSandboxRequest
DeletePodSandboxResponse RemovePodSandboxResponse
PodSandboxStatusRequest PodSandboxStatusRequest
PodSandboxNetworkStatus PodSandboxNetworkStatus
Namespace Namespace
@ -700,30 +700,30 @@ func (m *StopPodSandboxResponse) Reset() { *m = StopPodSandboxResponse{}
func (m *StopPodSandboxResponse) String() string { return proto.CompactTextString(m) } func (m *StopPodSandboxResponse) String() string { return proto.CompactTextString(m) }
func (*StopPodSandboxResponse) ProtoMessage() {} func (*StopPodSandboxResponse) ProtoMessage() {}
type DeletePodSandboxRequest struct { type RemovePodSandboxRequest struct {
// The id of the PodSandBox // The id of the PodSandBox
PodSandboxId *string `protobuf:"bytes,1,opt,name=pod_sandbox_id" json:"pod_sandbox_id,omitempty"` PodSandboxId *string `protobuf:"bytes,1,opt,name=pod_sandbox_id" json:"pod_sandbox_id,omitempty"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
} }
func (m *DeletePodSandboxRequest) Reset() { *m = DeletePodSandboxRequest{} } func (m *RemovePodSandboxRequest) Reset() { *m = RemovePodSandboxRequest{} }
func (m *DeletePodSandboxRequest) String() string { return proto.CompactTextString(m) } func (m *RemovePodSandboxRequest) String() string { return proto.CompactTextString(m) }
func (*DeletePodSandboxRequest) ProtoMessage() {} func (*RemovePodSandboxRequest) ProtoMessage() {}
func (m *DeletePodSandboxRequest) GetPodSandboxId() string { func (m *RemovePodSandboxRequest) GetPodSandboxId() string {
if m != nil && m.PodSandboxId != nil { if m != nil && m.PodSandboxId != nil {
return *m.PodSandboxId return *m.PodSandboxId
} }
return "" return ""
} }
type DeletePodSandboxResponse struct { type RemovePodSandboxResponse struct {
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
} }
func (m *DeletePodSandboxResponse) Reset() { *m = DeletePodSandboxResponse{} } func (m *RemovePodSandboxResponse) Reset() { *m = RemovePodSandboxResponse{} }
func (m *DeletePodSandboxResponse) String() string { return proto.CompactTextString(m) } func (m *RemovePodSandboxResponse) String() string { return proto.CompactTextString(m) }
func (*DeletePodSandboxResponse) ProtoMessage() {} func (*RemovePodSandboxResponse) ProtoMessage() {}
type PodSandboxStatusRequest struct { type PodSandboxStatusRequest struct {
// The id of the PodSandBox // The id of the PodSandBox
@ -2255,8 +2255,8 @@ func init() {
proto.RegisterType((*CreatePodSandboxResponse)(nil), "runtime.CreatePodSandboxResponse") proto.RegisterType((*CreatePodSandboxResponse)(nil), "runtime.CreatePodSandboxResponse")
proto.RegisterType((*StopPodSandboxRequest)(nil), "runtime.StopPodSandboxRequest") proto.RegisterType((*StopPodSandboxRequest)(nil), "runtime.StopPodSandboxRequest")
proto.RegisterType((*StopPodSandboxResponse)(nil), "runtime.StopPodSandboxResponse") proto.RegisterType((*StopPodSandboxResponse)(nil), "runtime.StopPodSandboxResponse")
proto.RegisterType((*DeletePodSandboxRequest)(nil), "runtime.DeletePodSandboxRequest") proto.RegisterType((*RemovePodSandboxRequest)(nil), "runtime.RemovePodSandboxRequest")
proto.RegisterType((*DeletePodSandboxResponse)(nil), "runtime.DeletePodSandboxResponse") proto.RegisterType((*RemovePodSandboxResponse)(nil), "runtime.RemovePodSandboxResponse")
proto.RegisterType((*PodSandboxStatusRequest)(nil), "runtime.PodSandboxStatusRequest") proto.RegisterType((*PodSandboxStatusRequest)(nil), "runtime.PodSandboxStatusRequest")
proto.RegisterType((*PodSandboxNetworkStatus)(nil), "runtime.PodSandboxNetworkStatus") proto.RegisterType((*PodSandboxNetworkStatus)(nil), "runtime.PodSandboxNetworkStatus")
proto.RegisterType((*Namespace)(nil), "runtime.Namespace") proto.RegisterType((*Namespace)(nil), "runtime.Namespace")
@ -2320,14 +2320,14 @@ type RuntimeServiceClient interface {
// CreatePodSandbox creates a pod-level sandbox. // CreatePodSandbox creates a pod-level sandbox.
// The definition of PodSandbox is at https://github.com/kubernetes/kubernetes/pull/25899 // The definition of PodSandbox is at https://github.com/kubernetes/kubernetes/pull/25899
CreatePodSandbox(ctx context.Context, in *CreatePodSandboxRequest, opts ...grpc.CallOption) (*CreatePodSandboxResponse, error) CreatePodSandbox(ctx context.Context, in *CreatePodSandboxRequest, opts ...grpc.CallOption) (*CreatePodSandboxResponse, error)
// StopPodSandbox stops the sandbox. If there are any running containers in the // StopPodSandbox stops the running sandbox. If there are any running
// sandbox, they should be force terminated. // containers in the sandbox, they should be forcibly terminated.
StopPodSandbox(ctx context.Context, in *StopPodSandboxRequest, opts ...grpc.CallOption) (*StopPodSandboxResponse, error) StopPodSandbox(ctx context.Context, in *StopPodSandboxRequest, opts ...grpc.CallOption) (*StopPodSandboxResponse, error)
// DeletePodSandbox deletes the sandbox. If there are any running containers in the // RemovePodSandbox removes the sandbox. If there are any running containers in the
// sandbox, they should be force deleted. // sandbox, they should be forcibly removed.
// It should return success if the sandbox has already been deleted. // It should return success if the sandbox has already been removed.
DeletePodSandbox(ctx context.Context, in *DeletePodSandboxRequest, opts ...grpc.CallOption) (*DeletePodSandboxResponse, error) RemovePodSandbox(ctx context.Context, in *RemovePodSandboxRequest, opts ...grpc.CallOption) (*RemovePodSandboxResponse, error)
// PodSandboxStatus returns the Status of the PodSandbox. // PodSandboxStatus returns the status of the PodSandbox.
PodSandboxStatus(ctx context.Context, in *PodSandboxStatusRequest, opts ...grpc.CallOption) (*PodSandboxStatusResponse, error) PodSandboxStatus(ctx context.Context, in *PodSandboxStatusRequest, opts ...grpc.CallOption) (*PodSandboxStatusResponse, error)
// ListPodSandbox returns a list of SandBox. // ListPodSandbox returns a list of SandBox.
ListPodSandbox(ctx context.Context, in *ListPodSandboxRequest, opts ...grpc.CallOption) (*ListPodSandboxResponse, error) ListPodSandbox(ctx context.Context, in *ListPodSandboxRequest, opts ...grpc.CallOption) (*ListPodSandboxResponse, error)
@ -2337,8 +2337,8 @@ type RuntimeServiceClient interface {
StartContainer(ctx context.Context, in *StartContainerRequest, opts ...grpc.CallOption) (*StartContainerResponse, error) StartContainer(ctx context.Context, in *StartContainerRequest, opts ...grpc.CallOption) (*StartContainerResponse, error)
// StopContainer stops a running container with a grace period (i.e., timeout). // StopContainer stops a running container with a grace period (i.e., timeout).
StopContainer(ctx context.Context, in *StopContainerRequest, opts ...grpc.CallOption) (*StopContainerResponse, error) StopContainer(ctx context.Context, in *StopContainerRequest, opts ...grpc.CallOption) (*StopContainerResponse, error)
// RemoveContainer removes the container. If the container is running, the container // RemoveContainer removes the container. If the container is running, the
// should be force removed. // container should be forcibly removed.
// It should return success if the container has already been removed. // It should return success if the container has already been removed.
RemoveContainer(ctx context.Context, in *RemoveContainerRequest, opts ...grpc.CallOption) (*RemoveContainerResponse, error) RemoveContainer(ctx context.Context, in *RemoveContainerRequest, opts ...grpc.CallOption) (*RemoveContainerResponse, error)
// ListContainers lists all containers by filters. // ListContainers lists all containers by filters.
@ -2384,9 +2384,9 @@ func (c *runtimeServiceClient) StopPodSandbox(ctx context.Context, in *StopPodSa
return out, nil return out, nil
} }
func (c *runtimeServiceClient) DeletePodSandbox(ctx context.Context, in *DeletePodSandboxRequest, opts ...grpc.CallOption) (*DeletePodSandboxResponse, error) { func (c *runtimeServiceClient) RemovePodSandbox(ctx context.Context, in *RemovePodSandboxRequest, opts ...grpc.CallOption) (*RemovePodSandboxResponse, error) {
out := new(DeletePodSandboxResponse) out := new(RemovePodSandboxResponse)
err := grpc.Invoke(ctx, "/runtime.RuntimeService/DeletePodSandbox", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/runtime.RuntimeService/RemovePodSandbox", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -2504,14 +2504,14 @@ type RuntimeServiceServer interface {
// CreatePodSandbox creates a pod-level sandbox. // CreatePodSandbox creates a pod-level sandbox.
// The definition of PodSandbox is at https://github.com/kubernetes/kubernetes/pull/25899 // The definition of PodSandbox is at https://github.com/kubernetes/kubernetes/pull/25899
CreatePodSandbox(context.Context, *CreatePodSandboxRequest) (*CreatePodSandboxResponse, error) CreatePodSandbox(context.Context, *CreatePodSandboxRequest) (*CreatePodSandboxResponse, error)
// StopPodSandbox stops the sandbox. If there are any running containers in the // StopPodSandbox stops the running sandbox. If there are any running
// sandbox, they should be force terminated. // containers in the sandbox, they should be forcibly terminated.
StopPodSandbox(context.Context, *StopPodSandboxRequest) (*StopPodSandboxResponse, error) StopPodSandbox(context.Context, *StopPodSandboxRequest) (*StopPodSandboxResponse, error)
// DeletePodSandbox deletes the sandbox. If there are any running containers in the // RemovePodSandbox removes the sandbox. If there are any running containers in the
// sandbox, they should be force deleted. // sandbox, they should be forcibly removed.
// It should return success if the sandbox has already been deleted. // It should return success if the sandbox has already been removed.
DeletePodSandbox(context.Context, *DeletePodSandboxRequest) (*DeletePodSandboxResponse, error) RemovePodSandbox(context.Context, *RemovePodSandboxRequest) (*RemovePodSandboxResponse, error)
// PodSandboxStatus returns the Status of the PodSandbox. // PodSandboxStatus returns the status of the PodSandbox.
PodSandboxStatus(context.Context, *PodSandboxStatusRequest) (*PodSandboxStatusResponse, error) PodSandboxStatus(context.Context, *PodSandboxStatusRequest) (*PodSandboxStatusResponse, error)
// ListPodSandbox returns a list of SandBox. // ListPodSandbox returns a list of SandBox.
ListPodSandbox(context.Context, *ListPodSandboxRequest) (*ListPodSandboxResponse, error) ListPodSandbox(context.Context, *ListPodSandboxRequest) (*ListPodSandboxResponse, error)
@ -2521,8 +2521,8 @@ type RuntimeServiceServer interface {
StartContainer(context.Context, *StartContainerRequest) (*StartContainerResponse, error) StartContainer(context.Context, *StartContainerRequest) (*StartContainerResponse, error)
// StopContainer stops a running container with a grace period (i.e., timeout). // StopContainer stops a running container with a grace period (i.e., timeout).
StopContainer(context.Context, *StopContainerRequest) (*StopContainerResponse, error) StopContainer(context.Context, *StopContainerRequest) (*StopContainerResponse, error)
// RemoveContainer removes the container. If the container is running, the container // RemoveContainer removes the container. If the container is running, the
// should be force removed. // container should be forcibly removed.
// It should return success if the container has already been removed. // It should return success if the container has already been removed.
RemoveContainer(context.Context, *RemoveContainerRequest) (*RemoveContainerResponse, error) RemoveContainer(context.Context, *RemoveContainerRequest) (*RemoveContainerResponse, error)
// ListContainers lists all containers by filters. // ListContainers lists all containers by filters.
@ -2573,12 +2573,12 @@ func _RuntimeService_StopPodSandbox_Handler(srv interface{}, ctx context.Context
return out, nil return out, nil
} }
func _RuntimeService_DeletePodSandbox_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { func _RuntimeService_RemovePodSandbox_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) {
in := new(DeletePodSandboxRequest) in := new(RemovePodSandboxRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
out, err := srv.(RuntimeServiceServer).DeletePodSandbox(ctx, in) out, err := srv.(RuntimeServiceServer).RemovePodSandbox(ctx, in)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -2724,8 +2724,8 @@ var _RuntimeService_serviceDesc = grpc.ServiceDesc{
Handler: _RuntimeService_StopPodSandbox_Handler, Handler: _RuntimeService_StopPodSandbox_Handler,
}, },
{ {
MethodName: "DeletePodSandbox", MethodName: "RemovePodSandbox",
Handler: _RuntimeService_DeletePodSandbox_Handler, Handler: _RuntimeService_RemovePodSandbox_Handler,
}, },
{ {
MethodName: "PodSandboxStatus", MethodName: "PodSandboxStatus",

View File

@ -1,4 +1,4 @@
// api.pb.go could be generate by hack/update-generate-runtime.sh // To regenerate api.pb.go run hack/update-generated-runtime.sh
syntax = 'proto2'; syntax = 'proto2';
package runtime; package runtime;
@ -11,14 +11,14 @@ service RuntimeService {
// CreatePodSandbox creates a pod-level sandbox. // CreatePodSandbox creates a pod-level sandbox.
// The definition of PodSandbox is at https://github.com/kubernetes/kubernetes/pull/25899 // The definition of PodSandbox is at https://github.com/kubernetes/kubernetes/pull/25899
rpc CreatePodSandbox(CreatePodSandboxRequest) returns (CreatePodSandboxResponse) {} rpc CreatePodSandbox(CreatePodSandboxRequest) returns (CreatePodSandboxResponse) {}
// StopPodSandbox stops the sandbox. If there are any running containers in the // StopPodSandbox stops the running sandbox. If there are any running
// sandbox, they should be force terminated. // containers in the sandbox, they should be forcibly terminated.
rpc StopPodSandbox(StopPodSandboxRequest) returns (StopPodSandboxResponse) {} rpc StopPodSandbox(StopPodSandboxRequest) returns (StopPodSandboxResponse) {}
// DeletePodSandbox deletes the sandbox. If there are any running containers in the // RemovePodSandbox removes the sandbox. If there are any running containers in the
// sandbox, they should be force deleted. // sandbox, they should be forcibly removed.
// It should return success if the sandbox has already been deleted. // It should return success if the sandbox has already been removed.
rpc DeletePodSandbox(DeletePodSandboxRequest) returns (DeletePodSandboxResponse) {} rpc RemovePodSandbox(RemovePodSandboxRequest) returns (RemovePodSandboxResponse) {}
// PodSandboxStatus returns the Status of the PodSandbox. // PodSandboxStatus returns the status of the PodSandbox.
rpc PodSandboxStatus(PodSandboxStatusRequest) returns (PodSandboxStatusResponse) {} rpc PodSandboxStatus(PodSandboxStatusRequest) returns (PodSandboxStatusResponse) {}
// ListPodSandbox returns a list of SandBox. // ListPodSandbox returns a list of SandBox.
rpc ListPodSandbox(ListPodSandboxRequest) returns (ListPodSandboxResponse) {} rpc ListPodSandbox(ListPodSandboxRequest) returns (ListPodSandboxResponse) {}
@ -29,8 +29,8 @@ service RuntimeService {
rpc StartContainer(StartContainerRequest) returns (StartContainerResponse) {} rpc StartContainer(StartContainerRequest) returns (StartContainerResponse) {}
// StopContainer stops a running container with a grace period (i.e., timeout). // StopContainer stops a running container with a grace period (i.e., timeout).
rpc StopContainer(StopContainerRequest) returns (StopContainerResponse) {} rpc StopContainer(StopContainerRequest) returns (StopContainerResponse) {}
// RemoveContainer removes the container. If the container is running, the container // RemoveContainer removes the container. If the container is running, the
// should be force removed. // container should be forcibly removed.
// It should return success if the container has already been removed. // It should return success if the container has already been removed.
rpc RemoveContainer(RemoveContainerRequest) returns (RemoveContainerResponse) {} rpc RemoveContainer(RemoveContainerRequest) returns (RemoveContainerResponse) {}
// ListContainers lists all containers by filters. // ListContainers lists all containers by filters.
@ -214,12 +214,12 @@ message StopPodSandboxRequest {
message StopPodSandboxResponse {} message StopPodSandboxResponse {}
message DeletePodSandboxRequest { message RemovePodSandboxRequest {
// The id of the PodSandBox // The id of the PodSandBox
optional string pod_sandbox_id = 1; optional string pod_sandbox_id = 1;
} }
message DeletePodSandboxResponse {} message RemovePodSandboxResponse {}
message PodSandboxStatusRequest { message PodSandboxStatusRequest {
// The id of the PodSandBox // The id of the PodSandBox

View File

@ -72,9 +72,9 @@ func (ds *dockerService) StopPodSandbox(podSandboxID string) error {
// TODO: Stop all running containers in the sandbox. // TODO: Stop all running containers in the sandbox.
} }
// DeletePodSandbox deletes the sandbox. If there are running containers in the // RemovePodSandbox removes the sandbox. If there are running containers in the
// sandbox, they should be forcibly deleted. // sandbox, they should be forcibly removed.
func (ds *dockerService) DeletePodSandbox(podSandboxID string) error { func (ds *dockerService) RemovePodSandbox(podSandboxID string) error {
return ds.client.RemoveContainer(podSandboxID, dockertypes.ContainerRemoveOptions{RemoveVolumes: true}) return ds.client.RemoveContainer(podSandboxID, dockertypes.ContainerRemoveOptions{RemoveVolumes: true})
// TODO: remove all containers in the sandbox. // TODO: remove all containers in the sandbox.
} }

View File

@ -97,17 +97,17 @@ func (r *RemoteRuntimeService) StopPodSandbox(podSandBoxID string) error {
return nil return nil
} }
// DeletePodSandbox deletes the sandbox. If there are any containers in the // RemovePodSandbox removes the sandbox. If there are any containers in the
// sandbox, they should be forced to deletion. // sandbox, they should be forcibly removed.
func (r *RemoteRuntimeService) DeletePodSandbox(podSandBoxID string) error { func (r *RemoteRuntimeService) RemovePodSandbox(podSandBoxID string) error {
ctx, cancel := getContextWithTimeout(r.timeout) ctx, cancel := getContextWithTimeout(r.timeout)
defer cancel() defer cancel()
_, err := r.runtimeClient.DeletePodSandbox(ctx, &runtimeApi.DeletePodSandboxRequest{ _, err := r.runtimeClient.RemovePodSandbox(ctx, &runtimeApi.RemovePodSandboxRequest{
PodSandboxId: &podSandBoxID, PodSandboxId: &podSandBoxID,
}) })
if err != nil { if err != nil {
glog.Errorf("DeletePodSandbox %q from runtime service failed: %v", podSandBoxID, err) glog.Errorf("RemovePodSandbox %q from runtime service failed: %v", podSandBoxID, err)
return err return err
} }