server: Hookup kubelet hostport
Signed-off-by: Andrew Pilloud <andrewpilloud@igneoussystems.com>
This commit is contained in:
parent
91ea67a8ff
commit
28cd8bde49
4 changed files with 60 additions and 0 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
"golang.org/x/net/context"
|
||||
"golang.org/x/sys/unix"
|
||||
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
|
||||
"k8s.io/kubernetes/pkg/kubelet/network/hostport"
|
||||
)
|
||||
|
||||
// StopPodSandbox stops the sandbox. If there are any running containers in the
|
||||
|
@ -40,6 +41,15 @@ func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxReque
|
|||
return nil, err
|
||||
}
|
||||
if _, err := os.Stat(netnsPath); err == nil {
|
||||
if err2 := s.hostportManager.Remove(sb.id, &hostport.PodPortMapping{
|
||||
Name: sb.name,
|
||||
PortMappings: sb.portMappings,
|
||||
HostNetwork: false,
|
||||
}); err2 != nil {
|
||||
logrus.Warnf("failed to remove hostport for container %s in sandbox %s: %v",
|
||||
podInfraContainer.Name(), sb.id, err2)
|
||||
}
|
||||
|
||||
if err2 := s.netPlugin.TearDownPod(netnsPath, sb.namespace, sb.kubeName, sb.id); err2 != nil {
|
||||
logrus.Warnf("failed to destroy network for container %s in sandbox %s: %v",
|
||||
podInfraContainer.Name(), sb.id, err2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue