podman/libpod/network
Paul Holzinger 54b588c07d rootless cni without infra container
Instead of creating an extra container create a network and mount
namespace inside the podman user namespace. This ns is used to
for rootless cni operations.
This helps to align the rootless and rootful network code path.
If we run as rootless we just have to set up a extra net ns and
initialize slirp4netns in it. The ocicni lib will be called in
that net ns.

This design allows allows easier maintenance, no extra container
with pause processes, support for rootless cni with --uidmap
and possibly more.

The biggest problem is backwards compatibility. I don't think
live migration can be possible. If the user reboots or restart
all cni containers everything should work as expected again.
The user is left with the rootless-cni-infa container and image
but this can safely be removed.

To make the existing cni configs work we need execute the cni plugins
in a extra mount namespace. This ensures that we can safely mount over
/run and /var which have to be writeable for the cni plugins without
removing access to these files by the main podman process. One caveat
is that we need to keep the netns files at `XDG_RUNTIME_DIR/netns`
accessible.

`XDG_RUNTIME_DIR/rootless-cni/{run,var}` will be mounted to `/{run,var}`.
To ensure that we keep the netns directory we bind mount this relative
to the new root location, e.g. XDG_RUNTIME_DIR/rootless-cni/run/user/1000/netns
before we mount the run directory. The run directory is mounted recursive,
this makes the netns directory at the same path accessible as before.

This also allows iptables-legacy to work because /run/xtables.lock is
now writeable.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-04-01 17:27:03 +02:00
..
config.go Honor network options for macvlan networks 2021-02-02 13:24:14 -06:00
create.go rootless cni without infra container 2021-04-01 17:27:03 +02:00
create_test.go bump go module to v3 2021-02-22 09:03:51 +01:00
devices.go bump go module to v3 2021-02-22 09:03:51 +01:00
files.go Split libpod/network package 2021-03-15 14:01:52 +01:00
ip.go prevent unpredictable results with network create|remove 2020-10-07 10:03:21 -05:00
lock.go Move the cni lock file into the cni config dir 2021-01-21 11:50:45 +01:00
netconflist.go Unification of until filter across list/prune endpoints 2021-03-24 00:56:00 +01:00
netconflist_test.go Enable whitespace linter 2021-02-11 23:01:56 +01:00
network.go Split libpod/network package 2021-03-15 14:01:52 +01:00
network_test.go prevent unpredictable results with network create|remove 2020-10-07 10:03:21 -05:00
subnet.go Fix ip-range for classless subnet masks 2020-11-23 11:55:29 +01:00
subnet_test.go Fix ip-range for classless subnet masks 2020-11-23 11:55:29 +01:00