Skip to content

Commit da95bbd

Browse files
committed
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 <[email protected]>
1 parent 961807a commit da95bbd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/domain/infra/abi/play.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,9 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
890890
// the podName appended to it, but this is a breaking change and will be done in podman 5.0
891891
ctrNameAliases := make([]string, 0, len(podYAML.Spec.Containers))
892892
for _, container := range podYAML.Spec.Containers {
893-
ctrNameAliases = append(ctrNameAliases, container.Name)
893+
if container.Name != "" {
894+
ctrNameAliases = append(ctrNameAliases, container.Name)
895+
}
894896
}
895897
for k, v := range podSpec.PodSpecGen.Networks {
896898
v.Aliases = append(v.Aliases, ctrNameAliases...)

0 commit comments

Comments
 (0)