server: port to github.com/cri-o/ocicni; remove pkg/ocicni
Signed-off-by: Dan Williams <dcbw@redhat.com>
This commit is contained in:
parent
3db6ba7667
commit
0df30c5319
12 changed files with 28 additions and 619 deletions
|
@ -464,27 +464,28 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
|||
var ip string
|
||||
// setup the network
|
||||
if !hostNetwork {
|
||||
if err = s.netPlugin.SetUpPod(netNsPath, namespace, kubeName, id); err != nil {
|
||||
return nil, fmt.Errorf("failed to create network for container %s in sandbox %s: %v", containerName, id, err)
|
||||
podNetwork := newPodNetwork(sb.Namespace(), sb.KubeName(), sb.ID(), netNsPath)
|
||||
if err = s.netPlugin.SetUpPod(podNetwork); err != nil {
|
||||
return nil, fmt.Errorf("failed to create pod network sandbox %s(%s): %v", sb.Name(), id, err)
|
||||
}
|
||||
|
||||
if ip, err = s.netPlugin.GetContainerNetworkStatus(netNsPath, namespace, id, kubeName); err != nil {
|
||||
return nil, fmt.Errorf("failed to get network status for container %s in sandbox %s: %v", containerName, id, err)
|
||||
if ip, err = s.netPlugin.GetPodNetworkStatus(podNetwork); err != nil {
|
||||
return nil, fmt.Errorf("failed to get network status for pod sandbox %s(%s): %v", sb.Name(), id, err)
|
||||
}
|
||||
|
||||
if len(portMappings) != 0 {
|
||||
ip4 := net.ParseIP(ip).To4()
|
||||
if ip4 == nil {
|
||||
return nil, fmt.Errorf("failed to get valid ipv4 address for container %s in sandbox %s", containerName, id)
|
||||
return nil, fmt.Errorf("failed to get valid ipv4 address for sandbox %s(%s)", sb.Name(), id)
|
||||
}
|
||||
|
||||
if err = s.hostportManager.Add(id, &hostport.PodPortMapping{
|
||||
Name: name,
|
||||
Name: sb.Name(),
|
||||
PortMappings: portMappings,
|
||||
IP: ip4,
|
||||
HostNetwork: false,
|
||||
}, "lo"); err != nil {
|
||||
return nil, fmt.Errorf("failed to add hostport mapping for container %s in sandbox %s: %v", containerName, id, err)
|
||||
return nil, fmt.Errorf("failed to add hostport mapping for sandbox %s(%s): %v", sb.Name(), id, err)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue