Commit Graph

12268 Commits

Author SHA1 Message Date
Samuel Karp
3c4a1ab1cb
cri: write generated CNI config atomically on Unix
The 10-containerd-net.conflist file generated from the conf_template
should be written atomically so that partial writes are not visible to
CNI plugins. Use the new consistentfile package to ensure this on
Unix-like platforms such as Linux, FreeBSD, and Darwin.

Fixes https://github.com/containerd/containerd/issues/8607

Signed-off-by: Samuel Karp <samuelkarp@google.com>
2023-06-02 16:56:34 -07:00
Samuel Karp
f3ba7c8a35
atomicfile: new package for atomic file writes
Certain files may need to be written atomically so that partial writes
are not visible to other processes. On Unix-like platforms such as
Linux, FreeBSD, and Darwin, this is accomplished by writing a temporary
file, syncing, and renaming over the destination file name. On Windows,
the same operations are performed, but Windows does not guarantee that a
rename operation is atomic.

Partial/inconsistent reads can occur due to:
1. A process attempting to read the file while containerd is writing it
   (both in the case of a new file with a short/incomplete write or in
   the case of an existing, updated file where new bytes may be written
   at the beginning but old bytes may still be present after).
2. Concurrent goroutines in containerd leading to multiple active
   writers of the same file.

The above mechanism explicitly protects against (1) as all writes are to
a file with a temporary name.

There is no explicit protection against multiple, concurrent goroutines
attempting to write the same file. However, atomically writing the file
should mean only one writer will "win" and a consistent file will be
visible.

Signed-off-by: Samuel Karp <samuelkarp@google.com>
2023-06-02 16:56:33 -07:00
Samuel Karp
8b66a752c9
Merge pull request #7376 from tianon/oci-platform 2023-05-30 18:14:31 -07:00
Derek McGowan
c7b9a95bdc
Merge pull request #8603 from cji/cji-mount
Add handling of a '.' commondir and bounds checking to mount_linux
2023-05-30 16:27:54 -07:00
Craig Ingram
d2605de734 add handling of a '.' commondir and bounds checking to mount_linux
Signed-off-by: Craig Ingram <Cjingram@google.com>
2023-05-30 21:13:16 +00:00
Tianon Gravi
21b3318ebe Fix several conversions of "ocispec.Image" to "ocispec.Platform"
Several bits of code unmarshal image config JSON into an `ocispec.Image`, and then immediately create an `ocispec.Platform` out of it, but then discard the original image *and* miss several potential platform fields (most notably, `variant`).

Because `ocispec.Platform` is a strict subset of `ocispec.Image`, most of these can be updated to simply unmarshal the image config directly to `ocispec.Platform` instead, which allows these additional fields to be picked up appropriately.

We can use `tianon/raspbian` as a concrete reproducer to demonstrate.

Before:

```console
$ ctr content fetch docker.io/tianon/raspbian:bullseye-slim
...

$ ctr image ls
REF                                     TYPE                                                 DIGEST                                                                  SIZE     PLATFORMS    LABELS
docker.io/tianon/raspbian:bullseye-slim application/vnd.docker.distribution.manifest.v2+json sha256:66e96f8af40691b335acc54e5f69711584ef7f926597b339e7d12ab90cc394ce 28.6 MiB linux/arm/v7 -
```

(Note that the `PLATFORMS` column lists `linux/arm/v7` -- the image itself is actually `linux/arm/v6`, but one of these bits of code leads to only `linux/arm` being extracted from the image config, which `platforms.Normalize` then updates to an explicit `v7`.)

After:

```console
$ ctr image ls
REF                                     TYPE                                                 DIGEST                                                                  SIZE     PLATFORMS    LABELS
docker.io/tianon/raspbian:bullseye-slim application/vnd.docker.distribution.manifest.v2+json sha256:66e96f8af40691b335acc54e5f69711584ef7f926597b339e7d12ab90cc394ce 28.6 MiB linux/arm/v6 -
```

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-30 13:13:02 -07:00
Derek McGowan
6d7060099b
Merge pull request #8552 from dcantah/cross-plat-stats
CRI: Make stats respect sandbox's platform
2023-05-30 09:58:50 -07:00
Derek McGowan
197b27bd02
Merge pull request #8586 from mcdonagj/fix-spelling-of-repository-in-nri-docs
Fix: Correct the spelling of repository within the NRI plugin documentation.
2023-05-30 09:27:44 -07:00
Derek McGowan
f49789fd54
Merge pull request #8594 from fuweid/fix-blockfile-mount
snapshots/blockfile: use loop if options is empty
2023-05-30 08:33:09 -07:00
Derek McGowan
8e90799d1c
Merge pull request #8595 from cardyok/scratch_generator_use_dst
snapshots/blockfile: use passed in dst in scratchGenerator
2023-05-30 08:32:27 -07:00
Cardy.Tang
9702d4aeec snapshots/blockfile: use passed in dst in scratchGenerator
Signed-off-by: Cardy.Tang <zuniorone@gmail.com>
2023-05-30 11:42:19 +08:00
Wei Fu
bb82f3683e snapshots/blockfile: use loop if options is empty
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-05-29 23:26:39 +08:00
Samuel Karp
4b7145cfd3
Merge pull request #8587 from lengrongfu/feat/upgrade_pause_version 2023-05-29 00:55:22 -07:00
rongfu.leng
9287711b7a upgrade registry.k8s.io/pause version
Signed-off-by: rongfu.leng <rongfu.leng@daocloud.io>
2023-05-28 07:59:10 +08:00
Gary McDonald
fbb38ab6b8
Fix the spelling of repository within the NRI plugin documentation.
Signed-off-by: Gary McDonald <mcdonagj@dukes.jmu.edu>
2023-05-27 13:18:46 -04:00
Samuel Karp
d0dba8e163
Merge pull request #8576 from henry118/ready 2023-05-26 14:41:57 -07:00
Henry Wang
4bfcac85fa notify readiness when registered plugins are ready
Signed-off-by: Henry Wang <henwang@amazon.com>
2023-05-26 03:07:40 +00:00
Kazuyoshi Kato
ed7c0ebe28
Merge pull request #8573 from estesp/fix-test-image-index-static-content
Update volume-ownership image with latest hashes
2023-05-25 11:23:52 -07:00
Phil Estes
579b5596c5 Update volume-ownership image with latest hashes
Fixes test which requires static content to match a GHCR-located image which was recently updated.

Signed-off-by: Phil Estes <estesp@amazon.com>
2023-05-25 11:13:57 -04:00
Samuel Karp
b16b0c872d
Merge pull request #8559 from dmcgowan/blockfile-add-mount-options 2023-05-24 14:46:48 -07:00
Derek McGowan
5997a65896
Merge pull request #8554 from ktock/remote-snapshotter-docs
docs/remote-snapshotter.md: update links and description
2023-05-23 12:18:21 -07:00
Derek McGowan
7beaa5e859
Add mount options to blockfile snapshotter
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-05-23 10:56:20 -07:00
Kohei Tokunaga
261d45efe1
docs/remote-snapshotter.md: update links and description
This commit fixes a broken link. This commit also updates the description about
the image handler. It now mentions about
`github.com/containerd/containerd/pkg/snapshotters` package.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2023-05-23 22:55:57 +09:00
Danny Canter
7274e33e38 CRI: Make stats respect sandbox's platform
To further some ongoing work in containerd to make as much code as possible
able to be used on any platform (to handle runtimes that can virtualize/emulate
a variety of different OSes), this change makes stats able to be handled on
any of the supported stat types (just linux and windows). To accomplish this,
we use the platform the sandbox returns from its `Platform` rpc to decide
what format the containers in a given sandbox are returning metrics in, then
we can typecast/marshal accordingly.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-05-23 01:32:36 -07:00
Fu Wei
773874caea
Merge pull request #8547 from zhaojizhuang/bolt
[sandbox] Optimize metadata Schema notes to correctly match metadata structures
2023-05-23 15:32:47 +08:00
Derek McGowan
65c7c92792
Merge pull request #8534 from gabriel-samfira/fix-image-workflow
Fix image workflow
2023-05-22 19:20:36 -07:00
Derek McGowan
44df496d75
Merge pull request #8542 from cardyok/feat_overlay_sync_remove
feat: make overlay sync removal configurable
2023-05-22 17:29:45 -07:00
Derek McGowan
ca5d6b6bad
Merge pull request #8531 from cardyok/bugfix_mount_path_symlink
bugfix: resolve symlink when looking up mountpoint
2023-05-22 17:06:16 -07:00
zhaojizhuang
82deabf9db Optimize metadata Schema notes to correctly match metadata structures
1. Add sandboxes object
2. Optimize indentation of parent and child objects

Signed-off-by: zhaojizhuang <571130360@qq.com>
2023-05-22 16:18:58 +08:00
Cardy.Tang
a6cd5e3f4f bugfix: resolve symlink when looking up mountpoint
Signed-off-by: Cardy.Tang <zuniorone@gmail.com>
2023-05-22 11:03:51 +08:00
Cardy.Tang
b9f2e48e37 feat: make overlay sync removal configurable
Signed-off-by: Cardy.Tang <zuniorone@gmail.com>
2023-05-19 16:32:10 +08:00
Gabriel Adrian Samfira
becf04a59a Update to docker/login-action V2
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-05-19 00:13:08 +03:00
Gabriel Adrian Samfira
79709a2058 disable provenance
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-05-19 00:01:05 +03:00
Akihiro Suda
878132923d
Merge pull request #8511 from dmcgowan/blockfile-snapshotter
Add blockfile snapshotter
2023-05-18 11:52:37 +09:00
Derek McGowan
1be571b14f
Add sync before unmount on snapshotter layer test
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-05-17 14:25:27 -07:00
Derek McGowan
b729962e3e
Add blockfile snapshotter to snapshotters doc
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-05-17 14:25:27 -07:00
Derek McGowan
798dba9faa
Add blockfile as a builtin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-05-17 14:25:27 -07:00
Derek McGowan
0c386e2ebd
Add blockfile snapshotter
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-05-17 14:25:27 -07:00
Phil Estes
1498a6dde9
Merge pull request #8526 from fuweid/fuweid/chore-update-comment
chore: update comment for NetworkPluginSetupSerially
2023-05-17 13:11:14 -04:00
Derek McGowan
44eb8f3466
Merge pull request #8524 from gabriel-samfira/update-volume-copy-up
Update volume-copy-up
2023-05-17 09:28:40 -07:00
Fu Wei
8b6889b8e2
Merge pull request #8522 from AkihiroSuda/continuity-v0.4.0 2023-05-17 23:07:10 +08:00
Wei Fu
d280cb83b6 chore: update comment for NetworkPluginSetupSerially
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-05-17 22:39:10 +08:00
Gabriel Adrian Samfira
f8907ab872
Update volume-copy-up
Add new test cases for volumes on both Linux and Windows. These new
volumes will be used to test that we don't accidentally mangle volume
paths on Linux and that non-C volume mounts work properly when defined
in an image on Windows.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-05-17 14:20:37 +03:00
Akihiro Suda
f35a105cf0
Merge pull request #8521 from AkihiroSuda/go-runc-v1.1.0
go.mod: github.com/containerd/go-runc v1.1.0
2023-05-17 20:02:36 +09:00
Akihiro Suda
811456b314
go.mod: github.com/containerd/continuity v0.4.0
https://github.com/containerd/continuity/compare/72c70feb3081...v0.4.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-05-17 19:50:20 +09:00
Akihiro Suda
6f715ab101
go.mod: github.com/containerd/go-runc v1.1.0
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-05-17 13:45:37 +09:00
Fu Wei
8c21759d7c
Merge pull request #8401 from Iceber/fix_checkpoint_config_content 2023-05-17 10:04:49 +08:00
Phil Estes
7a5a4ecfed
Merge pull request #8518 from dims/bump-seccomp-version-to-be-the-same-as-one-in-runc-repo
Bump seccomp version to be the same as one in runc repo
2023-05-16 09:04:31 -07:00
Samuel Karp
c60ba138b6
Merge pull request #8502 from mstmdev/fix-typos 2023-05-16 08:41:02 -07:00
Davanum Srinivas
85cf9a09e8
Bump seccomp version to be the same as one in runc repo
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2023-05-16 09:33:26 -04:00