From cce9405e15863400a19d378395cd03c3a1bb505d Mon Sep 17 00:00:00 2001 From: Pengfei Ni Date: Fri, 29 Jul 2016 10:10:08 +0800 Subject: [PATCH] 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. --- pkg/kubelet/api/v1alpha1/runtime/api.pb.go | 6 ++++++ pkg/kubelet/api/v1alpha1/runtime/api.proto | 3 +++ 2 files changed, 9 insertions(+) diff --git a/pkg/kubelet/api/v1alpha1/runtime/api.pb.go b/pkg/kubelet/api/v1alpha1/runtime/api.pb.go index 0b9a3746ba9..0bf67cd9752 100644 --- a/pkg/kubelet/api/v1alpha1/runtime/api.pb.go +++ b/pkg/kubelet/api/v1alpha1/runtime/api.pb.go @@ -2325,6 +2325,7 @@ type RuntimeServiceClient interface { StopPodSandbox(ctx context.Context, in *StopPodSandboxRequest, opts ...grpc.CallOption) (*StopPodSandboxResponse, error) // DeletePodSandbox deletes the sandbox. If there are any running containers in the // 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) // PodSandboxStatus returns the Status of the PodSandbox. 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) // RemoveContainer removes the container. If the container is running, the container // 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) // ListContainers lists all containers by filters. ListContainers(ctx context.Context, in *ListContainersRequest, opts ...grpc.CallOption) (*ListContainersResponse, error) @@ -2507,6 +2509,7 @@ type RuntimeServiceServer interface { StopPodSandbox(context.Context, *StopPodSandboxRequest) (*StopPodSandboxResponse, error) // DeletePodSandbox deletes the sandbox. If there are any running containers in the // sandbox, they should be force deleted. + // It should return success if the sandbox has already been deleted. DeletePodSandbox(context.Context, *DeletePodSandboxRequest) (*DeletePodSandboxResponse, error) // PodSandboxStatus returns the Status of the PodSandbox. PodSandboxStatus(context.Context, *PodSandboxStatusRequest) (*PodSandboxStatusResponse, error) @@ -2520,6 +2523,7 @@ type RuntimeServiceServer interface { StopContainer(context.Context, *StopContainerRequest) (*StopContainerResponse, error) // RemoveContainer removes the container. If the container is running, the container // should be force removed. + // It should return success if the container has already been removed. RemoveContainer(context.Context, *RemoveContainerRequest) (*RemoveContainerResponse, error) // ListContainers lists all containers by filters. ListContainers(context.Context, *ListContainersRequest) (*ListContainersResponse, error) @@ -2776,6 +2780,7 @@ type ImageServiceClient interface { // PullImage pulls a image with authentication config. PullImage(ctx context.Context, in *PullImageRequest, opts ...grpc.CallOption) (*PullImageResponse, error) // 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) } @@ -2833,6 +2838,7 @@ type ImageServiceServer interface { // PullImage pulls a image with authentication config. PullImage(context.Context, *PullImageRequest) (*PullImageResponse, error) // RemoveImage removes the image. + // It should return success if the image has already been removed. RemoveImage(context.Context, *RemoveImageRequest) (*RemoveImageResponse, error) } diff --git a/pkg/kubelet/api/v1alpha1/runtime/api.proto b/pkg/kubelet/api/v1alpha1/runtime/api.proto index 965f362a49e..82b751dd270 100644 --- a/pkg/kubelet/api/v1alpha1/runtime/api.proto +++ b/pkg/kubelet/api/v1alpha1/runtime/api.proto @@ -16,6 +16,7 @@ service RuntimeService { rpc StopPodSandbox(StopPodSandboxRequest) returns (StopPodSandboxResponse) {} // DeletePodSandbox deletes the sandbox. If there are any running containers in the // sandbox, they should be force deleted. + // It should return success if the sandbox has already been deleted. rpc DeletePodSandbox(DeletePodSandboxRequest) returns (DeletePodSandboxResponse) {} // PodSandboxStatus returns the Status of the PodSandbox. rpc PodSandboxStatus(PodSandboxStatusRequest) returns (PodSandboxStatusResponse) {} @@ -30,6 +31,7 @@ service RuntimeService { rpc StopContainer(StopContainerRequest) returns (StopContainerResponse) {} // RemoveContainer removes the container. If the container is running, the container // should be force removed. + // It should return success if the container has already been removed. rpc RemoveContainer(RemoveContainerRequest) returns (RemoveContainerResponse) {} // ListContainers lists all containers by filters. rpc ListContainers(ListContainersRequest) returns (ListContainersResponse) {} @@ -49,6 +51,7 @@ service ImageService { // PullImage pulls a image with authentication config. rpc PullImage(PullImageRequest) returns (PullImageResponse) {} // RemoveImage removes the image. + // It should return success if the image has already been removed. rpc RemoveImage(RemoveImageRequest) returns (RemoveImageResponse) {} }