pkg/specgen: Remove deprecated CNINetworks

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
This commit is contained in:
Lokesh Mandvekar
2025-11-07 15:40:30 -05:00
parent 5d46171b7d
commit 3842f4d4e5
4 changed files with 3 additions and 35 deletions

View File

@@ -338,19 +338,9 @@ func namespaceOptions(s *specgen.SpecGenerator, rt *libpod.Runtime, pod *libpod.
} }
// if no network was specified use add the default // if no network was specified use add the default
if len(s.Networks) == 0 { if len(s.Networks) == 0 {
// backwards config still allow the old cni networks list and convert to new format // no networks given but bridge is set so use default network
if len(s.CNINetworks) > 0 { s.Networks = map[string]types.PerNetworkOptions{
logrus.Warn(`specgen "cni_networks" option is deprecated use the "networks" map instead`) rtConfig.Network.DefaultNetwork: {},
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: {},
}
} }
} }
// rename the "default" network to the correct default name // rename the "default" network to the correct default name

View File

@@ -260,10 +260,6 @@ func MapSpec(p *specgen.PodSpecGenerator) (*specgen.SpecGenerator, error) {
if len(p.Networks) > 0 { if len(p.Networks) > 0 {
spec.Networks = p.Networks spec.Networks = p.Networks
} }
// deprecated cni networks for api users
if len(p.CNINetworks) > 0 {
spec.CNINetworks = p.CNINetworks
}
if p.NoManageHosts { if p.NoManageHosts {
spec.UseImageHosts = &p.NoManageHosts spec.UseImageHosts = &p.NoManageHosts
} }

View File

@@ -122,15 +122,6 @@ type PodNetworkConfig struct {
// If the map is empty and the bridge network mode is set the container // If the map is empty and the bridge network mode is set the container
// will be joined to the default network. // will be joined to the default network.
Networks map[string]types.PerNetworkOptions 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 // NoManageResolvConf indicates that /etc/resolv.conf should not be
// managed by the pod. Instead, each container will create and manage a // managed by the pod. Instead, each container will create and manage a
// separate resolv.conf as if they had not joined a pod. // separate resolv.conf as if they had not joined a pod.

View File

@@ -505,15 +505,6 @@ type ContainerNetworkConfig struct {
// will be joined to the default network. // will be joined to the default network.
// Optional. // Optional.
Networks map[string]nettypes.PerNetworkOptions 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 // UseImageResolvConf indicates that resolv.conf should not be managed
// by Podman, but instead sourced from the image. // by Podman, but instead sourced from the image.
// Conflicts with DNSServer, DNSSearch, DNSOption. // Conflicts with DNSServer, DNSSearch, DNSOption.