From e58802908616e7aace6da81ae7ebfe965c773e92 Mon Sep 17 00:00:00 2001 From: Jimmy Xu Date: Mon, 18 Dec 2017 17:14:39 +0800 Subject: [PATCH] [hyper-provider] fix for HostPort is 0 --- providers/hypersh/hypersh.go | 4 ++++ 1 file changed, 4 insertions(+) mode change 100644 => 100755 providers/hypersh/hypersh.go diff --git a/providers/hypersh/hypersh.go b/providers/hypersh/hypersh.go old mode 100644 new mode 100755 index 15007fa8a..f9c99ff36 --- a/providers/hypersh/hypersh.go +++ b/providers/hypersh/hypersh.go @@ -285,6 +285,10 @@ func getContainers(pod *v1.Pod) ([]container.Config, []container.HostConfig, err ports := map[nat.Port]struct{}{} portBindings := nat.PortMap{} for _, p := range ctr.Ports { + //TODO: p.HostPort is 0 by default, but it's invalid in hyper.sh + if p.HostPort == 0 { + p.HostPort = p.ContainerPort + } port, err := nat.NewPort(string(p.Protocol), fmt.Sprintf("%d", p.HostPort)) if err != nil { return nil, nil, fmt.Errorf("creating new port in container conversion failed: %v", err)