mirror of
https://github.com/containers/podman.git
synced 2025-11-29 09:37:38 +08:00
pkg/specgen: Remove deprecated CNINetworks
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
This commit is contained in:
@@ -338,21 +338,11 @@ 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: {},
|
||||
}
|
||||
}
|
||||
}
|
||||
// rename the "default" network to the correct default name
|
||||
if opts, ok := s.Networks["default"]; ok {
|
||||
s.Networks[rtConfig.Network.DefaultNetwork] = opts
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user