server/sandbox: consistently use kubeName, not containerName
Plugins expect the Kubernetes container name, not the unique contianer name generated by CNI. For plugins, the uniqueness is provided by the container ID instead. Signed-off-by: Dan Williams <dcbw@redhat.com>
This commit is contained in:
parent
aa2804b7a6
commit
b58832f2b1
2 changed files with 3 additions and 3 deletions
|
@ -472,7 +472,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
|||
}
|
||||
|
||||
if len(portMappings) != 0 {
|
||||
ip, err := s.netPlugin.GetContainerNetworkStatus(netNsPath, namespace, id, containerName)
|
||||
ip, err := s.netPlugin.GetContainerNetworkStatus(netNsPath, namespace, id, kubeName)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get network status for container %s in sandbox %s: %v", containerName, id, err)
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
|||
}
|
||||
|
||||
if err = s.hostportManager.Add(id, &hostport.PodPortMapping{
|
||||
Name: name,
|
||||
Name: kubeName,
|
||||
PortMappings: portMappings,
|
||||
IP: ip4,
|
||||
HostNetwork: false,
|
||||
|
|
|
@ -51,7 +51,7 @@ func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxReque
|
|||
}
|
||||
if _, err := os.Stat(netnsPath); err == nil {
|
||||
if err2 := s.hostportManager.Remove(sb.ID(), &hostport.PodPortMapping{
|
||||
Name: sb.Name(),
|
||||
Name: sb.KubeName(),
|
||||
PortMappings: sb.PortMappings(),
|
||||
HostNetwork: false,
|
||||
}); err2 != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue