Commit Graph

1574 Commits

Author SHA1 Message Date
OpenShift Merge Robot 82c6dbf94a Merge pull request #885 from rhatdan/events
Document the events_logfile_path field in containers.conf
2022-01-17 10:31:19 +01:00
Daniel J Walsh 4c67daff69 Document the events_logfile_path field in containers.conf
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-14 12:18:23 -05:00
OpenShift Merge Robot bb9adb8077 Merge pull request #883 from cevich/netavark
Cirrus: Make netavark binary available to unit tests
2022-01-14 13:04:17 +01:00
Chris Evich 76459f6115 Cirrus: Make netavark binary available to unit tests
Until widely used and pre-installed in the VM image, simply pull the
latest build from the upstream netavark CI system.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-01-13 10:03:34 -05:00
Chris Evich 996e5f3bd3 Cirrus: Freshen VM images
Signed-off-by: Chris Evich <cevich@redhat.com>
2022-01-13 10:03:34 -05:00
OpenShift Merge Robot 79431e9fcd Merge pull request #886 from containers/dependabot/go_modules/github.com/BurntSushi/toml-1.0.0
build(deps): bump github.com/BurntSushi/toml from 0.4.1 to 1.0.0
2022-01-13 14:12:51 +01:00
dependabot[bot] 0e01badae6 build(deps): bump github.com/BurntSushi/toml from 0.4.1 to 1.0.0
Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 0.4.1 to 1.0.0.
- [Release notes](https://github.com/BurntSushi/toml/releases)
- [Commits](https://github.com/BurntSushi/toml/compare/v0.4.1...v1.0.0)

---
updated-dependencies:
- dependency-name: github.com/BurntSushi/toml
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-13 04:08:06 +00:00
OpenShift Merge Robot 4a421b858d Merge pull request #884 from Luap99/network-test
libnetwork: run unit tests
2022-01-12 20:34:18 +01:00
Paul Holzinger 3026389ebc libnetwork: run unit tests
I totally forgot to check if the network unit tests even run CI, turns
out they are not.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-12 18:17:39 +01:00
OpenShift Merge Robot 113c2b988b Merge pull request #882 from vrothberg/platform-checks
libimage: pull: platform checks for non-local platform
2022-01-12 12:20:17 +01:00
Valentin Rothberg 8ba7e55c56 libimage: pull: platform checks for non-local platform
After containers/podman/issues/10682, we decided to always re-pull
images of non-local platforms and match *any* local image. Over time, we
refined this logic to not *always* pull the image but only if there is a
*newer* one. This has slightly changed the semantics and requires to
perform platform checks when looking up a local image. Otherwise, bogus
values would match a local image and mistakenly return it.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-12 10:15:09 +01:00
OpenShift Merge Robot 9f39bbbece Merge pull request #881 from Luap99/libnetwork
libnetwork: verify static ip only for host-local ipam and allow mtu option for netavark macvlan driver
2022-01-10 17:55:09 +01:00
OpenShift Merge Robot e4d8d9ba27 Merge pull request #880 from vrothberg/platform-pull-policy
libimage: refine pull-policy enforcement for custom platforms
2022-01-10 17:53:09 +01:00
Paul Holzinger f18244b9a1 libnetwork: netavark allow mtu option for macvlan
We have to support the mtu option for netavark since it is also
supported by CNI.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-10 16:55:19 +01:00
Paul Holzinger 774087c6a7 libnetwork: only validate static ip when ipam is host-local
If the dhcp ipam driver is used podman does not know any subnets so we
cannot verify if the given static ip is in the subnet.

Fixes containers/podman#12762

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-10 16:29:38 +01:00
Valentin Rothberg e369277804 libimage: refine pull-policy enforcement for custom platforms
When pulling down an image with a user-specified custom platform, we
try to make sure that user gets what they are asking for.  An inherent
issue with multi-arch images is that there are many images in the wild
which do not get the platform right (see containers/podman/issues/10682).
That means we need to pessimistically assume that the local image is
wrong and pull the "correct" one down from the registry; in the worst case
that is redundant work but we have a guarantee of correctness.

Motivated by containers/podman/issues/12707 I had another look at the
code and found some space for optimizations.  Previously, we enforced
the pull policy to "always" but that may be too aggressive since we may
be running in an airgapped environment and the local image is correct.

With this change, we enforce the pull policy to "newer" which makes
errors non-fatal in case a local image has been found; this seems like a
good middleground between making sure we are serving the "correct" image
and user friendliness.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-10 16:27:10 +01:00
OpenShift Merge Robot 94502d0861 Merge pull request #879 from vrothberg/path-pull
pull: fix pulling from dir transport
2022-01-10 16:22:53 +01:00
OpenShift Merge Robot 7ed3a21c3c Merge pull request #878 from vrothberg/manifest-lookup
image lookup: apply checks for matching digest
2022-01-10 16:20:52 +01:00
Valentin Rothberg 3aa83d3500 libimage filters: allow duplicates with the same value
Podman CI wants that for pruning. The pruning code unconditionally sets
the dangling filter since that's crucial for pruning.

Also fix a typo in the error message:
`s/more then/more than/`

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-10 14:32:16 +01:00
Valentin Rothberg 95872a5d60 pull: fix pulling from dir transport
Path-based transports may contain characters that are invalid for a
reference.  In such cases, we should pessimistically generate an ID
and not attempt to look at the (possibly path-based) string within the
transport.

This fixes an error when running `podman run dir:/tmp/CapitalChar` and
will prevent the same issue for the upcoming SIF transport.

Extend the tests to make sure we're not going to regress in the future.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-10 13:34:36 +01:00
Valentin Rothberg f80a7f6c96 image lookup: apply checks for matching digest
When looking up an image by digest, make sure that the matching image is
also subject to further attribute checks (e.g., manifest list checks) as
specified by the user.

Fixes: containers/podman/issues/12729
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-10 13:18:42 +01:00
OpenShift Merge Robot 96c7010896 Merge pull request #877 from Luap99/network-backend-atomic
libnetwork: use atomic write for the backend file
2022-01-07 18:07:04 +01:00
Paul Holzinger 55acbe7f30 libnetwork: use atomic write for the backend file
It is possible that two processes write at the same time and this could
lead to an invalid value in the file.

I think this fixes a race condition which was observed in the buildah
integration tests.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-07 17:43:19 +01:00
OpenShift Merge Robot 27664774c3 Merge pull request #876 from rhatdan/proxy
No reason to use a Map versus a slice for ProxyEnv
2022-01-07 15:53:00 +01:00
Daniel J Walsh f92d49848e No reason to use a Map versus a slice for ProxyEnv
[NO NEW TESTS NEEDED]

Also vendor in latest containers/image code to remove dependabot
warnings.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-07 09:20:54 -05:00
OpenShift Merge Robot e4dadf0a84 Merge pull request #874 from rhatdan/proxy
WEB Proxy is used in at least three different places in code
2022-01-07 15:01:52 +01:00
Daniel J Walsh 220487d1aa Merge pull request #875 from Luap99/revert-864
Revert "pull: fix pulling from dir transport"
2022-01-07 08:59:43 -05:00
Daniel J Walsh 98b9bd7d43 WEB Proxy is used in at least three different places in code
This change makes a global rather then defining this list in multiple
places.

[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-07 08:43:38 -05:00
Paul Holzinger 9255c2eec0 Revert "pull: fix pulling from dir transport"
This reverts commit 913fe2c9cb.

Both podman and buildah CI are failing because of this change. Since
Valentin is out and I need to get my network changes merged I want to
revert this for now.

Example failure from buildah test:
```
[+2471s] not ok 507 pull-from-local-directory
[+2471s] # (from function `assert' in file ./helpers.bash, line 342,
[+2471s] #  from function `expect_output' in file ./helpers.bash, line 369,
[+2471s] #  in test file ./pull.bats, line 89)
[+2471s] #   `expect_output --substring "localhost${TESTDIR}/buildahtest:latest"' failed
[+2471s] # /var/tmp/go/src/github.com/containers/buildah/tests /var/tmp/go/src/github.com/containers/buildah/tests
[+2471s] # $ /var/tmp/go/src/github.com/containers/buildah/tests/./../bin/buildah pull --signature-policy /var/tmp/go/src/github.com/containers/buildah/tests/./policy.json alpine
[+2471s] # Resolved "alpine" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
[+2471s] # Trying to pull docker.io/library/alpine:latest...
[+2471s] # Getting image source signatures
[+2471s] # Copying blob sha256:9d16cba9fb961d1aafec9542f2bf7cb64acfc55245f9e4eb5abecd4cdc38d749
[+2471s] # Copying blob sha256:9d16cba9fb961d1aafec9542f2bf7cb64acfc55245f9e4eb5abecd4cdc38d749
[+2471s] # Copying config sha256:961769676411f082461f9ef46626dd7a2d1e2b2a38e6a44364bcbecf51e66dd4
[+2471s] # Writing manifest to image destination
[+2471s] # Storing signatures
[+2471s] # 961769676411f082461f9ef46626dd7a2d1e2b2a38e6a44364bcbecf51e66dd4
[+2471s] # $ /var/tmp/go/src/github.com/containers/buildah/tests/./../bin/buildah push --signature-policy /var/tmp/go/src/github.com/containers/buildah/tests/./policy.json docker.io/library/alpine:latest dir:/var/tmp/buildah_tests.c47drl/buildahtest
[+2471s] # Getting image source signatures
[+2471s] # Copying blob sha256:03901b4a2ea88eeaad62dbe59b072b28b6efa00491962b8741081c5df50c65e0
[+2471s] # Copying config sha256:961769676411f082461f9ef46626dd7a2d1e2b2a38e6a44364bcbecf51e66dd4
[+2471s] # Writing manifest to image destination
[+2471s] # Storing signatures
[+2471s] # $ /var/tmp/go/src/github.com/containers/buildah/tests/./../bin/buildah rmi alpine
[+2471s] # untagged: docker.io/library/alpine:latest
[+2471s] # 961769676411f082461f9ef46626dd7a2d1e2b2a38e6a44364bcbecf51e66dd4
[+2471s] # $ /var/tmp/go/src/github.com/containers/buildah/tests/./../bin/buildah pull --signature-policy /var/tmp/go/src/github.com/containers/buildah/tests/./policy.json dir:/var/tmp/buildah_tests.c47drl/buildahtest
[+2471s] # Getting image source signatures
[+2471s] # Copying blob sha256:f3ac2f9422602f687109cc39270c47da673c6a61b5ca4958bc232adbc65912e7
[+2471s] # Copying config sha256:961769676411f082461f9ef46626dd7a2d1e2b2a38e6a44364bcbecf51e66dd4
[+2471s] # Writing manifest to image destination
[+2471s] # Storing signatures
[+2471s] # 961769676411f082461f9ef46626dd7a2d1e2b2a38e6a44364bcbecf51e66dd4
[+2471s] # $ /var/tmp/go/src/github.com/containers/buildah/tests/./../bin/buildah images --format {{.Name}}:{{.Tag}}
[+2471s] # <none>:<none>
[+2471s] # #/vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
[+2471s] # #|     FAIL: buildah images --format {{.Name}}:{{.Tag}}
[+2471s] # #| expected: =~ 'localhost/var/tmp/buildah_tests.c47drl/buildahtest:latest'
[+2471s] # #|   actual:    '<none>:<none>'
[+2471s] # #\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-07 14:18:32 +01:00
OpenShift Merge Robot 4ba676d6b3 Merge pull request #873 from Luap99/libnetwork-defnet
libnetwork: add method to get the default network name
2022-01-06 12:32:37 +01:00
Paul Holzinger c0ddc35864 libnetwork: add method to get the default network name
While we can store the default network name outside this network
interface it can become out of sync with the interface.

In buildah it can be useful to get the name from the interface.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-05 22:08:38 +01:00
OpenShift Merge Robot 7d7974f089 Merge pull request #872 from Luap99/default-network-interface
libnetwork: add function to get the default network backend
2022-01-05 19:12:36 +01:00
Paul Holzinger 641e6dff04 libnetwork: netavark fix mac address marshal
The HardwareAddr type must bbe the actual value and not a pointer
otherwise the marshal logic will not use this function. Added a test to
confirm that this works.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-05 18:27:14 +01:00
Paul Holzinger 588325c4ae libnetwork: netavark use runrooot for ipam db
We should not use XDG_RUNTIME_DIR for the ipam db. This directory is
shared but we need the ipam db per storage. We can use the runroot for
this. It should be a tmpfs to reset the ipam assignments after a reboot.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-04 15:46:23 +01:00
Paul Holzinger 8893b57c6e libnetwork: remove unneeded Lockfile argument
If the caller can decide the lockfile path it is just more likely that
there is a lock missmatch due different lock names. We should always
just use the config dir and use a lock with a static name.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-04 15:46:23 +01:00
Paul Holzinger 25af87fbcc libnetwork: add function to get the default network backend
When the network backend is unset in the config we have to to figure out
if we need CNI or netavark. New installs should use netavark while
existing installs should continue to use CNI to prevent breaking
systems.

We use the following conditions to determine what backend to use:
1. read ${graphroot}/defaultNetworkBackend
2. find netavark binary (if not installed use CNI)
3. check containers, images and CNI networks and if there are some
   we have an existing install and should continue to use CNI

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-04 15:46:12 +01:00
OpenShift Merge Robot 300fe66434 Merge pull request #871 from Junnplus/typo-doc
fix typo
2022-01-03 14:02:13 +01:00
ye.sijun f49c05b158 fix typo
Signed-off-by: ye.sijun <junnplus@gmail.com>
2022-01-03 20:15:46 +08:00
OpenShift Merge Robot ced93ba34a Merge pull request #870 from ttys3/cgroupv2-memory-usage
fix: fixup memory usage for cgroup v2
2021-12-26 15:08:09 +01:00
ttyS3 ca459dce1b fix: fixup memory usage for cgroup v2 2021-12-26 21:47:07 +08:00
OpenShift Merge Robot 3c0516757c Merge pull request #868 from giuseppe/cgroup-pids-no-create-root
cgroups: do not create $ROOT/pids on cgroupv2
2021-12-23 14:06:09 +01:00
OpenShift Merge Robot f4818f248b Merge pull request #867 from vrothberg/libimage-platform-normalization
libimage: normalize platform
2021-12-23 14:04:08 +01:00
Valentin Rothberg 281201d87d libimage: normalize platform
Buildah, containers and probably other container engines are normalizing
the platform parameters to support common values.  For instance, "x86_64"
is normalized to the OCI conformant "amd64".

Use the same normalization when copying images and looking up local
images.  Also add some debug logs to facilitate future debugging.

Fixes: containers/podman/issues/12680
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-23 13:09:03 +01:00
OpenShift Merge Robot 25cbcd568a Merge pull request #865 from containers/dependabot/go_modules/github.com/containernetworking/plugins-1.0.1
build(deps): bump github.com/containernetworking/plugins from 0.9.1 to 1.0.1
2021-12-23 12:24:10 +01:00
Giuseppe Scrivano e8532febce cgroups: do not create $ROOT/pids on cgroupv2
add the same check we already have for other controllers, since
`createCgroupDirectory` is meant to be used on cgroup v1 only.

Closes: https://github.com/containers/common/issues/862

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-23 12:15:47 +01:00
dependabot[bot] 35a2ce1d26 build(deps): bump github.com/containernetworking/plugins
Bumps [github.com/containernetworking/plugins](https://github.com/containernetworking/plugins) from 0.9.1 to 1.0.1.
- [Release notes](https://github.com/containernetworking/plugins/releases)
- [Commits](https://github.com/containernetworking/plugins/compare/v0.9.1...v1.0.1)

---
updated-dependencies:
- dependency-name: github.com/containernetworking/plugins
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-23 10:45:47 +00:00
flouthoc 463f91ec52 Merge pull request #869 from rhatdan/make
Fix darwin builds
2021-12-23 15:28:49 +05:30
Daniel J Walsh c0aaea1296 Fix darwin builds
[NO NEW TEST NEEDED] Cross compile should be enough.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-23 04:32:56 -05:00
OpenShift Merge Robot 9f0f225581 Merge pull request #864 from vrothberg/dir-pull
pull: fix pulling from dir transport
2021-12-20 15:40:31 +01:00
Valentin Rothberg 913fe2c9cb pull: fix pulling from dir transport
Path-based transports may contain characters that are invalid for a
reference.  In such cases, we should pessimistically generate an ID
and not attempt to look at the (possibly path-based) string within the
transport.

This fixes an error when running `podman run dir:/tmp/CapitalChar` and
will prevent the same issue for the upcoming SIF transport.

Extend the tests to make sure we're not going to regress in the future.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-20 14:55:36 +01:00