Files
podman/pkg/domain/entities/network.go
Matthew Heon b0286d6b43 Implement pod-network-reload
This adds a new command, 'podman network reload', to reload the
networks of existing containers, forcing recreation of firewall
rules after e.g. `firewall-cmd --reload` wipes them out.

Under the hood, this works by calling CNI to tear down the
existing network, then recreate it using identical settings. We
request that CNI preserve the old IP and MAC address in most
cases (where the container only had 1 IP/MAC), but there will be
some downtime inherent to the teardown/bring-up approach. The
architecture of CNI doesn't really make doing this without
downtime easy (or maybe even possible...).

At present, this only works for root Podman, and only locally.
I don't think there is much of a point to adding remote support
(this is very much a local debugging command), but I think adding
rootless support (to kill/recreate slirp4netns) could be
valuable.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-07 19:26:23 +01:00

83 lines
1.8 KiB
Go

package entities
import (
"net"
"github.com/containernetworking/cni/libcni"
)
// NetworkListOptions describes options for listing networks in cli
type NetworkListOptions struct {
Format string
Quiet bool
Filters map[string][]string
}
// NetworkListReport describes the results from listing networks
type NetworkListReport struct {
*libcni.NetworkConfigList
Labels map[string]string
}
// NetworkInspectReport describes the results from inspect networks
type NetworkInspectReport map[string]interface{}
// NetworkReloadOptions describes options for reloading container network
// configuration.
type NetworkReloadOptions struct {
All bool
Latest bool
}
// NetworkReloadReport describes the results of reloading a container network.
type NetworkReloadReport struct {
Id string
Err error
}
// NetworkRmOptions describes options for removing networks
type NetworkRmOptions struct {
Force bool
}
//NetworkRmReport describes the results of network removal
type NetworkRmReport struct {
Name string
Err error
}
// NetworkCreateOptions describes options to create a network
// swagger:model NetworkCreateOptions
type NetworkCreateOptions struct {
DisableDNS bool
Driver string
Gateway net.IP
Internal bool
Labels map[string]string
MacVLAN string
Range net.IPNet
Subnet net.IPNet
IPv6 bool
// Mapping of driver options and values.
Options map[string]string
}
// NetworkCreateReport describes a created network for the cli
type NetworkCreateReport struct {
Filename string
}
// NetworkDisconnectOptions describes options for disconnecting
// containers from networks
type NetworkDisconnectOptions struct {
Container string
Force bool
}
// NetworkConnectOptions describes options for connecting
// a container to a network
type NetworkConnectOptions struct {
Aliases []string
Container string
}