Commit Graph

161 Commits

Author SHA1 Message Date
Lantao Liu
ca67f94ee0 Address comments for privileged runtime code.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-03-23 02:17:46 +00:00
Jose Carlos Venegas Munoz
ca16bd601a runtime: Add trusted runtime option
Some CRI compatible runtimes may not support provileged operations.
Specifically hypervisor based runtimes (like kata-containers, cc-runtime
and runv) do not support privileged operations like:

- Provide access to the host namespaces
- Create fully privileged containers with access to host devices

Hypervisor based runtimes create container workloads within virtual machines.
When a running host privileged containers using them,
they wont provide support to requested the privileged opertations.

This commits add the new options to define two runtimes:

Trusted runtime : Used when a privileged container is requested.
Default runtime : for non-privileged workloads.

A container that belongs to a privileged pod will inherent this property
an will be created with the trusted runtime.

- Add options to define trusted runtime
- Add logic to decide if a sanbox is trusted
- Export annotation containers below to a trusted sandbox

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2018-03-20 13:56:49 -06:00
Lantao Liu
387da59ee5 Rename all variables to remove "cricontainerd".
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-03-19 21:59:32 +00:00
Lantao Liu
e1fe1abff0 Use github.com/pkg/errors
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-03-17 02:24:38 +00:00
Mike Brown
d4e7154625 move links for cri-containerd to cri
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2018-03-13 17:06:26 -05:00
Lantao Liu
f0a500a390 Use direct function call.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-03-13 04:51:19 +00:00
Lantao Liu
f01c6d73a6 Fix cleanup context.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-03-07 07:05:27 +00:00
Lantao Liu
46fc92f65f Use new namespace mode and support shared pid namespace.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-02-08 03:10:57 +00:00
Lantao Liu
4dfd8250fd Fix a privileged check.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-01-27 02:25:52 +00:00
Lantao Liu
3d68005c04 Replace glog with logrus
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-01-17 21:57:31 +00:00
Jose Carlos Venegas Munoz
b383b0261a Annotations: Provide container metadata for VM based runtimes
For hypervisor-based container runtimes (like Kata Containers, Clear Containers
or runv) a pod will be created in a VM and then create containers within the VM.

When a runtime is requested for container commands like create and start, both
the instal "pause" container and next containers need to be added to the pod
namespace (same VM).

A runtime does not know if it needs to create/start a VM or if it needs to add a
container to an already running VM pod.

This patch adds a way to provide this information through container annotations.
When starting a container or a sandbox, 2 annotations are added:

- type (Container or Sandbox)
- sandbox name

This allow to a VM based runtime to decide if they need to create a pod VM or
container within the VM pod.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2018-01-17 09:57:20 -06:00
Lantao Liu
8782f18d50 Add integration test for volume copy up.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-01-11 19:10:52 +00:00
Lantao Liu
025ffe551f Rename kubernetes-incubator/cri-containerd to containerd/cri-containerd.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-01-10 22:35:33 +00:00
Lantao Liu
31bc964195 Enable HostSpecific option in runtime-tools generator.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-01-03 19:04:47 +00:00
Lantao Liu
cebe1b39f7 Remove default rlimits.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-01-02 18:53:01 +00:00
Mike Brown
31223fd5b1 adds oci image spec to image info placed into imagestore
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2017-12-12 15:58:07 -06:00
Lantao Liu
572e354a2d Revert debug code.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-12-05 07:40:11 +00:00
Lantao Liu
a23bdf25d8 Check and dump rootfs.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-12-03 11:39:54 +00:00
Mike Brown
4934098e27
Merge pull request #440 from dnephin/use-oci-package
Use containerd.oci package
2017-11-28 16:41:26 -06:00
Daniel Nephin
85d3bf0660 Use SpecOpts from new oci package
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-28 15:30:11 -05:00
Brian Goff
f6fe36d17a Remove explicit unpack on all container creates
This only performs an unpack if there is an error when creating the
container snapshot (and only if it's a "not found' error) since it should
already be unpacked.

Signed-off-by: Brian Goff <brian.goff@docker.com>
2017-11-28 14:28:20 -05:00
yanxuean
50cb8a0571 update containerd for refactor
fix #423

Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
2017-11-27 19:24:14 +00:00
Lantao Liu
03aca5e82b Fix data race.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-11-14 05:35:44 +00:00
Lantao Liu
57f37ca66e Print full container spec for debugging.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-11-13 23:36:12 +00:00
Lantao Liu
e41b6d3c24 Refactor container io code
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-11-10 21:03:29 +00:00
Lantao Liu
c4931c8409 Keep stdin open instead of opening when use it.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-11-09 09:28:30 +00:00
Lantao Liu
2433ae7539
Merge pull request #393 from abhi/labels
Adding kube pod and container labels to containerd
2017-11-07 23:39:20 -08:00
abhi
cd5886d647 Adding kube pod and container labels to containerd
Currently we have the pod and container labels part of
containerd metadata extensions. However for third party users
like cadvisor that depend on standard kube labels will need
to be aware of the way metadata is stored in containerd to
fetch the labels.

Signed-off-by: abhi <abhi@docker.com>
2017-11-07 22:19:19 -08:00
Lantao Liu
6f97764171 Add comment for #398.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-11-06 20:54:50 +00:00
Justin Cormack
913836474b Remove comment about whether other paths should be read only with ro root
Since https://github.com/moby/moby/pull/35344 we clarified that this behaviour
was a mistake, and the read only flag should just apply to the actual rootfs,
so it corresponds to the OCI read-only option. Other mounts may be able to be
adjusted by re-specifying them or other means but this is unrelated.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-11-06 14:21:16 +00:00
Lantao Liu
25fdf72692 Add image load.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-10-27 21:51:04 +00:00
Lantao Liu
5e74cba0f0 Add log of generated id for debugging.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-10-27 00:11:16 +00:00
Lantao Liu
acc3f74d5c Also unpack image during creation.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-10-26 17:57:53 +00:00
Yanqiang Miao
c65921b16a Get the mountInfo by 'LookupMount' in containerd
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-10-12 11:09:24 +08:00
Lantao Liu
bde8b0517e Update kubernetes and containerd.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-10-11 06:16:19 +00:00
Lantao Liu
23b8330b44 Merge pull request #322 from miaoyq/fix-314
Update kubernetes version to the PR#52395 and support `unconfined` apparmor
2017-10-04 10:49:56 -07:00
Yanqiang Miao
9f656cdda4 Support unconfined apparmor
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-10-04 09:50:27 +08:00
Lantao Liu
a81a47bf9b Fix update container resources
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-10-03 06:03:39 +00:00
Mike Brown
d8a3c6b018 adds support for configuring the containerd runtime engine
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2017-09-26 20:22:51 -05:00
Lantao Liu
cd57d063c5 Add systemd cgroup support.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-09-26 06:44:30 +00:00
Lantao Liu
4231473df3 Address comments
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-09-25 23:09:44 +00:00
Lantao Liu
21233b22be Check seccomp enable and add unit test for seccomp/apparmor.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-09-25 23:09:26 +00:00
Lantao Liu
dd967cde8c Improve apparmor and selinux support.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-09-22 20:46:31 +00:00
Mike Brown
78a925f57b vendor for new seccomp helpers
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2017-09-21 17:37:50 -05:00
Mike Brown
c0a2d152d9 adds seccomp support
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2017-09-21 17:22:11 -05:00
Lantao Liu
9015b6ec68 Merge pull request #209 from Random-Liu/checkpoint-recovery
Checkpoint recovery
2017-09-21 11:32:49 -07:00
Lantao Liu
cc1b0b6709 Add restart recovery logic.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-09-21 17:59:46 +00:00
Lantao Liu
90d6e44c22 Merge pull request #267 from Random-Liu/fix-apparmor
Fix apparmor empty case.
2017-09-20 21:53:28 -07:00
Lantao Liu
dd3421c3c7 Fix apparmor empty case.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-09-21 04:07:39 +00:00
yanxuean
e1a7a0ea76 Switch to containerd extension
fix #251

Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
2017-09-21 00:15:10 +08:00
Lantao Liu
437131299b Merge pull request #230 from miaoyq/ensure-mount-shared-slave
Ensure the mount point is propagated
2017-09-19 00:56:27 -07:00
Yanqiang Miao
49eb38a5d4 Ensure the mount point is propagated
mount with `rshared`, the host path should be shared.
mount with `rslave`, the host pash should be shared or slave.

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-09-19 14:21:21 +08:00
Lantao Liu
06a305d7ea Merge pull request #255 from Random-Liu/use-config-in-service
Use config in service.
2017-09-17 22:37:06 -07:00
Lantao Liu
8a03d551da Merge pull request #252 from abhinandanpb/rshared
Setting rootfs mount propagation if the mount type is rshared/shared
2017-09-17 12:23:39 -07:00
Abhinandan Prativadi
abba4e22f6 Setting rootfspropagation if the mount type shared or slave
This is needed by runc to mount volume for containers that expect
biderectional file updates or host to container updates.

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2017-09-17 09:59:45 -07:00
Lantao Liu
71b0d0a043 Use config in service.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-09-17 06:46:40 +00:00
Lantao Liu
cd27050425 Add image volume support.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-09-15 11:25:55 +01:00
Ian Campbell
e0079125d2 Move resolveSymbolicLink to OS package and stub out for tests
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-09-15 11:25:45 +01:00
Lantao Liu
1fadb5e573 Follow symlink for mount host path.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-09-12 07:12:03 +00:00
Lantao Liu
6cd0f77c4e Create host path is mount source does not exist.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-09-12 00:58:34 +00:00
Lantao Liu
0bfcdd39ab Remove /run mount for backward compatibility with docker.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-09-09 07:34:00 +00:00
Lantao Liu
3e4b4234c6 Merge pull request #218 from miaoyq/fixes-185
Update kubernetes version and support mount propagation
2017-09-06 21:03:56 -07:00
Yanqiang Miao
9da460ec0a Support mount propagation
fixex #185

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-09-07 08:58:20 +08:00
Lantao Liu
34319e025f Merge pull request #221 from ijc/writeable-rootfs-snapshot
Always use a writeable snapshot as the rootfs.
2017-09-06 15:10:28 -07:00
Ian Campbell
0161764ef5 Always use a writeable snapshot as the rootfs.
This will be made readonly by runc based on spec.Root.Readonly (which we
already set correctly) but defering until then gives runc the chance to make
any missing mount points as it processes the spec.Mount array.

This is necessary because many container images lack mount points for things
like the /etc/hosts which we want to overbind. This is not noticed with e.g.
Docker because it automatically creates an additional layer containing those.
This is something we may want to do here as well eventually but for now using a
writeable snapshot is both necessary and sufficient.

The same does not apply to the sandbox since we never modify its rootfs or want
to mount anything in it etc, add a comment to clarify.

Fixes #220.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-09-06 22:20:14 +01:00
Lantao Liu
e06c2c59e0 Merge pull request #179 from Random-Liu/checkpoint-container-status
Checkpoint container status onto disk.
2017-09-06 13:51:38 -07:00
Lantao Liu
8569fa366e Merge pull request #215 from Random-Liu/add-capability-all
Add "ALL" capabilities support.
2017-09-05 18:14:36 -07:00
Lantao Liu
d02ecc4673 Add "ALL" capabilities support.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-09-06 00:05:08 +00:00
Ian Campbell
1dea8fdfc4 Handle environment variables which containe spaces
This avoids errors such as:

    spec: invalid environment variable "JAVA_OPTS=-Djava.security.egd=file:/dev/urandom"

use SplitN(2) to get the envvar name and value while allowing the value to
contain `=`.

Add some variables to the test data which have one or more `=` in the value.
Since this makes the resulting list of variables to check rather long split the
check in two and check the container config and image config derived values
independently.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-09-05 23:06:07 +01:00
Mike Brown
4f442de959 adds support for AppArmor
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2017-09-01 18:08:34 -05:00
Yanqiang Miao
0c3304e006 Support selinux options/label
Support selinux optios/label

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-08-31 19:20:12 +08:00
Lantao Liu
ac4f238f48 Cleanup image operations.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-31 00:52:09 +00:00
Lantao Liu
130aa5ac0d Checkpoint container status onto disk.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-31 00:41:52 +00:00
Lantao Liu
c4d95aa2c4 Fix sandbox container snapshotter.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-30 18:33:59 +00:00
Lantao Liu
3f4978b77b Use rbind and rprivate in bind mount.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-30 01:40:03 +00:00
Lantao Liu
55ee423224 Merge pull request #175 from Random-Liu/disable-pid-ns-sharing
Disable pid namespace sharing
2017-08-29 13:14:18 -07:00
Lantao Liu
b73161627d Fix fifo files leakage.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-28 21:14:35 +00:00
Lantao Liu
f46cd1a71a Disable pid namespace sharing
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-28 05:44:46 +00:00
Lantao Liu
270e09ab26 Use containerd WithUserID.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-25 21:11:56 +00:00
Lantao Liu
980e8e8007 Merge pull request #168 from Random-Liu/add-run-as-user
Add RunAsUser support
2017-08-25 13:45:47 -07:00
Lantao Liu
60d8430ac1 Do not checkpoint sandbox pid.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-25 01:38:05 +00:00
Lantao Liu
a80df151d1 Add RunAsUsername support.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-25 00:47:35 +00:00
Lantao Liu
e1f74f00a5 Various security related fixes
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-24 21:52:30 +00:00
Lantao Liu
73bb9696e8 Merge pull request #151 from Random-Liu/add-instrumented-service
Add instrumented service.
2017-08-24 11:26:39 -07:00
zhangzhenhao
331e542c09 add the user id support of runAsUser
Signed-off-by: zhangzhenhao <zhangzhenhao@outlook.com>
2017-08-24 23:29:45 +08:00
Lantao Liu
2faa665eb2 Merge pull request #155 from miaoyq/support-nonewprivileges
Support NoNewPrivileges
2017-08-23 20:58:38 -07:00
Yanqiang Miao
1aec120d5f Support NoNewPrivileges
fixes #117

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-08-24 08:37:40 +08:00
Lantao Liu
45ee2e554a Add container attach support.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-23 23:48:31 +00:00
Lantao Liu
77b703f1e7 Move generateID to util.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-23 23:46:55 +00:00
Lantao Liu
dd6e9fb88d Merge pull request #156 from yanxuean/metalabel
Checkpoint and restart recovery
2017-08-23 15:36:19 -07:00
yanxuean
d2757cb8f9 Checkpoint and restart recovery
fix part of #120

Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
2017-08-23 17:01:13 +08:00
Lantao Liu
195b52500f Add instrumented service.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-23 07:02:12 +00:00
Yanqiang Miao
8adad23015 Group all privileged logic together
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-08-22 09:16:37 +08:00
Abhinandan Prativadi
32e0313418 Containerd client integration
This commit:
1) Replaces the usage of containerd GRPC APIs with the containerd client for all operations related to containerd.
2) Updated containerd to v1.0alpha4+
3) Updated runc to v1.0.0

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2017-08-16 14:43:22 -07:00
Lantao Liu
2427d332f0 Add TERM=xterm when tty=true.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-11 16:53:40 +00:00
Yanqiang Miao
9cc93886ea Replace the original default spec with containerd default spec
The original default spec contain `seccomp` configuration,
but some OS do not support this feature, such as ubuntu14.04,
and `make test-cri` always fail. The containerd default spec dosen't
contain `seccomp`, so I think we could replace the default spec
with containerd default spec.

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-08-10 20:31:03 +08:00
Lantao Liu
4c5cea9258 Handle device symlink.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-08-08 00:53:15 +00:00
Mike Brown
73748840da Swicth to 1.0.0-alpha2 containerd api.
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2017-08-02 23:21:37 +00:00
Lantao Liu
7b16a35287 Use new metadata store.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-07-28 23:35:31 +00:00
Lantao Liu
4317e6119a Remove sandbox truncindex.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-07-28 23:35:31 +00:00