From 3842f4d4e52a4f604a2ca71b3ffa1513a1750cdb Mon Sep 17 00:00:00 2001 From: Lokesh Mandvekar Date: Fri, 7 Nov 2025 15:40:30 -0500 Subject: [PATCH] pkg/specgen: Remove deprecated CNINetworks Signed-off-by: Lokesh Mandvekar --- pkg/specgen/generate/namespaces.go | 16 +++------------- pkg/specgen/generate/pod_create.go | 4 ---- pkg/specgen/podspecgen.go | 9 --------- pkg/specgen/specgen.go | 9 --------- 4 files changed, 3 insertions(+), 35 deletions(-) diff --git a/pkg/specgen/generate/namespaces.go b/pkg/specgen/generate/namespaces.go index 4e55153071..a7295334cd 100644 --- a/pkg/specgen/generate/namespaces.go +++ b/pkg/specgen/generate/namespaces.go @@ -338,19 +338,9 @@ func namespaceOptions(s *specgen.SpecGenerator, rt *libpod.Runtime, pod *libpod. } // if no network was specified use add the default if len(s.Networks) == 0 { - // backwards config still allow the old cni networks list and convert to new format - if len(s.CNINetworks) > 0 { - logrus.Warn(`specgen "cni_networks" option is deprecated use the "networks" map instead`) - networks := make(map[string]types.PerNetworkOptions, len(s.CNINetworks)) - for _, net := range s.CNINetworks { - networks[net] = types.PerNetworkOptions{} - } - s.Networks = networks - } else { - // no networks given but bridge is set so use default network - s.Networks = map[string]types.PerNetworkOptions{ - rtConfig.Network.DefaultNetwork: {}, - } + // no networks given but bridge is set so use default network + s.Networks = map[string]types.PerNetworkOptions{ + rtConfig.Network.DefaultNetwork: {}, } } // rename the "default" network to the correct default name diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go index 903ebe4637..9b68daf60c 100644 --- a/pkg/specgen/generate/pod_create.go +++ b/pkg/specgen/generate/pod_create.go @@ -260,10 +260,6 @@ func MapSpec(p *specgen.PodSpecGenerator) (*specgen.SpecGenerator, error) { if len(p.Networks) > 0 { spec.Networks = p.Networks } - // deprecated cni networks for api users - if len(p.CNINetworks) > 0 { - spec.CNINetworks = p.CNINetworks - } if p.NoManageHosts { spec.UseImageHosts = &p.NoManageHosts } diff --git a/pkg/specgen/podspecgen.go b/pkg/specgen/podspecgen.go index 5330e2a2d8..ca2bc4aed9 100644 --- a/pkg/specgen/podspecgen.go +++ b/pkg/specgen/podspecgen.go @@ -122,15 +122,6 @@ type PodNetworkConfig struct { // If the map is empty and the bridge network mode is set the container // will be joined to the default network. Networks map[string]types.PerNetworkOptions - // CNINetworks is a list of CNI networks to join the container to. - // If this list is empty, the default CNI network will be joined - // instead. If at least one entry is present, we will not join the - // default network (unless it is part of this list). - // Only available if NetNS is set to bridge. - // Optional. - // - // Deprecated: as of podman 4.0 use "Networks" instead. - CNINetworks []string `json:"cni_networks,omitempty"` // NoManageResolvConf indicates that /etc/resolv.conf should not be // managed by the pod. Instead, each container will create and manage a // separate resolv.conf as if they had not joined a pod. diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go index 461ed30845..767710e898 100644 --- a/pkg/specgen/specgen.go +++ b/pkg/specgen/specgen.go @@ -505,15 +505,6 @@ type ContainerNetworkConfig struct { // will be joined to the default network. // Optional. Networks map[string]nettypes.PerNetworkOptions - // CNINetworks is a list of CNI networks to join the container to. - // If this list is empty, the default CNI network will be joined - // instead. If at least one entry is present, we will not join the - // default network (unless it is part of this list). - // Only available if NetNS is set to bridge. - // Optional. - // - // Deprecated: as of podman 4.0 use "Networks" instead. - CNINetworks []string `json:"cni_networks,omitempty"` // UseImageResolvConf indicates that resolv.conf should not be managed // by Podman, but instead sourced from the image. // Conflicts with DNSServer, DNSSearch, DNSOption.