Commit 805a0aae authored by k8s-merge-robot's avatar k8s-merge-robot Committed by GitHub

Merge pull request #27141 from freehan/hpfix

Automatic merge from submit-queue only handled non host network pods for hostports in kubenet attempt to fix: #27118
parents 1cfa84c1 1b2386f1
...@@ -613,7 +613,8 @@ func (plugin *kubenetNetworkPlugin) gatherAllHostports() (map[api.ContainerPort] ...@@ -613,7 +613,8 @@ func (plugin *kubenetNetworkPlugin) gatherAllHostports() (map[api.ContainerPort]
} }
// Need the complete api.Pod object // Need the complete api.Pod object
pod, ok := plugin.host.GetPodByName(p.Namespace, p.Name) 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 _, container := range pod.Spec.Containers {
for _, port := range container.Ports { for _, port := range container.Ports {
if port.HostPort != 0 { if port.HostPort != 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment