Skip to content

Commit

Permalink
Only include ports in one container in Kube YAML
Browse files Browse the repository at this point in the history
This likely broke when we made containers able to detect that
they shared a network namespace and grab ports from the
dependency container - prior to that, we could grab ports without
concern for conflict, only the infra container had them. Now, all
containers in a pod will return the same ports, so we have to
work around this.

Fixes containers#3408

Signed-off-by: Matthew Heon <[email protected]>
  • Loading branch information
mheon committed Jun 24, 2019
1 parent a1a4a75 commit ebf48ff
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libpod/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ func (p *Pod) podWithContainers(containers []*Container, ports []v1.ContainerPor
if err != nil {
return nil, err
}

// Since port bindings for the pod are handled by the
// infra container, wipe them here.
result.Ports = nil

// We add the original port declarations from the libpod infra container
// to the first kubernetes container description because otherwise we loose
// the original container/port bindings.
Expand Down

0 comments on commit ebf48ff

Please sign in to comment.