sandbox: pass correct pod Namespace/Name to network plugins and fix id/name ordering
Two issues: 1) pod Namespace was always set to "", which prevents plugins from figuring out what the actual pod is, and from getting more info about that pod from the runtime via out-of-band mechanisms 2) the pod Name and ID arguments were switched, further preventing #1 Signed-off-by: Dan Williams <dcbw@redhat.com>
This commit is contained in:
parent
cf0afef675
commit
13f6e95685
8 changed files with 93 additions and 18 deletions
|
@ -19,20 +19,19 @@ func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxReque
|
|||
return nil, err
|
||||
}
|
||||
|
||||
podNamespace := ""
|
||||
podInfraContainer := sb.infraContainer
|
||||
netnsPath, err := podInfraContainer.NetNsPath()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, err := os.Stat(netnsPath); err == nil {
|
||||
if err2 := s.netPlugin.TearDownPod(netnsPath, podNamespace, sb.id, podInfraContainer.Name()); err2 != nil {
|
||||
if err2 := s.netPlugin.TearDownPod(netnsPath, sb.namespace, sb.kubeName, sb.id); err2 != nil {
|
||||
return nil, fmt.Errorf("failed to destroy network for container %s in sandbox %s: %v",
|
||||
podInfraContainer.Name(), sb.id, err2)
|
||||
}
|
||||
} else if !os.IsNotExist(err) { // it's ok for netnsPath to *not* exist
|
||||
return nil, fmt.Errorf("failed to stat netns path for container %s in sandbox %s before tearing down the network: %v",
|
||||
podInfraContainer.Name(), sb.id, err)
|
||||
sb.name, sb.id, err)
|
||||
}
|
||||
|
||||
// Close the sandbox networking namespace.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue