From 88890d3eb89193ada0053c9a1584c5008c61b80f Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Mon, 2 Jun 2025 17:58:30 +0200 Subject: [PATCH] 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 (cherry picked from commit da95bbdd5deb547791a527d1143fc3c298b351d3) Signed-off-by: Paul Holzinger --- pkg/domain/infra/abi/play.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go index adccd4723d..3a07ca2ada 100644 --- a/pkg/domain/infra/abi/play.go +++ b/pkg/domain/infra/abi/play.go @@ -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...)