Commit Graph

14496 Commits

Author SHA1 Message Date
Bjorn Neergaard
62f621a344
images: simplify mediatype logic
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-09-27 09:29:57 -06:00
Bjorn Neergaard
377c5ca9cd
images/archive: use mediatype helpers
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-09-27 09:29:56 -06:00
Bjorn Neergaard
bb8a472f24
images: use mediatype helpers
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-09-27 09:29:54 -06:00
Derek McGowan
e7254406c9
Require plugins to succeed after registering readiness
When readiness is registered on initialization, the plugin must not
fail. When such a plugin fails, containerd will hang on the readiness
condition.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-26 17:10:55 -07:00
Derek McGowan
62f273d508
Add migrate subcommand to config command
Allows applying migration to existing configurations

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-26 16:54:24 -07:00
Derek McGowan
0320ad1843
Add config migration to plugin package
Add reset registrations function to plugin package

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-26 16:53:35 -07:00
Derek McGowan
f58158e2d3
Add config migration and bump config version
Allows plugins to migrate from older configurations

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-26 16:53:33 -07:00
Akihiro Suda
9ffb34ac49
Merge pull request #9054 from macOScontainers/canonicalize-filter-mount-path
Fix usages of `mountinfo.PrefixFilter`
2023-09-27 05:10:27 +09:00
Bryant Biggs
bf4fbe4e87 docs: Update transfer service docs to reflect completed implementations for 1.7
Signed-off-by: Bryant Biggs <bryantbiggs@gmail.com>
2023-09-26 12:31:19 -04:00
Phil Estes
bcd658c76c
Merge pull request #9146 from thaJeztah/nil_error
images: Config: explicitly return nil-error
2023-09-26 12:27:00 -04:00
Phil Estes
5444dae0d4
Merge pull request #9120 from dmcgowan/image-usage-test
Image usage test
2023-09-26 11:59:31 -04:00
Phil Estes
9fded7ca7d
Merge pull request #9143 from dmcgowan/plugin-config-unknown-fields
Add warning for plugin configs with unknown fields
2023-09-26 11:55:39 -04:00
Sebastiaan van Stijn
b40e95e0ea
images: Config: explicitly return nil-error
just a minor nit :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-26 13:20:41 +02:00
Derek McGowan
36c2222d3f
Add usage calculation test
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-25 20:18:13 -07:00
Derek McGowan
3b60e93667
Create new imagetest package
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-25 20:18:13 -07:00
Maksym Pavlenko
c33249cbe6
Merge pull request #9142 from jsturtevant/no-changes-wasm
Allow for images with artifacts layers to pull and run
2023-09-25 19:03:06 -07:00
Derek McGowan
4c344f2fa5
Add warning for plugin configs with unknown fields
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-25 16:09:15 -07:00
James Sturtevant
a9ba33f8ff Allow for images with artifacts to pull
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2023-09-25 22:10:19 +00:00
Phil Estes
0f3d312aca
Merge pull request #9131 from dmcgowan/toml-v2
Update go-toml to v2
2023-09-25 08:52:15 -04:00
Derek McGowan
650148313c
Add warning log for unknown config fields
Add error log for failure to parse toml

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-24 20:50:54 -07:00
Derek McGowan
f11033174e
Merge pull request #9129 from kinvolk/rata/userns-doc
docs/userns: Clarify requirements for k8s 1.25/1.26
2023-09-22 22:22:58 -07:00
Derek McGowan
b5615caf11
Update go-toml to v2
Updates host file parsing to use new v2 method rather than the removed
toml.Tree.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-22 15:35:12 -07:00
Derek McGowan
e0e6f870b7
Merge pull request #9086 from dmcgowan/move-to-log-repo
Use github.com/containerd/log
2023-09-22 09:25:29 -07:00
Derek McGowan
8b413daff0
Remove log package except for exported const used by hcsshim
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-22 07:53:23 -07:00
Derek McGowan
2f1b92710a
Update zfs library to use new log repository
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-22 07:53:23 -07:00
Derek McGowan
508aa3a1ef
Move to use github.com/containerd/log
Add github.com/containerd/log to go.mod

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-22 07:53:23 -07:00
Rodrigo Campos
f1070c4e18 docs/userns: Clarify requirements for k8s 1.25/1.26
crun 1.4.3 as well as runc 1.1 both support to open bind-mounts before
dropping privileges, as they are inaccessible after switching to the
user namespace. So that is the minimum version to use with containerd
1.7.

Also, since containerd 2.0 we use idmap mounts for files mounted in the
container created by containerd (like etc/hostname, etc/hosts, etc.), so
in that case we require newer OCI runtimes too. However, as the kubelet
doesn't request idmap mounts for kube volumes, we can lower the kernel
version.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2023-09-22 15:52:38 +02:00
Fu Wei
7a0e6b7e77
Merge pull request #9112 from adityaramani/handle-shim-kill
Sandbox: Handle unexpected shim kill events
2023-09-22 13:31:11 +08:00
Akihiro Suda
3ebe5d1c56
Merge pull request #9124 from dmcgowan/cri-image-store-no-client
Update CRI image store to not use containerd client
2023-09-21 19:17:21 +09:00
Davanum Srinivas
b101cad15c
Merge pull request #9126 from bryantbiggs/fix/add-containerd-namespace
fix: Add `containerd` to the message type reference
2023-09-20 22:51:43 -04:00
Samuel Karp
87671c2dee
Merge pull request #9122 from henry118/netns-doc 2023-09-20 16:25:15 -07:00
Bryant Biggs
42eee8bf05 fix: Add containerd to the message type reference
Signed-off-by: Bryant Biggs <bryantbiggs@gmail.com>
2023-09-20 16:32:05 -04:00
Derek McGowan
c3694aaf87
Merge pull request #9093 from thaJeztah/swap_log_pkg_alias
alias log package to github.com/containerd/log v0.1.0, and (soft)deprecate
2023-09-20 11:45:59 -07:00
Derek McGowan
9e819fb4a8
Update CRI image store to not use containerd client
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-20 10:11:51 -07:00
Henry Wang
dcb2e7447b Improve doc of func NewNetNS
Signed-off-by: Henry Wang <henwang@amazon.com>
2023-09-20 17:00:33 +00:00
Fu Wei
782ad19f6c
Merge pull request #8356 from dmcgowan/drop-inheritable-capabilities
Support for dropping inheritable capabilities
2023-09-20 09:40:45 +08:00
Derek McGowan
2ce971d890
Add delete target to image remove
Adds atomicity to image delete when deleting from a list.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-19 17:23:33 -07:00
Derek McGowan
f8fb2dad39
api: update image service to support target in delete request
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-19 17:17:16 -07:00
Rodrigo Campos
8e3722c7d1 CI: Set slow_chown for overlayfs snapshotter
Userns requires idmap mounts or to opt-in for a slow and expensive
chown. As idmap mounts support for overlayfs was merged in 5.19, let's
add the slow_chown config for our CI.

The config is harmless to keep it in new kernels, as if idmap mounts is
supported, it will be just used. Whenever all our CI is run with kernels
>= 5.19, we can remove this setting.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2023-09-19 17:55:47 +02:00
Rodrigo Campos
46d3094aa3 docs/userns: Fix small typo
Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2023-09-19 16:37:40 +02:00
Rodrigo Campos
d008d64a8f docs/userns: Clarify containerd 1.7 limitations
Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2023-09-19 16:37:40 +02:00
Rodrigo Campos
e379082000 docs/userns: Document the need to opt-in for a slow chown
Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2023-09-19 16:37:40 +02:00
Rodrigo Campos
8bf8e2b975 snapshotter: Use capa prefix consistently for capabilities
The overlay snapshotter is using capa, not capab, let's use that in all
the palces.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2023-09-19 14:42:51 +02:00
Rodrigo Campos
ec9e0dca91 overlay: Require opt-in if idmap mounts are not supported.
If we don't use idmap mounts, doing a chown per pod is very expensive:
it implies duplicating the container storage for the image for every pod
and the latency to start a new pod is affected too.

Let's make sure users are aware of this, by having them opt-in, for
snapshotters that we have a better solution (like overlayfs, that has
support for idmap mounts).

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2023-09-19 14:42:51 +02:00
Sebastiaan van Stijn
03b9ce56b5
deprecate logs package, but disable linter (for transitioning)
Deprecate the pacakge, but suppress linting errors for now. This is to allow
backporting these changes to release branches, which may still need to transition.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-19 08:44:35 +02:00
Sebastiaan van Stijn
d69ae811d6
alias log package to github.com/containerd/log v0.1.0
This "soft" deprecates the package, but keeps the local uses of the package,
which can make backporting this to release-branches easier (we can
still move all uses in those branches as well though).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-19 08:44:10 +02:00
Akihiro Suda
00666764b8
Merge pull request #9102 from dmcgowan/add-usage-package
Add usage package
2023-09-19 11:24:26 +09:00
Bjorn Neergaard
6c6dfcbce2
contrib/apparmor: deny /sys/devices/virtual/powercap
While this is not strictly necessary as the default OCI config masks this
path, it is possible that the user disabled path masking, passed their
own list, or is using a forked (or future) daemon version that has a
modified default config/allows changing the default config.

Add some defense-in-depth by also masking out this problematic hardware
device with the AppArmor LSM.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-09-18 16:57:09 -06:00
Bjorn Neergaard
106a9b7767
oci/spec: deny /sys/devices/virtual/powercap
The ability to read these files may offer a power-based sidechannel
attack against any workloads running on the same kernel.

This was originally [CVE-2020-8694][1], which was fixed in
[949dd0104c496fa7c14991a23c03c62e44637e71][2] by restricting read access
to root. However, since many containers run as root, this is not
sufficient for our use case.

While untrusted code should ideally never be run, we can add some
defense in depth here by masking out the device class by default.

[Other mechanisms][3] to access this hardware exist, but they should not
be accessible to a container due to other safeguards in the
kernel/container stack (e.g. capabilities, perf paranoia).

[1]: https://nvd.nist.gov/vuln/detail/CVE-2020-8694
[2]: 949dd0104c
[3]: https://web.eece.maine.edu/~vweaver/projects/rapl/

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-09-18 16:56:11 -06:00
Aditya Ramani
729c97cf39 Handle unexpected shim kill events
When a shim process is unexpectedly killed in a way that was not initiated through containerd - containerd reports the pod as not ready but the containers as running. This results in kubelet repeatedly sending container kill requests that fail since containerd cannot connect to the shim.

Changes:

- In the container exit handler, treat `err: Unavailable` as if the container has already exited out
- When attempting to get a connection to the shim, if the controller isn't available assume that the shim has been killed (needs to be done since we have a separate exit handler that cleans up the reference to the shim controller - before kubelet has the chance to call StopPodSandbox)

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
2023-09-18 12:15:55 -07:00