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

Merge pull request #31576 from feiskyer/kuberuntime-filter

Automatic merge from submit-queue Kubelet: remove name filter from CRI Since #30753 and #30463, `name` is not used to identify the container/sandbox, so remove it from CRI. cc @yujuhong @kubernetes/sig-node @kubernetes/sig-rktnetes
parents c4893df8 4d85e485
...@@ -188,9 +188,6 @@ func (r *FakeRuntimeService) ListPodSandbox(filter *runtimeApi.PodSandboxFilter) ...@@ -188,9 +188,6 @@ func (r *FakeRuntimeService) ListPodSandbox(filter *runtimeApi.PodSandboxFilter)
if filter.Id != nil && filter.GetId() != id { if filter.Id != nil && filter.GetId() != id {
continue continue
} }
if filter.Name != nil && filter.GetName() != s.Metadata.GetName() {
continue
}
if filter.State != nil && filter.GetState() != s.GetState() { if filter.State != nil && filter.GetState() != s.GetState() {
continue continue
} }
...@@ -304,9 +301,6 @@ func (r *FakeRuntimeService) ListContainers(filter *runtimeApi.ContainerFilter) ...@@ -304,9 +301,6 @@ func (r *FakeRuntimeService) ListContainers(filter *runtimeApi.ContainerFilter)
if filter.Id != nil && filter.GetId() != s.GetId() { if filter.Id != nil && filter.GetId() != s.GetId() {
continue continue
} }
if filter.Name != nil && filter.GetName() != s.Metadata.GetName() {
continue
}
if filter.PodSandboxId != nil && filter.GetPodSandboxId() != s.SandboxID { if filter.PodSandboxId != nil && filter.GetPodSandboxId() != s.SandboxID {
continue continue
} }
......
...@@ -271,16 +271,14 @@ message PodSandboxStatusResponse { ...@@ -271,16 +271,14 @@ message PodSandboxStatusResponse {
// PodSandboxFilter is used to filter a list of PodSandboxes. // PodSandboxFilter is used to filter a list of PodSandboxes.
// All those fields are combined with 'AND' // All those fields are combined with 'AND'
message PodSandboxFilter { message PodSandboxFilter {
// Name of the sandbox.
optional string name = 1;
// ID of the sandbox. // ID of the sandbox.
optional string id = 2; optional string id = 1;
// State of the sandbox. // State of the sandbox.
optional PodSandBoxState state = 3; optional PodSandBoxState state = 2;
// LabelSelector to select matches. // LabelSelector to select matches.
// Only api.MatchLabels is supported for now and the requirements // Only api.MatchLabels is supported for now and the requirements
// are ANDed. MatchExpressions is not supported yet. // are ANDed. MatchExpressions is not supported yet.
map<string, string> label_selector = 4; map<string, string> label_selector = 3;
} }
message ListPodSandboxRequest { message ListPodSandboxRequest {
...@@ -495,18 +493,16 @@ enum ContainerState { ...@@ -495,18 +493,16 @@ enum ContainerState {
// ContainerFilter is used to filter containers. // ContainerFilter is used to filter containers.
// All those fields are combined with 'AND' // All those fields are combined with 'AND'
message ContainerFilter { message ContainerFilter {
// Name of the container.
optional string name = 1;
// ID of the container. // ID of the container.
optional string id = 2; optional string id = 1;
// State of the container. // State of the container.
optional ContainerState state = 3; optional ContainerState state = 2;
// The id of the pod sandbox // The id of the pod sandbox
optional string pod_sandbox_id = 4; optional string pod_sandbox_id = 3;
// LabelSelector to select matches. // LabelSelector to select matches.
// Only api.MatchLabels is supported for now and the requirements // Only api.MatchLabels is supported for now and the requirements
// are ANDed. MatchExpressions is not supported yet. // are ANDed. MatchExpressions is not supported yet.
map<string, string> label_selector = 5; map<string, string> label_selector = 4;
} }
message ListContainersRequest { message ListContainersRequest {
......
...@@ -71,11 +71,7 @@ func (ds *dockerService) ListContainers(filter *runtimeApi.ContainerFilter) ([]* ...@@ -71,11 +71,7 @@ func (ds *dockerService) ListContainers(filter *runtimeApi.ContainerFilter) ([]*
glog.V(5).Infof("Unable to convert docker to runtime API container: %v", err) glog.V(5).Infof("Unable to convert docker to runtime API container: %v", err)
continue continue
} }
if len(filter.GetName()) != 0 && converted.Metadata.GetName() != filter.GetName() {
// TODO: Remove "name" from the ContainerFilter because name can no
// longer be used to identify a container.
continue
}
result = append(result, converted) result = append(result, converted)
} }
return result, nil return result, nil
......
...@@ -180,17 +180,11 @@ func (ds *dockerService) ListPodSandbox(filter *runtimeApi.PodSandboxFilter) ([] ...@@ -180,17 +180,11 @@ func (ds *dockerService) ListPodSandbox(filter *runtimeApi.PodSandboxFilter) ([]
result := []*runtimeApi.PodSandbox{} result := []*runtimeApi.PodSandbox{}
for i := range containers { for i := range containers {
c := containers[i] c := containers[i]
converted, err := toRuntimeAPISandbox(&c) converted, err := toRuntimeAPISandbox(&c)
if err != nil { if err != nil {
glog.V(5).Infof("Unable to convert docker to runtime API sandbox: %v", err) glog.V(5).Infof("Unable to convert docker to runtime API sandbox: %v", err)
continue continue
} }
if len(filter.GetName()) > 0 && converted.Metadata.GetName() != filter.GetName() {
// TODO: Remove "name" from the SandboxFilter because name can no
// longer be used to identify a container.
continue
}
if filterOutReadySandboxes && converted.GetState() == runtimeApi.PodSandBoxState_READY { if filterOutReadySandboxes && converted.GetState() == runtimeApi.PodSandBoxState_READY {
continue continue
} }
......
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