func (plugin *cniNetworkPlugin) TearDownPod(namespace string, name string, id kubeletTypes.DockerID) error { runtime, ok := plugin.host.GetRuntime().(*dockertools.DockerManager) if !ok { return fmt.Errorf("CNI execution called on non-docker runtime") } netns, err := runtime.GetNetNs(id.ContainerID()) if err != nil { return err } return plugin.defaultNetwork.deleteFromNetwork(name, namespace, id.ContainerID(), netns) }
func (plugin *cniNetworkPlugin) SetUpPod(namespace string, name string, id kubeletTypes.DockerID) error { runtime, ok := plugin.host.GetRuntime().(*dockertools.DockerManager) if !ok { return fmt.Errorf("CNI execution called on non-docker runtime") } netns, err := runtime.GetNetNs(id.ContainerID()) if err != nil { return err } _, err = plugin.defaultNetwork.addToNetwork(name, namespace, id.ContainerID(), netns) if err != nil { glog.Errorf("Error while adding to cni network: %s", err) return err } return err }