mirror of
https://github.com/containers/podman.git
synced 2025-10-13 09:15:20 +08:00
play kube: never add empty alias
Netavark v1.15 added new warnings on some invalid names and that triggerd a new test failure in podman e2e test. The "Podman kube play with disabled cgroup" case now complains about an empty name: podman [options] kube play /tmp/CI_aM20/podman-e2e-3156601197/subtest-3441376193/p/kube.yaml [WARN netavark::network::bridge] invalid network alias "": name is empty, ignoring this name This is because this test does not set a container name thus the code was adding an empty string so to fix it check if the name is not empty first. Signed-off-by: Paul Holzinger <pholzing@redhat.com> (cherry picked from commit da95bbdd5deb547791a527d1143fc3c298b351d3) Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -890,7 +890,9 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
|
||||
// the podName appended to it, but this is a breaking change and will be done in podman 5.0
|
||||
ctrNameAliases := make([]string, 0, len(podYAML.Spec.Containers))
|
||||
for _, container := range podYAML.Spec.Containers {
|
||||
ctrNameAliases = append(ctrNameAliases, container.Name)
|
||||
if container.Name != "" {
|
||||
ctrNameAliases = append(ctrNameAliases, container.Name)
|
||||
}
|
||||
}
|
||||
for k, v := range podSpec.PodSpecGen.Networks {
|
||||
v.Aliases = append(v.Aliases, ctrNameAliases...)
|
||||
|
Reference in New Issue
Block a user