[hyper-provider] fix for HostPort is 0

This commit is contained in:
Jimmy Xu
2017-12-18 17:14:39 +08:00
parent b870ac2eaa
commit e588029086

4
providers/hypersh/hypersh.go Normal file → Executable file
View File

@@ -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)