Documentation
¶
Overview ¶
Package podmannet implements a Gostwire decorator that discovers podman (v4+) managed networks and then decorates their corresponding Linux-kernel network interfaces. Supported types of podman networks are “bridge” and “macvlan”.
In case of “bridge” networks this decorator assigns network names as alias names to the corresponding Linux-kernel bridges and also as a Gostwire-specific label.
For “MACVLAN” networks this decorator assigns the network names as alias names to the “parent” network interface (or “master” in Linux parlance).
This decorator also copies any network labels it finds into the corresponding network.Interface instances in a Gostwire discovery information model.
Note ¶
The Docker-compatible podman API is subtly incompatible: it uses a different bridge name-allocating method, and it doesn't reveal the bridge and macvlan master names.
In consequence, we need to resort to a self-rolled minimal HTTP-over-UDS client that supports a minimal subset of the podman-proprietary libpod API. As of podman v4 the libpod API endpoint returns network information. As a nice benefit, the network information endpoint abstracts from the different podmen networking mechanisms, that is, CNI-based and/or netavark-based.
Index ¶
Constants ¶
const GostwireNetworkNameKey = dockernet.GostwireNetworkNameKey
GostwireNetworkNameKey defines the label key for storing the Docker network name of bridge networks.
const UserAgent = "Gostwire (The Sequel)"
UserAgent specifies the HTTP agent string used when talking to podman's libpod API.
Variables ¶
This section is empty.
Functions ¶
func Decorate ¶
func Decorate( ctx context.Context, allnetns network.NetworkNamespaces, allprocs model.ProcessTable, engines []*model.ContainerEngine, )
Decorate decorates bridge and macvlan master network interfaces with alias names that are the names of their corresponding Docker “bridge” or “macvlan” networks, where applicable (a copy is stored also in the labels in Gostwire's key namespace). Additionally, it copies over any user-defined network labels.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a minimalist HTTP-over-UDS (unix domain socket) client for conversing with podmen libpod API endpoints.
type NetworkResource ¶
type NetworkResource struct { Name string `json:"name"` // name of the network ID string `json:"id"` // unique ID within the particular podman engine instance Driver string `json:"driver"` // name of the driver; "bridge", "macvlan", "ipvlan" NetworkInterface string `json:"network_interface"` // name of the associated (master) network interface Internal bool `json:"internal"` // network is host-internal only, without external connectivity Labels map[string]string `json:"labels"` }
NetworkResource grabs just the few things from a podman network we're interested here for the purposes of correctly decorating network interfaces with podman network names. We simply ignore all the other JSON salad returned from the “/vX/libpod/networks/json” endpoint.