only handled non host network pods for hostports in kubenet

This commit is contained in:
Minhan Xia 2016-06-09 11:32:16 -07:00
parent 3d332a047b
commit 1b2386f1ce

View File

@ -584,7 +584,8 @@ func (plugin *kubenetNetworkPlugin) gatherAllHostports() (map[api.ContainerPort]
}
// Need the complete api.Pod object
pod, ok := plugin.host.GetPodByName(p.Namespace, p.Name)
if ok {
// kubenet should not handle hostports for hostnetwork pods
if ok && !pod.Spec.SecurityContext.HostNetwork {
for _, container := range pod.Spec.Containers {
for _, port := range container.Ports {
if port.HostPort != 0 {