Clarify the resource remove logic in runtime API

If the resource in the delete call does not exist, the runtime should
not return an error. This eliminates the need for kubelet to define a
resource "not found" error that every runtime has to return.
This commit is contained in:
Pengfei Ni 2016-07-29 10:10:08 +08:00
parent 306678f941
commit cce9405e15
2 changed files with 9 additions and 0 deletions

View File

@ -2325,6 +2325,7 @@ type RuntimeServiceClient interface {
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 // DeletePodSandbox deletes the sandbox. If there are any running containers in the
// sandbox, they should be force deleted. // sandbox, they should be force deleted.
// It should return success if the sandbox has already been deleted.
DeletePodSandbox(ctx context.Context, in *DeletePodSandboxRequest, opts ...grpc.CallOption) (*DeletePodSandboxResponse, error) DeletePodSandbox(ctx context.Context, in *DeletePodSandboxRequest, opts ...grpc.CallOption) (*DeletePodSandboxResponse, 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)
@ -2338,6 +2339,7 @@ type RuntimeServiceClient interface {
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 container
// should be force removed. // should be force 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.
ListContainers(ctx context.Context, in *ListContainersRequest, opts ...grpc.CallOption) (*ListContainersResponse, error) ListContainers(ctx context.Context, in *ListContainersRequest, opts ...grpc.CallOption) (*ListContainersResponse, error)
@ -2507,6 +2509,7 @@ type RuntimeServiceServer interface {
StopPodSandbox(context.Context, *StopPodSandboxRequest) (*StopPodSandboxResponse, error) StopPodSandbox(context.Context, *StopPodSandboxRequest) (*StopPodSandboxResponse, error)
// DeletePodSandbox deletes the sandbox. If there are any running containers in the // DeletePodSandbox deletes the sandbox. If there are any running containers in the
// sandbox, they should be force deleted. // sandbox, they should be force deleted.
// It should return success if the sandbox has already been deleted.
DeletePodSandbox(context.Context, *DeletePodSandboxRequest) (*DeletePodSandboxResponse, error) DeletePodSandbox(context.Context, *DeletePodSandboxRequest) (*DeletePodSandboxResponse, 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)
@ -2520,6 +2523,7 @@ type RuntimeServiceServer interface {
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 container
// should be force removed. // should be force 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.
ListContainers(context.Context, *ListContainersRequest) (*ListContainersResponse, error) ListContainers(context.Context, *ListContainersRequest) (*ListContainersResponse, error)
@ -2776,6 +2780,7 @@ type ImageServiceClient interface {
// PullImage pulls a image with authentication config. // PullImage pulls a image with authentication config.
PullImage(ctx context.Context, in *PullImageRequest, opts ...grpc.CallOption) (*PullImageResponse, error) PullImage(ctx context.Context, in *PullImageRequest, opts ...grpc.CallOption) (*PullImageResponse, error)
// RemoveImage removes the image. // RemoveImage removes the image.
// It should return success if the image has already been removed.
RemoveImage(ctx context.Context, in *RemoveImageRequest, opts ...grpc.CallOption) (*RemoveImageResponse, error) RemoveImage(ctx context.Context, in *RemoveImageRequest, opts ...grpc.CallOption) (*RemoveImageResponse, error)
} }
@ -2833,6 +2838,7 @@ type ImageServiceServer interface {
// PullImage pulls a image with authentication config. // PullImage pulls a image with authentication config.
PullImage(context.Context, *PullImageRequest) (*PullImageResponse, error) PullImage(context.Context, *PullImageRequest) (*PullImageResponse, error)
// RemoveImage removes the image. // RemoveImage removes the image.
// It should return success if the image has already been removed.
RemoveImage(context.Context, *RemoveImageRequest) (*RemoveImageResponse, error) RemoveImage(context.Context, *RemoveImageRequest) (*RemoveImageResponse, error)
} }

View File

@ -16,6 +16,7 @@ service RuntimeService {
rpc StopPodSandbox(StopPodSandboxRequest) returns (StopPodSandboxResponse) {} rpc StopPodSandbox(StopPodSandboxRequest) returns (StopPodSandboxResponse) {}
// DeletePodSandbox deletes the sandbox. If there are any running containers in the // DeletePodSandbox deletes the sandbox. If there are any running containers in the
// sandbox, they should be force deleted. // sandbox, they should be force deleted.
// It should return success if the sandbox has already been deleted.
rpc DeletePodSandbox(DeletePodSandboxRequest) returns (DeletePodSandboxResponse) {} rpc DeletePodSandbox(DeletePodSandboxRequest) returns (DeletePodSandboxResponse) {}
// PodSandboxStatus returns the Status of the PodSandbox. // PodSandboxStatus returns the Status of the PodSandbox.
rpc PodSandboxStatus(PodSandboxStatusRequest) returns (PodSandboxStatusResponse) {} rpc PodSandboxStatus(PodSandboxStatusRequest) returns (PodSandboxStatusResponse) {}
@ -30,6 +31,7 @@ service RuntimeService {
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 container
// should be force removed. // should be force 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.
rpc ListContainers(ListContainersRequest) returns (ListContainersResponse) {} rpc ListContainers(ListContainersRequest) returns (ListContainersResponse) {}
@ -49,6 +51,7 @@ service ImageService {
// PullImage pulls a image with authentication config. // PullImage pulls a image with authentication config.
rpc PullImage(PullImageRequest) returns (PullImageResponse) {} rpc PullImage(PullImageRequest) returns (PullImageResponse) {}
// RemoveImage removes the image. // RemoveImage removes the image.
// It should return success if the image has already been removed.
rpc RemoveImage(RemoveImageRequest) returns (RemoveImageResponse) {} rpc RemoveImage(RemoveImageRequest) returns (RemoveImageResponse) {}
} }