kuberuntime: remove unused GetNs code
This commit is contained in:
		| @@ -894,36 +894,11 @@ func (m *kubeGenericRuntimeManager) GetPodStatus(uid kubetypes.UID, name, namesp | |||||||
| 	}, nil | 	}, nil | ||||||
| } | } | ||||||
|  |  | ||||||
| // Returns the filesystem path of the pod's network namespace; if the | // Returns the filesystem path of the pod's network namespace. | ||||||
| // runtime does not handle namespace creation itself, or cannot return | // | ||||||
| // the network namespace path, it returns an 'not supported' error. | // For CRI, container network is handled by the runtime completely and this | ||||||
| // TODO: Rename param name to sandboxID in kubecontainer.Runtime.GetNetNS(). | // function should never be called. | ||||||
| // TODO: Remove GetNetNS after networking is delegated to the container runtime. | func (m *kubeGenericRuntimeManager) GetNetNS(_ kubecontainer.ContainerID) (string, error) { | ||||||
| func (m *kubeGenericRuntimeManager) GetNetNS(sandboxID kubecontainer.ContainerID) (string, error) { |  | ||||||
| 	filter := &runtimeApi.PodSandboxFilter{ |  | ||||||
| 		Id:            &sandboxID.ID, |  | ||||||
| 		LabelSelector: map[string]string{kubernetesManagedLabel: "true"}, |  | ||||||
| 	} |  | ||||||
| 	sandboxes, err := m.runtimeService.ListPodSandbox(filter) |  | ||||||
| 	if err != nil { |  | ||||||
| 		glog.Errorf("ListPodSandbox with filter %q failed: %v", filter, err) |  | ||||||
| 		return "", err |  | ||||||
| 	} |  | ||||||
| 	if len(sandboxes) == 0 { |  | ||||||
| 		glog.Errorf("No sandbox is found with filter %q", filter) |  | ||||||
| 		return "", fmt.Errorf("Sandbox %q is not found", sandboxID) |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	sandboxStatus, err := m.runtimeService.PodSandboxStatus(sandboxes[0].GetId()) |  | ||||||
| 	if err != nil { |  | ||||||
| 		glog.Errorf("PodSandboxStatus with id %q failed: %v", sandboxes[0].GetId(), err) |  | ||||||
| 		return "", err |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if sandboxStatus.Linux != nil && sandboxStatus.Linux.Namespaces != nil { |  | ||||||
| 		return sandboxStatus.Linux.Namespaces.GetNetwork(), nil |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return "", fmt.Errorf("not supported") | 	return "", fmt.Errorf("not supported") | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Yu-Ju Hong
					Yu-Ju Hong