Add support for host:port:port
This adds support for supplying for example: "127.0.0.1:80:80/tcp" to docker-compose.yaml and converting it to it's corresponding Kubernetes / OpenShift hostIP. This commit also refactors the loadPorts function of compose.go Closes https://github.com/kubernetes-incubator/kompose/issues/335
This commit is contained in:
@@ -285,13 +285,16 @@ func (k *Kubernetes) ConfigPorts(name string, service kobject.ServiceConfig) []a
|
||||
if port.Protocol == api.ProtocolTCP {
|
||||
ports = append(ports, api.ContainerPort{
|
||||
ContainerPort: port.ContainerPort,
|
||||
HostIP: port.HostIP,
|
||||
})
|
||||
} else {
|
||||
ports = append(ports, api.ContainerPort{
|
||||
ContainerPort: port.ContainerPort,
|
||||
Protocol: port.Protocol,
|
||||
HostIP: port.HostIP,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ports
|
||||
@@ -304,6 +307,7 @@ func (k *Kubernetes) ConfigServicePorts(name string, service kobject.ServiceConf
|
||||
if port.HostPort == 0 {
|
||||
port.HostPort = port.ContainerPort
|
||||
}
|
||||
|
||||
var targetPort intstr.IntOrString
|
||||
targetPort.IntVal = port.ContainerPort
|
||||
targetPort.StrVal = strconv.Itoa(int(port.ContainerPort))
|
||||
|
||||
Reference in New Issue
Block a user