cni: Don't try and map ports with an unset HostPort

pull/6/head
Casey Callendrello 2017-06-14 16:11:19 +02:00
parent 16640d892f
commit 14ad62b924
1 changed files with 3 additions and 0 deletions

View File

@ -339,6 +339,9 @@ func (plugin *cniNetworkPlugin) buildCNIRuntimeConf(podName string, podNs string
}
portMappingsParam := make([]cniPortMapping, 0, len(portMappings))
for _, p := range portMappings {
if p.HostPort <= 0 {
continue
}
portMappingsParam = append(portMappingsParam, cniPortMapping{
HostPort: p.HostPort,
ContainerPort: p.ContainerPort,