Commit Graph

1040 Commits

Author SHA1 Message Date
Iceber Gu
f37ae8fc35
move to v3.4.1 for the pause image
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2021-03-07 15:21:20 +08:00
Iceber Gu
92ab1a63b0 cri: fix container status
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2021-03-05 00:00:10 +08:00
f00231050
591caece0c cri: check fsnotify watcher when receiving cni conf dir events
carry: 612f5f9f44

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-03-03 16:46:41 +08:00
Phil Estes
8dbe53a2a9
Merge pull request #5070 from yoheiueda/empty-masked
cri: set default masked/readonly paths to empty paths
2021-02-25 15:38:45 -05:00
Akihiro Suda
7ee610edb5
drop dependency on github.com/syndtr/gocapability
pkg/cap has the full list of the caps (for UT, originally),
so we can drop dependency on github.com/syndtr/gocapability

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-02-25 15:17:28 +09:00
Akihiro Suda
9822173354
cap: rename FromUint64 to FromBitmap
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-02-25 15:02:10 +09:00
Yohei Ueda
07f1df4541
cri: set default masked/readonly paths to empty paths
Fixes #5029.

Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
2021-02-24 23:50:40 +09:00
Phil Estes
757be0a090
Merge pull request #5017 from AkihiroSuda/parse-cap
oci.WithPrivileged: set the current caps, not the known caps
2021-02-23 09:10:57 -05:00
Mike Brown
9173d3e929
Merge pull request #5021 from wzshiming/fix/signal_repeatedly
Fix repeated sending signal
2021-02-22 09:45:56 -06:00
Justin Terry (SF)
06e4e09567 cri: append envs from image config to empty slice to avoid env lost
Signed-off-by: Justin Terry (SF) <juterry@microsoft.com>
2021-02-18 16:39:28 -08:00
Phil Estes
c32ccdf8be
Merge pull request #5024 from yadzhang/deepcopy-imageconfig
cri: append envs from image config to empty slice to avoid env lost
2021-02-18 12:51:51 -05:00
Akihiro Suda
746cef0bc2
Merge pull request #5044 from wzshiming/fix/empty-error-warpping
Fix empty error warpping
2021-02-18 13:47:13 +09:00
zhangyadong.0808
08318b1ab9 cri: append envs from image config to empty slice to avoid env lost
Signed-off-by: Yadong Zhang <yadzhang@gmail.com>
2021-02-18 11:37:41 +08:00
Shiming Zhang
59db8a10e0 Fix empty error warpping
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2021-02-18 11:06:59 +08:00
Shiming Zhang
dc6f5ef3b9 Fix repeated sending signal
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2021-02-17 21:33:49 +08:00
Michael Crosby
41e3057cc6
Merge pull request #5025 from jeremyje/win20h2
Add references to Windows 20H2 test images.
2021-02-12 11:58:49 -05:00
Lorenz Brun
36d0bc1f2b Allow moving netns directory into StateDir
Signed-off-by: Lorenz Brun <lorenz@nexantic.com>
2021-02-10 18:33:14 +01:00
Akihiro Suda
a2d1a8a865
oci.WithPrivileged: set the current caps, not the known caps
This change is needed for running the latest containerd inside Docker
that is not aware of the recently added caps (BPF, PERFMON, CHECKPOINT_RESTORE).

Without this change, containerd inside Docker fails to run containers with
"apply caps: operation not permitted" error.

See kubernetes-sigs/kind 2058

NOTE: The caller process of this function is now assumed to be as
privileged as possible.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-02-10 17:14:17 +09:00
Michael Crosby
e874e2597e [cri] add pod annotations to CNI call
Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-02-09 13:24:01 -05:00
Jeremy Edwards
1c81071d39 Add references to Windows 20H2 test images.
Signed-off-by: Jeremy Edwards <1312331+jeremyje@users.noreply.github.com>
2021-02-09 16:25:36 +00:00
Derek McGowan
b3f2402062
Merge pull request #5002 from crosbymichael/anno-image-name
[cri] add image-name annotation
2021-02-05 08:27:41 -08:00
Akihiro Suda
e908be5b58
Merge pull request #5001 from kzys/no-lint-upgrade 2021-02-06 00:40:38 +09:00
Kazuyoshi Kato
07db46ee23 lint: update nolint syntax for golangci-lint
Newer golangci-lint needs explicit `//` separator. Otherwise it treats
the entire line (`staticcheck deprecated ... yet`) as a name.

https://golangci-lint.run/usage/false-positives/#nolint

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-02-04 11:59:55 -08:00
Sebastiaan van Stijn
04d061fa6a
update runc to v1.0.0-rc93
full diff: https://github.com/opencontainers/runc/compare/v1.0.0-rc92...v1.0.0-rc93

also removes dependency on libcontainer/configs

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 16:13:30 +01:00
Sebastiaan van Stijn
54cc3483ff
pkg/cri/server: don't import libcontainer/configs
Looks like this import was not needed for the test; simplified the test
by just using the device-path (a counter would work, but for debugging,
having the list of paths can be useful).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 16:08:39 +01:00
Michael Crosby
99cb62f233 [cri] add image-name annotation
For some tools having the actual image name in the annotations is helpful for
debugging and auditing the workload.

Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-02-04 07:05:11 -05:00
Lantao Liu
b5bf1fd5d8 Fix deprecated registry auth conversion.
Signed-off-by: Lantao Liu <lantaol@google.com>
2021-02-03 19:22:26 -08:00
Aditi Sharma
1423e9199d Update gogo/protobuf to v1.3.2
bump version 1.3.2 for gogo/protobuf due to CVE-2021-3121 discovered
in gogo/protobuf version 1.3.1, CVE has been fixed in 1.3.2

Signed-off-by: Aditi Sharma <adi.sky17@gmail.com>
2021-01-28 12:57:50 +00:00
Michael Crosby
591d7e2fb1 remove exec sync debug contents from logs
This was dumping untrusted output to the debug logs from user containers.
We should not dump this type of information to reduce log sizes and any
information leaks from user containers.

Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-01-26 14:57:54 -05:00
Alban Crequy
28e4fb25f4 cri: add annotations for pod name and namespace
cri-o has annotations for pod name, namespace and container name:
https://github.com/containers/podman/blob/master/pkg/annotations/annotations.go

But so far containerd had only the container name.

This patch will be useful for seccomp agents to have a different
behaviour depending on the pod (see runtime-spec PR 1074 and runc PR
2682). This should simplify the code in:
b2d423695d/pkg/kuberesolver/kuberesolver.go (L16-L27)

Signed-off-by: Alban Crequy <alban@kinvolk.io>
2021-01-26 12:10:39 +01:00
Wei Fu
e56de63099 cri: handle sandbox/container exit event separately
The event monitor handles exit events one by one. If there is something
wrong about deleting task, it will slow down the terminating Pods. In
order to reduce the impact, the exit event watcher should handle exit
event separately. If it failed, the watcher should put it into backoff
queue and retry it.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-01-24 13:43:38 +08:00
Shengjing Zhu
2818fdebaa Move runtimeoptions out of cri package
Since it's a standard set of runtime opts, and used in ctr as well,
it could be moved out of cri.

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2021-01-23 01:24:35 +08:00
Michael Crosby
a731039238 [cri] label etc files for selinux containers
Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-01-19 13:42:09 -05:00
Mike Brown
550b4949cb
Merge pull request #4700 from mikebrow/cri-security-profile-update
CRI security profile update for CRI graduation
2021-01-12 12:21:56 -06:00
Sebastiaan van Stijn
2374178c9b
pkg/cri/server: optimizations in unmountRecursive()
Use a PrefixFilter() to get only the mounts we're interested in,
which removes the need to manually filter mounts from the mountinfo
results.

Additional optimizations can be made, as:

> ... there's a little known fact that `umount(MNT_DETACH)` is actually
> recursive in Linux, IOW this function can be replaced with
> `unix.Umount(target, unix.MNT_DETACH)` (or `mount.UnmountAll(target, unix.MNT_DETACH)`
>  (provided that target itself is a mount point).

e8fb2c392f (r535450446)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-01-08 17:32:01 +01:00
Sebastiaan van Stijn
7572919201
mount: remove remaining uses of mount.Self()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-01-08 17:31:59 +01:00
Davanum Srinivas
1f5b84f27c
[CRI] Reduce clutter of log entries during process execution
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-01-06 13:09:03 -05:00
Shengjing Zhu
5988bfc1ef docs: Various typo found by codespell
Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2020-12-22 13:22:16 +08:00
Michael Crosby
2e442ea485 [cri] ensure log dir is created
containerd is responsible for creating the log but there is no code to ensure
that the log dir exists.  While kubelet should have created this there can be
times where this is not the case and this can cause stuck tasks.

Signed-off-by: Michael Crosby <michael@thepasture.io>
2020-12-17 15:04:39 -05:00
Akihiro Suda
7e6e4c466f
remove "selinux" build tag
The build tag was removed in go-selinux v1.8.0: opencontainers/selinux#132

Related: remove "apparmor" build tag: 0a9147f3aa

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-12-15 20:05:25 +09:00
Akihiro Suda
0a9147f3aa
remove "apparmor" build tag
The "apparmor" build tag does not have any cgo dependency and can be removed safely.

Related: https://github.com/opencontainers/runc/issues/2704

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-12-08 19:22:39 +09:00
Mike Brown
6467c3374d refactor based on comments
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2020-12-07 21:39:31 -06:00
Phil Estes
73a301c7a1
Merge pull request #4772 from gaurav1086/ValidatePluginConfig_fix_range_iterator_issue
[cri/config] : fix range iterator issue in ValidatePluginConfig
2020-12-07 12:42:07 -05:00
Phil Estes
efad13faaf
Merge pull request #4811 from AkihiroSuda/expose-apparmor
expose hostSupportsAppArmor()
2020-12-07 08:22:16 -05:00
Akihiro Suda
55eda46b22
expose hostSupportsAppArmor()
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-12-07 19:12:59 +09:00
Gaurav Singh
071a185506 cri/config: fix range iterator issue in ValidatePluginConfig
Go uses the same address variable while iterating in a range,
so use a copy when using its address.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
2020-12-04 17:37:09 -05:00
Mike Brown
b4727eafbe adding code to support seccomp apparmor securityprofile
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2020-12-04 15:15:32 -06:00
Michael Crosby
3d358c9df3 [cri] don't clear base security settings
When a base runtime spec is being used, admins can configure defaults for the
spec so that default ulimits or other security related settings get applied for
all containers launched.

Signed-off-by: Michael Crosby <michael@thepasture.io>
2020-12-02 06:51:37 -05:00
Shengjing Zhu
fe767f95c7 Fix package name in cri runtimeoptions protobuf
Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2020-11-22 16:15:34 +08:00
Maksym Pavlenko
2837fb35a7
Merge pull request #4715 from thaJeztah/remove_libcontainer_apparmor
pkg/cri/server: remove dependency on libcontainer/apparmor, libcontainer/utils
2020-11-18 14:34:48 -08:00
Sebastiaan van Stijn
eba94a15c8
pkg/cri/server: remove dependency on libcontainer/apparmor, libcontainer/utils
recent versions of libcontainer/apparmor simplified the AppArmor
check to only check if the host supports AppArmor, but no longer
checks if apparmor_parser is installed, or if we're running
docker-in-docker;

bfb4ea1b1b

> The `apparmor_parser` binary is not really required for a system to run
> AppArmor from a runc perspective. How to apply the profile is more in
> the responsibility of higher level runtimes like Podman and Docker,
> which may do the binary check on their own.

This patch copies the logic from libcontainer/apparmor, and
restores the additional checks.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-11-12 15:42:25 +01:00
Jacob Blain Christen
a1e7dd939d cri: selinuxrelabel=false for /dev/shm w/ host ipc
This is a followup to #4699 that addresses an oversight that could cause
the CRI to relabel the host /dev/shm, which should be a no-op in most
cases. Additionally, fixes unit tests to make correct assertions for
/dev/shm relabeling.

Discovered while applying the changes for #4699 to containerd/cri 1.4:
https://github.com/containerd/cri/pull/1605

Signed-off-by: Jacob Blain Christen <jacob@rancher.com>
2020-11-11 15:22:17 -07:00
Jacob Blain Christen
e8d8ae3b97 cri: selinux relabel /dev/shm
Address an issue originally seen in the k3s 1.3 and 1.4 forks of containerd/cri, https://github.com/rancher/k3s/issues/2240

Even with updated container-selinux policy, container-local /dev/shm
will get mounted with container_runtime_tmpfs_t because it is a tmpfs
created by the runtime and not the container (thus, container_runtime_t
transition rules apply). The relabel mitigates such, allowing envoy
proxy to work correctly (and other programs that wish to write to their
/dev/shm) under selinux.

Tested locally with:
- SELINUX=Enforcing vagrant up --provision-with=shell,selinux,test-integration
- SELINUX=Enforcing CRITEST_ARGS=--ginkgo.skip='HostIpc is true' vagrant up --provision-with=shell,selinux,test-cri
- SELINUX=Permissive CRITEST_ARGS=--ginkgo.focus='HostIpc is true' vagrant up --provision-with=shell,selinux,test-cri

Signed-off-by: Jacob Blain Christen <jacob@rancher.com>
2020-11-06 12:05:17 -07:00
Sebastiaan van Stijn
1146098421
replace pkg/symlink with moby/sys/symlink
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-30 00:05:15 +01:00
Derek McGowan
5184bccea3
Merge pull request #4631 from dims/copy-a-few-packages-from-moby/moby
Copy pkg/symlink and pkg/truncindex from moby/moby
2020-10-29 09:13:30 -07:00
Wei Fu
f2e8fda82b
Merge pull request #4665 from dmcgowan/update-default-snapshot-annotations
Update make snapshot annotations disabled by default
2020-10-28 21:12:02 +08:00
Derek McGowan
b2642458f9
Update make snapshot annotations disabled by default
This experimental feature should not be enabled by default as
it is not used by any default snapshotters.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-10-27 21:32:25 -07:00
Akihiro Suda
8ff2707a3c
Merge pull request #4610 from shahzzzam/samashah/add-annotations
Add manifest digest annotation for snapshotters
2020-10-28 13:11:49 +09:00
zhuangqh
30c9addd6c fix: always set unknown to false when handling exit event
Signed-off-by: jerryzhuang <zhuangqhc@gmail.com>
2020-10-27 10:50:15 +08:00
Davanum Srinivas
a9cb22309a
Copy pkg/symlink and pkg/truncindex from moby/moby
moby/moby SHA : 9c15e82f19b0ad3c5fe8617a8ec2dddc6639f40a

github.com/docker/docker/pkg/truncindex/truncindex.go -> pkg/cri/store/truncindex/truncindex.go
github.com/docker/docker/pkg/symlink/LICENSE.APACHE -> pkg/symlink/LICENSE.APACHE
github.com/docker/docker/pkg/symlink/LICENSE.BSD -> pkg/symlink/LICENSE.BSD
github.com/docker/docker/pkg/symlink/README.md -> pkg/symlink/README.md
github.com/docker/docker/pkg/symlink/fs.go -> pkg/symlink/fs.go
github.com/docker/docker/pkg/symlink/fs_unix.go -> pkg/symlink/fs_unix.go
github.com/docker/docker/pkg/symlink/fs_windows.go -> pkg/symlink/fs_windows.go

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-10-15 08:36:35 -04:00
Daniel Canter
cdb2f9c66f Filter snapshotter labels passed to WithNewSnapshot
Made a change yesterday that passed through snapshotter labels into the wrapper of
WithNewSnapshot, but it passed the entirety of the annotations into the snapshotter.
This change just filters the set that we care about down to snapshotter specific
labels.

Will probably be future changes to add some more labels for LCOW/WCOW and the corresponding
behavior for these new labels.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2020-10-15 04:49:39 -07:00
Phil Estes
9b70de01d6
Merge pull request #4630 from dcantah/pass-snapshotter-opt
Cri - Pass snapshotter labels into customopts.WithNewSnapshot
2020-10-14 10:54:06 -04:00
Daniel Canter
9a1f6ea4dc Cri - Pass snapshotter labels into customopts.WithNewSnapshot
Previously there wwasn't a way to pass any labels to snapshotters as the wrapper
around WithNewSnapshot didn't have a parm to pass them in.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2020-10-14 04:14:03 -07:00
Daniel Canter
d74225b588 Fix comment in RemovePodSandbox
Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2020-10-12 17:59:08 -07:00
zhangjianming
116902cd21 fix no-pivot not working in io.containerd.runtime.v1.linux
Signed-off-by: zhangjianming <zhang.jianming7@zte.com.cn>
2020-10-12 09:39:59 +08:00
Maksym Pavlenko
3d02441a79 Refactor pkg packages
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2020-10-08 17:30:17 -07:00
Akihiro Suda
915263f269
Merge pull request #4502 from akshat-kmr/master
Add logging binary support when terminal is true
2020-10-08 12:14:39 +09:00
Samarth Shah
5fc721370d Add manifest digest annotation for snapshotters
Signed-off-by: Samarth Shah <samarthmshah@gmail.com>
2020-10-07 23:12:01 +00:00
Maksym Pavlenko
3508ddd3dd Refactor CRI packages
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2020-10-07 14:45:57 -07:00
Derek McGowan
b22b627300
Move cri server packages under pkg/cri
Organizes the cri related server packages under pkg/cri

Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-10-07 13:09:37 -07:00
Derek McGowan
1c60ae7f87
Use local version of cri packages
Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-10-07 10:59:40 -07:00
Derek McGowan
e7a350176a
Merge containerd/cri into containerd/containerd
Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-10-07 10:58:39 -07:00
Derek McGowan
0820015314 Prepare cri for merge to containerd
Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-10-07 10:58:39 -07:00
Michael Crosby
a0b3b4e4da
Merge pull request #1593 from moolen/fix/add-nri-labels
Add missing sandbox labels when invoking nri
2020-10-07 13:17:06 -04:00
Derek McGowan
07c98d0bf1 Fix lint in Unix environments
Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-10-05 17:46:01 -07:00
Moritz Johner
f87302ab20 Add missing sandbox labels when invoking nri plugins
Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>
2020-10-03 23:30:09 +02:00
Derek McGowan
a3c0e8859c Align lint checks with containerd
Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-09-30 23:17:46 -07:00
Derek McGowan
83e6efc6fc Use tabs in protofile indentation
This is enforced as part of containerd's fmt checks

Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-09-30 21:50:33 -07:00
Mike Brown
2e3bebb297
Merge pull request #1583 from thaJeztah/simplify_ensure_removeall_windows
pkg/server: make ensureRemoveAll() an alias for os.RemoveAll() on Windows
2020-09-28 14:26:18 -05:00
Mike Brown
b1ee4c0d7b
Merge pull request #1570 from yoheiueda/masked
Set masked and readonly paths based on default Unix spec
2020-09-24 15:45:58 -05:00
Sebastiaan van Stijn
e2928124d1
pkg/server: make ensureRemoveAll() an alias for os.RemoveAll() on Windows
The tricks performed by ensureRemoveAll only make sense for Linux and
other Unices, so separate it out, and make ensureRemoveAll for Windows
just an alias of os.RemoveAll.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-09-22 10:11:46 +02:00
ktock
e571fd864f Limit value size of additional annotation for avoiding unpack failure
In containerd, there is a size limit for label size (4096 chars).
Currently if an image has many layers (> (4096-39)/72 > 56),
`containerd.io/snapshot/cri.image-layers` will hit the limit of label size and
the unpack will fail.
This commit fixes this by limiting the size of the annotation.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2020-09-15 22:47:28 +09:00
Yohei Ueda
b582da4438
Set masked and readonly paths based on default Unix spec
The default values of masked and readonly paths are defined
in populateDefaultUnixSpec, and are used when a sandbox is
created.  It is not, however, used for new containers.  If
a container definition does not contain a security context
specifying masked/readonly paths, a container created from
it does not have masked and readonly paths.

This patch applies the default values to masked and
readonly paths of a new container, when any specific values
are not specified.

Fixes #1569

Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
2020-09-09 23:13:05 +09:00
Michael Crosby
d715d00906 Handle KVM based runtimes with selinux
Signed-off-by: Michael Crosby <michael@thepasture.io>
2020-08-26 21:38:03 -04:00
Akshat Kumar
7a9fbec5fb Add logging binary support when terminal is true
Currently the shims only support starting the logging binary process if the
io.Creator Config does not specify Terminal: true. This means that the program
using containerd will only be able to specify FIFO io when Terminal: true,
rather than allowing the shim to fork the logging binary process. Hence,
containerd consumers face an inconsistent behavior regarding logging binary
management depending on the Terminal option.

Allowing the shim to fork the logging binary process will introduce consistency
between the running container and the logging process. Otherwise, the logging
process may die if its parent process dies whereas the container will keep
running, resulting in the loss of container logs.

Signed-off-by: Akshat Kumar <kshtku@amazon.com>
2020-08-25 17:28:29 -07:00
Derek McGowan
56a89cda34
Merge pull request #1552 from crosbymichael/nri
Add experimental NRI injection points
2020-08-24 13:58:11 -07:00
Antonio Ojea
1403a391c3 bump cni dependencies
Signed-off-by: Antonio Ojea <aojea@redhat.com>
2020-08-21 18:00:20 +02:00
Michael Crosby
63f89eb954 Update server with nri injection points
This allows development with container to be done for NRI without the need for
custom builds.

This is an experimental feature and is not enabled unless a user has a global
`/etc/nri/conf.json` config setup with plugins on the system.  No NRI code will
be executed if this config file does not exist.

Signed-off-by: Michael Crosby <michael@thepasture.io>
2020-08-20 08:10:09 -04:00
Akihiro Suda
7332e2ad2e
remove libseccomp cgo dependency
The CRI plugin was depending on libseccomp cgo dependency via
libseccomp-golang via libcontainer.

https://github.com/seccomp/libseccomp-golang/blob/v0.9.1/seccomp_internal.go#L17

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-07-30 18:51:23 +09:00
Mike Brown
8a2d1cc802 adds support for pod id lookup for filter
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2020-07-29 15:23:22 -05:00
ktock
c80660b82b Allow GC to discard content after successful pull and unpack
This commit adds a config flag for allowing GC to clean layer contents up after
unpacking these contents completed, which leads to deduplication of layer
contents between the snapshotter and the contnet store.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2020-07-28 09:05:47 +09:00
Michael Crosby
5f5d954b6a add selinux category range to config
This allows an admin to set the upper bounds on the category range for selinux
labels.  This can be useful when handling allocation of PVs or other volume
types that need to be shared with selinux enabled on the hosts and volumes.

Signed-off-by: Michael Crosby <michael@thepasture.io>
2020-07-20 16:02:07 -04:00
Akihiro Suda
707d2c49d1
allow disabling hugepages
This helps with running rootless mode + cgroup v2 + systemd without hugetlb delegation.
Systemd does not (and will not, perhaps) support hugetlb delegation as of systemd v245. https://github.com/systemd/systemd/
issues/14662

From 502bc5427e/src/patches/containerd/0001-DIRTY-VENDOR-cri-allow-disabling-hugepages.patch

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-07-16 11:46:25 +09:00
James Sturtevant
2bb0b19c4b Update to latest pause image for windows
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2020-07-15 11:45:21 -07:00
Mike Brown
4b3974c4e9 show runc options tag
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2020-07-10 16:33:36 -05:00
Abhishek Kulkarni
287c52d1c6 Forcibly stop running containers before removal
Signed-off-by: Abhishek Kulkarni <abd.kulkarni@gmail.com>
2020-07-04 15:49:00 -05:00
Akihiro Suda
fb208d015a
vendor runc v1.0.0-rc91
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-07-03 14:03:21 +09:00
Akihiro Suda
fe6833a9a4
config: TolerateMissingHugePagesCgroupController -> TolerateMissingHugetlbController
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-07-02 13:49:42 +09:00
Akihiro Suda
b69d7bdc5f
config: fix TOML tag for TolerateMissingHugePagesCgroupController
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-07-02 13:38:19 +09:00
Mike Brown
c2191fddd7
Merge pull request #1513 from brianpursley/state-name
Change "failed to stop sandbox" error message to use state name instead of numeric value
2020-06-27 16:08:27 -05:00
Brian Pursley
aa04fc9d53 Change "failed to stop sandbox" error message to use state name instead of numeric value
Signed-off-by: Brian Pursley <bpursley@cinlogic.com>
2020-06-27 16:45:08 -04:00
Kevin Parsons
210561a8e3 Support named pipe mounts for Windows containers
Adds support to mount named pipes into Windows containers. This support
already exists in hcsshim, so this change just passes them through
correctly in cri. Named pipe mounts must start with "\\.\pipe\".

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2020-06-25 12:01:08 -07:00
Mike Brown
f5c7ac9272 fix for image pull linter change
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2020-06-24 18:10:31 -05:00
Davanum Srinivas
3ee62de2bf
remove unused method
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-06-22 15:03:47 -04:00
Davanum Srinivas
cbb7c28f19
Add copyright headers
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-06-22 14:49:13 -04:00
Davanum Srinivas
e2072b71cc
Copy kubernetes/pkg/util/bandwidth
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-06-22 14:48:25 -04:00
Davanum Srinivas
2909022a6e
Make local copy of kubelet/cri/streaming
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-06-22 13:54:34 -04:00
Davanum Srinivas
41f184f15b
Update vendor.conf to kubernetes 1.19.0-beta.2
update streaming import path
switch remote package path

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-06-22 08:44:49 -04:00
Michael Crosby
6164822714
Merge pull request #1508 from janosi/sctp-hostport
Remove the protocol filter from the HostPort management
2020-06-15 14:48:37 -04:00
Mike Brown
b661ad711e
Merge pull request #1504 from lorenz/ignore-image-defined-volumes
Add option for ignoring volumes defined in images
2020-06-14 11:52:48 -05:00
Mike Brown
26dc5b9772
Merge pull request #1505 from dcantah/windows-cred-spec
Add GMSA credential spec passing
2020-06-14 11:52:33 -05:00
Laszlo Janosi
479dfbac45
Remove the protocol filter from the portMappings constructor.
Reason: originally it was introduced to prevent the loading of the SCTP kernel module on the nodes. But iptables chain creation alone does not load the kernel module. The module would be loaded if an SCTP socket was created, but neither cri nor the portmap CNI plugin starts managing SCTP sockets if hostPort / portmappings are defined.
Signed-off-by: Laszlo Janosi <laszlo.janosi@ibm.com>
2020-06-14 15:48:00 +00:00
Kenta Tada
730b7a932e Change the type of PdeathSignal
Use x/sys as same as runtime/v1/linux/runtime.go

Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2020-06-11 11:35:51 +09:00
Daniel Canter
9620b2e1da Add GMSA Credential Spec passing
Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2020-06-10 11:15:07 -07:00
Lorenz Brun
5a1d49b063 Add option for ignoring volumes defined in images
Signed-off-by: Lorenz Brun <lorenz@brun.one>
2020-06-09 21:02:47 +02:00
Brian Goff
c694c63176 Add config for registry http headers
This adds a configuration knob for adding request headers to all
registry requests. It is not namespaced to a registry.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-06-08 18:56:15 -07:00
Gaurav Singh
7213cd89d6 Process I/O: Fix goroutine leak
Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
2020-06-07 17:38:36 -04:00
Davanum Srinivas
d7ce093d63
Tolerate missing HugeTLB cgroups controller
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-06-01 12:07:32 -04:00
Akihiro Suda
2f601013e6 cgroup2: implement containerd.events.TaskOOM event
How to test (from https://github.com/opencontainers/runc/pull/2352#issuecomment-620834524):
  (host)$ sudo swapoff -a
  (host)$ sudo ctr run -t --rm --memory-limit $((1024*1024*32)) docker.io/library/alpine:latest foo
  (container)$ sh -c 'VAR=$(seq 1 100000000)'

An event `/tasks/oom {"container_id":"foo"}` will be displayed in `ctr events`.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-06-01 14:00:13 +09:00
Maksym Pavlenko
17c61e36cb Fix cgroups path for base OCI spec
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2020-05-29 11:40:12 -07:00
Maksym Pavlenko
8d54f39753 Allow specify base OCI runtime spec
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2020-05-28 13:39:31 -07:00
Michael Crosby
72edf3016d Use new SELinux APIs
This moves most of the API calls off of the `labels` package onto the root
selinux package.  This is the newer API for most selinux operations.

Signed-off-by: Michael Crosby <michael@thepasture.io>
2020-05-26 15:18:46 -04:00
Darren Shepherd
24209b91bf Add MCS label support
Carry of #1246

Signed-off-by: Darren Shepherd <darren@rancher.com>
Signed-off-by: Michael Crosby <michael@thepasture.io>
2020-05-20 13:59:51 -05:00
Sascha Grunert
e2cedb9469
Increase port-forward timeout to 1s to fix e2e test
We encountered two failing end-to-end tests after the adoption of
https://github.com/containerd/cri/pull/1470 in
https://github.com/cri-o/cri-o/pull/3749:

```
Summarizing 2 Failures:
[Fail] [sig-cli] Kubectl Port forwarding With a server listening on 0.0.0.0 that expects a client request [It] should support a client that connects,
sends DATA, and disconnects
test/e2e/kubectl/portforward.go:343

[Fail] [sig-cli] Kubectl Port forwarding With a server listening on localhost that expects a client request [It] should support a client that connects
, sends DATA, and disconnects
test/e2e/kubectl/portforward.go:343
```

Increasing the timeout to 1s fixes the issue.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-05-12 12:43:14 +02:00
Derek McGowan
21ad9c4e21 Use digestset from go-digest
Removes docker/distribution dependency

Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-05-11 14:17:34 -07:00
payall4u
b437938d2f
Transfer error to ErrNotFound when kill a not exist container, also add
test case.

Signed-off-by: payall4u <404977848@qq.com>

Add integration test case

Signed-off-by: payall4u <404977848@qq.com>
2020-05-11 21:53:43 +08:00
Wei Fu
8252e54f93
Merge pull request #1472 from mxpv/profile
Add config flag to default empty seccomp profile
2020-05-11 10:16:00 +08:00
Mike Brown
bd0a76565a
Merge pull request #1469 from thaJeztah/remove_libcontainer_system
Remove dependency on libcontainer/system
2020-05-10 19:33:17 -05:00
Derek McGowan
dbedcf8706
Merge pull request #1449 from mikebrow/make-http-with-tlsconfig-a-warning
removes the error when tls is configured for https but http is tried first
2020-05-10 16:09:41 -07:00
Sebastiaan van Stijn
0e1b7bdb59
Remove dependency on libcontainer/system
This swaps the RunningInUserNS() function that we're using
from libcontainer/system with the one in containerd/sys.

This removes the dependency on libcontainer/system, given
these were the only functions we're using from that package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-10 21:58:16 +02:00
Maksym Pavlenko
674fe72aa8 Update docs for unset seccomp profile
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2020-05-10 10:46:58 -07:00
Sebastiaan van Stijn
c96373f6d5
newTransport(): remove deprecated DualStack option
The `DualStack` option was deprecated in Go 1.12, and is now enabled by default
(through commit github.com/golang/go@efc185029bf770894defe63cec2c72a4c84b2ee9).

> The Dialer.DualStack field is now meaningless and documented as deprecated.
>
> To disable fallback, set FallbackDelay to a negative value.

The default `FallbackDelay` is 300ms; to make this more explicit, this patch
sets `FallbackDelay` to the default value.

Note that Docker Hub currently does not support IPv6 (DNS for registry-1.docker.io
has no AAAA records, so we should not hit the 300ms delay).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-10 12:39:10 +02:00
Antonio Ojea
11a78d9d0f
don't use socat for port forwarding
use goroutines to copy the data from the stream to the TCP
connection, and viceversa, removing the socat dependency.

Quoting Lantao Liu, the logic is as follow:

When one side (either pod side or user side) of portforward
is closed, we should stop port forwarding.

When one side is closed, the io.Copy use that side as source will close,
but the io.Copy use that side as dest won't.

Signed-off-by: Antonio Ojea <antonio.ojea.garcia@gmail.com>
2020-05-09 00:54:30 +02:00
Maksym Pavlenko
38f19f991e Add config flag to default empty seccomp profile
This changes adds `default_seccomp_profile` config switch to apply default seccomp profile when not provided by k8s.a

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2020-05-08 13:24:38 -07:00
Wei Fu
48e797c77f RunPodSandbox: destroy network if fails or invalid
Should destroy the pod network if fails to setup or return invalid
net interface, especially multiple CNI configurations.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2020-05-01 12:07:33 +08:00
ktock
ca661c8dc9 Pass chained layer digests to snapshotter for parallel snapshot preparation
Currently, CRI plugin passes each layer digest to remote snapshotters
sequentially, which leads to sequential snapshots preparation. But it costs
extra time especially for remote snapshotters which need to connect to the
remote backend store (e.g. registries) for checking the snapshot existence on
each preparation.

This commit solves this problem by introducing new label
`containerd.io/snapshot/cri.chain` for passing all layer digests in an image to
snapshotters and by allowing them to prepare these snapshots in parallel, which
leads to speed up the preparation.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2020-04-28 15:03:08 +09:00
Mike Brown
4ea4ca99c7
Merge pull request #1455 from 6WIND/master
fix incomplete host device for PrivilegedWithoutHostDevices
2020-04-26 22:28:20 -05:00
Mike Brown
776c125e4f move up to latest critools; add apparmor profile check
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2020-04-26 16:16:48 -05:00
Mike Brown
1b60224e2e use containerd/project header test
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2020-04-22 19:35:37 -05:00
Thibaut Collet
98f8ec4995 fix incomplete host device for PrivilegedWithoutHostDevices
For a privilege pods with PrivilegedWithoutHostDevices set to true
host device specified in the config are not provided (whereas it is done for
non privilege pods or privilege pods with PrivilegedWithoutHostDevices set
to false as all devices are included).

Add them in this case.

Fixes: 3353ab76d9 ("Add flag to overload default privileged host device behaviour")
Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
2020-04-22 18:20:36 +02:00
Mike Brown
9d37687a95
Merge pull request #1436 from chethanah/add-container-name-annot
Support for additional OCI annotations: 'container-name'
2020-04-19 13:19:47 -05:00
Maksym Pavlenko
917e7646ae Add binary IO tests
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2020-04-17 16:50:43 -07:00
Maksym Pavlenko
9175401b28 Cleanup binary IO resources on error
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2020-04-17 15:56:21 -07:00
Maksym Pavlenko
0dc7c85956 Don't use timeout package when stopping shim logger
containerd loads timeout values from config.toml and populated those
values to `timeout` package at launch. So when using `timeout` package
from shim, there are default values and config file is ignored.
So use a hardcoded value for binary IO.

Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2020-04-17 15:06:18 -07:00
yang yang
d07f7f167a add default scheme if endpoint no scheme
Signed-off-by: yang yang <yang8518296@163.com>
2020-04-17 23:33:28 +08:00
Mike Brown
27f911d663 removes the error when tls is configured for https but http is tried first
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2020-04-16 13:23:56 -05:00
ktock
c1b7bcf395 Enable to pass additional handler on pull for stargz-based remote snapshots
Throughout container lifecycle, pulling image is one of the time-consuming
steps. Recently, containerd community started to tackle this issue with
stargz-based remote snapshots, as a non-core
subproject(https://github.com/containerd/stargz-snapshotter).

This snapshotter is implemented as a standard proxy plugin but it requires the
client to pass some additional information (image ref and layer digest) for each
pull operation to query layer contents on the registry. Stargz snapshotter
project provides an image handler to do this and stargz snapshot users need to
pass this handler to containerd client.

This commit enables to use stargz-based remote snapshots through CRI by passing
the handler to containerd client on pull operation.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2020-04-16 20:53:52 +09:00
Chethan Suresh
7fc8652e32 Add OCI annotations for container name
Along with type(Sandbox or Container) and Sandbox name annotations
provide support for additional annotation:
  - Container name

This will help us perform per container operation by comparing it
with pass through annotations (eg. pod metadata annotations from K8s)

Signed-off-by: Chethan Suresh <Chethan.Suresh@sony.com>
2020-04-16 07:14:58 +05:30
Shengjing Zhu
4263229a7b Replace docker/distribution/reference with containerd/reference/docker
Since https://github.com/containerd/containerd/pull/3728
The docker/distribution/reference package is copied into containerd core

Signed-off-by: Shengjing Zhu <i@zhsj.me>
2020-04-16 03:29:58 +08:00
Mike Brown
d531dc492a
Merge pull request #1405 from fuweid/me-async-load-cnicnf
reload cni network config if has fs change events
2020-04-15 13:57:32 -05:00
Mike Brown
aa9b1885b5 fixes bad unit tests when selinux is enabled
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2020-04-15 12:28:11 -05:00
Maksym Pavlenko
0caa233158 Rework shim logger shutdown process
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2020-04-07 12:42:04 -07:00
Wei Fu
4ce334aa49 reload cni network config if has fs change events
With go RWMutex design, no goroutine should expect to be able to
acquire a read lock until the read lock has been released, if one
goroutine call lock.

The original design is to reload cni network config on every single
Status CRI gRPC call. If one RunPodSandbox request holds read lock
to allocate IP for too long, all other RunPodSandbox/StopPodSandbox
requests will wait for the RunPodSandbox request to release read lock.
And the Status CRI call will fail and kubelet becomes NOTReady.

Reload cni network config at every single Status CRI call is not
necessary and also brings NOTReady situation. To lower the possibility
of NOTReady, CRI will reload cni network config if there is any valid fs
change events from the cni network config dir.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2020-04-03 12:28:58 +08:00
Phil Estes
0c78dacbc5
Move isFifo from process/io to sys/ and make public
Make "IsFifo" a public function for use by other parts of containerd
codebase.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2020-03-25 10:44:17 -04:00
Li Yuxuan
cb0140063e Fix goroutine leak when exec/attach
The resize chan is never closed when doing exec/attach now. What's more,
`resize` is a recieved only chan so it can not be closed. Use ctx to
exit the goroutine in `handleResizing` properly.

Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
2020-03-24 10:42:54 +08:00
Sebastiaan van Stijn
e093a0ee08
Use local "ensureRemoveAll" instead of docker/pkg/system
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-12 20:21:14 +01:00
lifubang
488d6194f2 fix dial error when clean up a dead shim
Signed-off-by: lifubang <lifubang@acmcoder.com>
2020-03-12 10:57:55 +08:00
Akihiro Suda
fa72e2f693 cgroup2: do not unshare cgroup namespace for privileged
Conforms to the latest KEP:
0e409b4749/keps/sig-node/20191118-cgroups-v2.md (cgroup-namespace)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-03-09 01:49:04 +09:00
Sebastiaan van Stijn
f2edc6f164
vendor: update gotest.tools v3.0.2
full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-28 17:47:20 +01:00
Brandon Lum
8d5a8355d0 Updated docs and code for default nil behavior
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
2020-02-27 23:42:03 +00:00
Kiril Vladimiroff
4dd75be2b9
Unify dialer implementations
Instead of having several dialer implementations, leave only one in
`pkg/dialer` and call it from `pkg/ttrpcutil`, `runtime/v(1|2)/shim`
which had their own

Closes #3471.

Signed-off-by: Kiril Vladimiroff <kiril@vladimiroff.org>
2020-02-26 23:29:04 +02:00
Brandon Lum
ffcef9dc32 Addressed nits
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
2020-02-24 20:45:57 +00:00
Brandon Lum
8df431fc31 Defer multitenant key model to image auth discussion
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
2020-02-24 20:45:57 +00:00
Brandon Lum
c43a7588f6 Refactor encrypted opts and added unit test
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
2020-02-24 20:45:57 +00:00
Brandon Lum
f0579c7b4d Implmented node key model for image encryption
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
2020-02-24 20:45:57 +00:00
Mike Brown
f4b3cdb892
Merge pull request #1399 from mikebrow/pause-image-update
move to v3.2 for the pause image
2020-02-20 10:45:16 -06:00
Mike Brown
c9ed98462d move to v3.2 for the pause image
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2020-02-14 12:55:52 -06:00
Mike Brown
cf0e0a1e2c
Merge pull request #1332 from bg-chun/update_cri_for_hugepages
update cri-plugin to parse hugepages limit
2020-02-12 10:05:01 -06:00
Byonggon Chun
c02c24847f update cri-plugin to parse hugepages limit from CRI message
Signed-off-by: Byonggon Chun <bg.chun@samsung.com>
2020-02-06 15:28:24 +09:00
Justin Terry (VM)
a8cc66b37a Fix store error serialization to gRPC status codes
The pkg/store errors are duplicated errors of NotFound and AlreadyExist from
containerd's errdefs package and thus do not properly serialize when running
errdefs.ToGRPC on them. CRI runs this function on every return from a CRI
method so the conversion fails if there is a cache miss from the store caches
for containers or sandboxes. This change verifies that the errors are properly
converted to their gRPC values.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2020-02-05 18:32:45 -08:00
Akihiro Suda
2d28b60046 vendor kubernetes 1.17.1
Corresponds to https://github.com/kubernetes/kubernetes/blob/v1.17.1/go.mod

note: `k8snet.ChooseBindAddress()` was renamed to `k8snet.ResolveBindAddress()` in afa0b808f8

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-01-22 02:06:50 +09:00
Akihiro Suda
5e5960f2bc
Merge pull request #1376 from Zyqsempai/add-cgroups-v2-metrics
Cgroupv2: Added CPU, Memory metrics
2020-01-21 23:21:09 +09:00
Boris Popovschi
6b8846cdf8 vendor updated + added cgroupv2 metrics
Signed-off-by: Boris Popovschi <zyqsempai@mail.ru>
2020-01-17 11:55:06 +02:00
Akihiro Suda
71740399e0 cgroup2: unshare cgroup namespace for containers
In cgroup v1 container implementations, cgroupns is not used by default because
it was not available in the kernel until kernel 4.6 (May 2016), and the default
behavior will not change on cgroup v1 environments, because changing the
default will break compatibility and surprise users.

For cgroup v2, implementations are going to unshare cgroupns by default
so as to hide /sys/fs/cgroup from containers.

* Discussion: https://github.com/containers/libpod/issues/4363
* Podman PR (merged): https://github.com/containers/libpod/pull/4374
* Moby PR: https://github.com/moby/moby/pull/40174

This PR enables cgroupns for containers, but pod sandboxes are untouched
because probably there is no need to do.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-01-09 14:58:30 +09:00
Akihiro Suda
aaddaa2732 bump up the default runtime to "io.containerd.runc.v2"
The former default runtime "io.containerd.runc.v1" won't support new features
like support for cgroup v2: containerd/containerd#3726

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2019-12-16 11:53:58 +09:00
Lantao Liu
0c2d3b718d Fix privileged devices.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-12-09 17:43:06 -08:00
Lantao Liu
78708b20c7
Merge pull request #1351 from Random-Liu/better-unknown-state-handling
Better handle unknown state.
2019-12-09 10:34:57 -08:00
Lantao Liu
facbaa0e79 Better handle unknown state.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-12-06 10:56:27 -08:00
bpopovschi
5d7bd738e4 Use containerD WithHostDevices
Signed-off-by: bpopovschi <zyqsempai@mail.ru>
2019-12-04 11:34:46 +02:00
Lantao Liu
a6b6097c90 Fix container pid.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-12-02 01:02:22 -08:00
Lantao Liu
444f02a89e
Merge pull request #1344 from darfux/add-resolvconf-to-sandbox-container
Provide resolvConf to sandbox container's mounts
2019-12-01 21:25:19 -08:00
Li Yuxuan
dbc1fb37d0 Provide resolvConf to sandbox container's mounts
As https://github.com/kata-containers/runtime/issues/1603 discussed,
kata relies on such mount spec to setup resolv.conf for pod VM properly.

Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
2019-11-28 12:05:05 +08:00
Lantao Liu
ab6701bd11 Add insecure_skip_verify option.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-11-26 13:25:52 -08:00
Lantao Liu
5c2f33bd0d Cleanup path for windows mount
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-11-15 18:52:11 +00:00
Erik Wilson
7cc3938717 Set default scheme in registryEndpoints for host
Signed-off-by: Erik Wilson <Erik.E.Wilson@gmail.com>
2019-10-31 10:30:17 -07:00
Lantao Liu
65b9c31805 Use http for localhost, 127.0.0.1 and ::1 by default.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-10-28 19:07:43 -07:00
Lantao Liu
d95e21c89b Add container compute stats support.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-10-25 14:32:02 -07:00
Michael Crosby
f8cca26f3c Handle large output in v2 shim with TTY
Reized the I/O buffers to align with the size of the kernel buffers with fifos
and move the close aspect of the console to key off of the stdin closing.

Fixes #3738

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-10-11 15:42:05 -04:00
Lantao Liu
2ce0bb0926 Update code for latest containerd.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-10-09 18:05:20 -07:00
Lantao Liu
18be6e3714 Use cached state instead of runc state.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-10-03 10:53:13 -07:00
Lantao Liu
358d672160 Add hostname CRI validation and unit test.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-09-25 16:11:27 -07:00
Lantao Liu
7fba77f238
Merge pull request #1298 from Random-Liu/set-sandbox-cpu-shares
Set default sandbox container cpu shares on windows.
2019-09-25 11:05:43 -07:00
Lantao Liu
2eba67a7ee
Merge pull request #1287 from crosbymichael/cgroups
Use type alias from containerd for cgroup metric types
2019-09-24 17:34:49 -07:00
Lantao Liu
f3ef10e9a2 Set default sandbox container cpu shares on windows.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-09-24 17:03:11 -07:00
Justin Terry (VM)
ed7873ef1e Forward SandboxConfig.Hostname to Workload container activation
1. For Windows the Hostname property is not inherited from the sandbox and must
be passed for the Workload container activations as well.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-09-24 10:21:17 -07:00
Lantao Liu
bad68a8270
Merge pull request #1284 from liyanhui1228/win_portforward
Add windows port forward support
2019-09-23 22:17:08 -07:00
Angela Li
dc413bd6d6 Add windows portforward support
Signed-off-by: Angela Li <yanhuil@google.com>
2019-09-23 17:36:43 -07:00
Michael Crosby
0a21292225 Check for more kill error types
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-09-23 15:36:34 -04:00
Michael Crosby
c8c7c54a6e Use typealias for containerd metrics
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-09-20 16:01:48 -04:00
Lantao Liu
470776c903
Merge pull request #1274 from Random-Liu/dualstack
Add DualStack support
2019-09-19 21:32:26 -07:00