Support assign nodeport port in labels (#1210)

This commit is contained in:
Hang Yan
2019-12-26 23:45:58 +08:00
committed by GitHub
parent 81bdf77d49
commit 1f0a097836
10 changed files with 325 additions and 0 deletions
+5
View File
@@ -525,6 +525,11 @@ func (k *Kubernetes) ConfigServicePorts(name string, service kobject.ServiceConf
Port: port.HostPort,
TargetPort: targetPort,
}
if service.ServiceType == string(api.ServiceTypeNodePort) && service.NodePortPort != 0 {
servicePort.NodePort = service.NodePortPort
}
// If the default is already TCP, no need to include it.
if port.Protocol != api.ProtocolTCP {
servicePort.Protocol = port.Protocol