summaryrefslogtreecommitdiff
path: root/libpod/network/cni
Commit message (Collapse)AuthorAge
* Merge pull request #11949 from Luap99/net-rangeOpenShift Merge Robot2021-10-13
|\ | | | | CNI: fix network create --ip-range
| * CNI: fix network create --ip-rangePaul Holzinger2021-10-12
| | | | | | | | | | | | | | The --ip-range option did not work correctly. The endIP was accidentally assigned to the start IP. New tests are added to make sure it works. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* | codespell codeDaniel J Walsh2021-10-12
|/ | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* CNI networks: reload networks if neededPaul Holzinger2021-10-04
| | | | | | | | | | | | | | | | | | | | The current implementation of the CNI network interface only loads the networks on the first call and saves them in a map. This is done to safe performance and not having to reload all configs every time which will be costly for many networks. The problem with this approach is that if a network is created by another process it will not be picked up by the already running podman process. This is not a problem for the short lived podman commands but it is problematic for the podman service. To make sure we always have the actual networks store the mtime of the config directory. If it changed since the last read we have to read again. Fixes #11828 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Merge pull request #11751 from Luap99/net-aliasOpenShift Merge Robot2021-09-28
|\ | | | | always add short container id as net alias
| * move network alias validation to container createPaul Holzinger2021-09-28
| | | | | | | | | | | | | | | | | | | | Podman 4.0 currently errors when you use network aliases for a network which has dns disabled. Because the error happens on network setup this can cause regression for old working containers. The network backend should not validate this. Instead podman should check this at container create time and also for network connect. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* | CNI: network remove do not error for ENOENTPaul Holzinger2021-09-27
|/ | | | | | | | Make podman network rm more robust by checking for ENOENT if we cannot remove the config file. If it does not exists there is no reason to error. This is especially useful for podman network prune. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* rootful: do not set XDG_RUNTIME_DIR for cni pluginsPaul Holzinger2021-09-24
| | | | | | | | | | | | | | | The dnsname plugin tries to use XDG_RUNTIME_DIR to store files. podman run will have XDG_RUNTIME_DIR set and thus the cni plugin can use it. The problem is that XDG_RUNTIME_DIR is unset for the conmon process for rootful users. This causes issues since the cleanup process is spawned by conmon and thus not have XDG_RUNTIME_DIR set to same value as podman run. Because of it dnsname will not find the config files and cannot correctly cleanup. To fix this we should also unset XDG_RUNTIME_DIR for the cni plugins as rootful. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* standardize logrus messages to upper caseDaniel J Walsh2021-09-22
| | | | | | | | Remove ERROR: Error stutter from logrus messages also. [ NO TESTS NEEDED] This is just code cleanup. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Bump CNI to v1.0.1Paul Holzinger2021-09-22
| | | | | | | | | | | | | | | | | | | | | Update CNI so we can match wrapped errors. This should silence ENOENT warnings when trying to read the cni conflist files. Fixes #10926 Because CNI v1.0.0 contains breaking changes we have to change some import paths. Also we cannot update the CNI version used for the conflist files created by `podman network create` because this would require at least containernetwork-plugins v1.0.1 and a updated dnsname plugin. Because this will take a while until it lands in most distros we should not use this version. So keep using v0.4.0 for now. The update from checkpoint-restore/checkpointctl is also required to make sure it no longer uses CNI to read the network status. [NO TESTS NEEDED] Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* CNI: add ipvlan driverPaul Holzinger2021-09-16
| | | | | | | | | Add support for the ipvlan cni plugin. This allows us to create, inspect and list ipvlan networks correctly. Fixes #10478 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* CNI: network create support macvlan modesPaul Holzinger2021-09-16
| | | | | | | | Support setting the macvlan mode with `podman network create -d macvlan --opt mode=bridge`. This will correctly set the specified macvlan mode in the cni conflist file. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Add Drivers method to the Network InterfacePaul Holzinger2021-09-15
| | | | | | | Drivers should return the list of supported network drivers by this plugin. This is useful for podman info. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Wire network interface into libpodPaul Holzinger2021-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make use of the new network interface in libpod. This commit contains several breaking changes: - podman network create only outputs the new network name and not file path. - podman network ls shows the network driver instead of the cni version and plugins. - podman network inspect outputs the new network struct and not the cni conflist. - The bindings and libpod api endpoints have been changed to use the new network structure. The container network status is stored in a new field in the state. The status should be received with the new `c.getNetworkStatus`. This will migrate the old status to the new format. Therefore old containers should contine to work correctly in all cases even when network connect/ disconnect is used. New features: - podman network reload keeps the ip and mac for more than one network. - podman container restore keeps the ip and mac for more than one network. - The network create compat endpoint can now use more than one ipam config. The man pages and the swagger doc are updated to reflect the latest changes. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* cni network configs set ipv6 enables correctlyPaul Holzinger2021-09-15
| | | | | | | When configs are loaded from disk we need to check if they contain a ipv6 subnet and set ipv6 enables to true in this case. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* default network: do not validate the used subnetsPaul Holzinger2021-09-15
| | | | | | | | | | | The default network should not be validated against used subnets, we have to ensure that this network can always be created even when a subnet is already used on the host. This could happen if you run a container on this net, then the cni interface will be created on the host and "block" this subnet from being used again. Therefore the next podman command tries to create the default net again and it would fail because it thinks the network is used on the host. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* network create: validate the input subnetPaul Holzinger2021-09-15
| | | | | | | Check that the given subnet does not conflict with existing ones (other configs or host interfaces). Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Globally replace http:// with https://Daniel J Walsh2021-08-27
| | | | | | [NO TESTS NEEDED] Hopefully existing tests will find issues. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Network interfacePaul Holzinger2021-08-24
Implement a new network interface to abstract CNI from libpod. The interface is implemented for the CNI backend but in the future we can add more backends. The code is structured in three new packages: - `libpod/network/types`: contains the interface definition and the necessary types for it. - `libpod/network/cni` contains the interface implementation for the CNI backend. - `libpod/network/util` a set of utility functions related to networking. The CNI package uses ginkgo style unit tests. To test Setup/Teardown the test must be run as root. Each test will run in their own namespace to make the test independent from the host environment. New features with the CNI backend: - The default network will be created in memory if it does not exists on disk. - It can set more than one static IP per container network. - Networks are loaded once from disk and only if this interface is used, e.g. for commands such as `podman info` networks are not loaded. This reduces unnecessary disk IO. This commit only adds the interface it is not wired into libpod. This requires a lot of breaking changes which will be done in a followup commit. Once this is integrated into libpod the current network code under `libpod/network` should be removed. Also the dependency on OCICNI should be dropped. Signed-off-by: Paul Holzinger <pholzing@redhat.com>