mirror of https://github.com/k3s-io/k3s
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: #27118pull/6/head
commit
805a0aae71
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue