mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-20 01:01:22 +00:00
Merge pull request #47521 from squeed/release-1.7
Automatic merge from submit-queue (batch tested with PRs 47510, 47516, 47482, 47521, 47537) cni: Don't try and map ports with an unset HostPort The CNI Host function GetPodPortMappings also includes unmapped ports (this is apparently by design). This is normal, and the CNI network plugin invoker should not attempt to map these ports. This matches the functionality in the kubenet hostport mapper. Fixes: #47529
This commit is contained in:
commit
877308bbe5
@ -339,6 +339,9 @@ func (plugin *cniNetworkPlugin) buildCNIRuntimeConf(podName string, podNs string
|
|||||||
}
|
}
|
||||||
portMappingsParam := make([]cniPortMapping, 0, len(portMappings))
|
portMappingsParam := make([]cniPortMapping, 0, len(portMappings))
|
||||||
for _, p := range portMappings {
|
for _, p := range portMappings {
|
||||||
|
if p.HostPort <= 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
portMappingsParam = append(portMappingsParam, cniPortMapping{
|
portMappingsParam = append(portMappingsParam, cniPortMapping{
|
||||||
HostPort: p.HostPort,
|
HostPort: p.HostPort,
|
||||||
ContainerPort: p.ContainerPort,
|
ContainerPort: p.ContainerPort,
|
||||||
|
Loading…
Reference in New Issue
Block a user