Go to file
Stephen J Day d69ef98bfd
filters: add package for filter syntax
With this PR, we add the syntax to use for filtration of items over the
containerd API. This package defines a syntax and parser that can be
used across types and use cases in a uniform manner.

The syntax is fairly familiar, if you've used container ecosystem
projects.  At the core, we base it on the concept of protobuf field
paths, augmenting with the ability to quote portions of the field path
to match arbitrary labels. These "selectors" come in the following
syntax:

```
<fieldpath>[<operator><value>]
```

A basic example is as follows:

```
name=foo
```

This would match all objects that have a field `name` with the value
`foo`. If we only want to test if the field is present, we can omit the
operator. This is most useful for matching labels in containerd. The
following will match objects that has the field labels and have the
label "foo" defined:

```
labels.foo
```

We also allow for quoting of parts of the field path to allow matching
of arbitrary items:

```
labels."very complex label"==something
```

We also define `!=` and `~=` as operators. The `!=` operator will match
all objects that don't match the value for a field and `~=` will compile
the target value as a regular expression and match the field value
against that.

Selectors can be combined using a comma, such that the resulting
selector will require all selectors are matched for the object to match.
The following example will match objects that are named `foo` and have
the label `bar`:

```
name==foo,labels.bar
```

This filter syntax will be used across all APIs that allow listing of
objects and for filtering which event a cleint see. By using a common
syntax, we hope to keep API access uniform.

For the most part, this takes inspiration from docker, swarm and k8s,
but has the limitation that it only allows selection of an inner
product. We may expand to operators that implement `or`, `in` or
`notin`, but it is not clear that this is useful at this level of the
stack.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-20 13:03:35 -07:00
api Add DeleteProcess API for removing execs 2017-06-12 09:32:23 -07:00
archive Add diff service implementation 2017-05-16 13:48:53 -07:00
cmd cmd/{dist, ctr}: cleanup flushing and alignment 2017-06-16 14:49:48 -07:00
containers Timestamp added to container object. 2017-06-05 14:30:49 +09:00
content Content store writer checks expected 2017-06-14 14:54:13 -07:00
design Rewrite imports for new github org 2017-04-03 14:05:44 -07:00
differ Setup plugin ids and dependencies 2017-06-14 16:17:20 -07:00
docs retrying pr for website to satify cncf guidelines 2017-06-16 14:30:31 -07:00
events Rewrite imports for new github org 2017-04-03 14:05:44 -07:00
filters filters: add package for filter syntax 2017-06-20 13:03:35 -07:00
fs Update travis to run make build 2017-05-31 13:35:03 -07:00
gc fix typo I found in this repo 2017-01-20 01:18:26 +08:00
images image: add support for pulling manifest lists/oci indexes 2017-06-16 14:59:35 -07:00
linux Setup plugin ids and dependencies 2017-06-14 16:17:20 -07:00
log Discard grpc logs by default 2017-06-14 11:58:13 -07:00
metadata metadata: properly namespace containers storage 2017-06-07 17:58:40 -07:00
metrics/cgroups Setup plugin ids and dependencies 2017-06-14 16:17:20 -07:00
mount Move Mount into mount pkg 2017-05-22 16:41:12 -07:00
namespaces namespaces: support within containerd 2017-06-06 13:50:33 -07:00
oci package for manipulating OCI images 2017-06-14 06:49:56 +00:00
plugin Setup plugin ids and dependencies 2017-06-14 16:17:20 -07:00
progress cmd/dist: implement fetch prototype 2017-03-02 17:36:01 -08:00
reaper Add checkpoint and restore to client package 2017-06-06 09:58:33 -07:00
reference Add push object 2017-05-23 10:52:51 -07:00
remotes image: add support for pulling manifest lists/oci indexes 2017-06-16 14:59:35 -07:00
reports Add dev report for june 9th 2017-06-09 16:33:36 -07:00
rootfs Fix context package imports 2017-06-09 10:58:29 -07:00
services Setup plugin ids and dependencies 2017-06-14 16:17:20 -07:00
snapshot Setup plugin ids and dependencies 2017-06-14 16:17:20 -07:00
sys Remove C implementation of epoll on arm64 2017-05-26 13:30:57 -04:00
testutil Update travis to run make build 2017-05-31 13:35:03 -07:00
vendor package for manipulating OCI images 2017-06-14 06:49:56 +00:00
version new service: version 2017-05-11 09:07:43 +00:00
windows Setup plugin ids and dependencies 2017-06-14 16:17:20 -07:00
.gitignore Add initial containerd *Client 2017-05-24 14:08:58 -07:00
.travis.yml Remove tip 2017-06-08 10:34:39 -07:00
benchmark_test.go Set image on rootfs options 2017-06-16 13:51:24 -07:00
BUILDING.md Added build doc 2017-05-26 10:56:44 +02:00
checkpoint_test.go Set image on rootfs options 2017-06-16 13:51:24 -07:00
client_test.go Merge pull request #963 from stevvooe/namespaces-support 2017-06-06 14:45:25 -07:00
client_unix.go Fix windows build for client 2017-05-30 16:57:34 -07:00
client_windows.go Don't require rootfs if not set on container 2017-05-25 11:17:36 -07:00
client.go Set image on rootfs options 2017-06-16 13:51:24 -07:00
code-of-conduct.md Add code of conduct 2017-04-04 09:41:38 -07:00
container_test.go Set image on rootfs options 2017-06-16 13:51:24 -07:00
container_unix.go Port ctr to use client 2017-06-06 14:53:50 -07:00
container.go containerd: allow containers without an image 2017-06-13 11:23:53 -07:00
containerd.service Add containerd unit file 2017-06-16 14:05:16 -07:00
CONTRIBUTING.md fix typo I found in this repo 2017-01-20 01:18:26 +08:00
grpc.go Add default namespace to client 2017-06-12 15:47:58 -07:00
image.go Update dist pull to use client 2017-06-06 15:03:52 -07:00
io_unix.go Add Load for container and Task with Attach 2017-06-01 14:12:02 -07:00
io_windows.go Add Load for container and Task with Attach 2017-06-01 14:12:02 -07:00
io.go Add terminal support 2017-06-01 14:46:14 -07:00
LICENSE.code Update readme and version to 0.1.0 2016-03-21 13:01:28 -07:00
LICENSE.docs Update copyright and license 2015-12-18 00:08:16 +01:00
MAINTAINERS Update with preferred email address 2017-05-17 14:09:15 -04:00
Makefile Benchmark container create and task start 2017-06-15 10:43:59 -07:00
NOTICE Update readme and documentation for release 2015-12-16 12:15:22 -08:00
process.go Add DeleteProcess API for removing execs 2017-06-12 09:32:23 -07:00
README.md README.md: add GoDoc badge 2017-06-15 08:08:17 +00:00
ROADMAP.md Rewrite imports for new github org 2017-04-03 14:05:44 -07:00
RUNC.md Add RUNC.md file for runc supported version 2017-05-19 11:18:18 -07:00
spec_unix_test.go Fix windows build for client 2017-05-30 16:57:34 -07:00
spec_unix.go Namespace cgroups monitor ids 2017-06-09 10:35:17 -07:00
spec_windows.go Port ctr to use client 2017-06-06 14:53:50 -07:00
spec.go Don't require rootfs if not set on container 2017-05-25 11:17:36 -07:00
task.go Add DeleteProcess API for removing execs 2017-06-12 09:32:23 -07:00
vendor.conf package for manipulating OCI images 2017-06-14 06:49:56 +00:00

banner

GoDoc Build Status FOSSA Status

containerd is an industry-standard container runtime with an emphasis on simplicity, robustness and portability. It is available as a daemon for Linux and Windows, which can manage the complete container lifecycle of its host system: image transfer and storage, container execution and supervision, low-level storage and network attachments, etc..

containerd is designed to be embedded into a larger system, rather than being used directly by developers or end-users.

State of the Project

containerd currently has two active branches. There is a v0.2.x branch for the current release of containerd that is being consumed by Docker and others and the master branch is the development branch for the 1.0 roadmap and feature set. Any PR or issue that is intended for the current v0.2.x release should be tagged with the same v0.2.x tag.

Communication

For async communication and long running discussions please use issues and pull requests on the github repo. This will be the best place to discuss design and implementation.

For sync communication we have a community slack with a #containerd channel that everyone is welcome to join and chat about development.

Slack: https://dockr.ly/community

Developer Quick-Start

To build the daemon and ctr simple test client, the following build system dependencies are required:

  • Go 1.8.x or above (requires 1.8 due to use of golang plugin(s))
  • Protoc 3.x compiler and headers (download at the Google protobuf releases page)
  • Btrfs headers and libraries for your distribution. Note that building the btrfs driver can be disabled via build tag removing this dependency.

For proper results, install the protoc release into /usr/local on your build system. For example, the following commands will download and install the 3.1.0 release for a 64-bit Linux host:

$ wget -c https://github.com/google/protobuf/releases/download/v3.1.0/protoc-3.1.0-linux-x86_64.zip
$ sudo unzip protoc-3.1.0-linux-x86_64.zip -d /usr/local

With the required dependencies installed, the Makefile target named binaries will compile the ctr and containerd binaries and place them in the bin/ directory. Using sudo make install will place the binaries in /usr/local/bin. When making any changes to the gRPC API, make generate will use the installed protoc compiler to regenerate the API generated code packages.

Note

: A build tag is currently available to disable building the btrfs snapshot driver. Adding BUILDTAGS=no_btrfs to your environment before calling the binaries Makefile target will disable the btrfs driver within the containerd Go build.

Vendoring of external imports uses the vndr tool which uses a simple config file, vendor.conf, to provide the URL and version or hash details for each vendored import. After modifying vendor.conf run the vndr tool to update the vendor/ directory contents. Combining the vendor.conf update with the changeset in vendor/ after running vndr should become a single commit for a PR which relies on vendored updates.

Please refer to RUNC.md for the currently supported version of runc that is used by containerd.

Features

  • OCI Image Spec support
  • OCI Runtime Spec support
  • Image push and pull support
  • Container runtime and lifecycle support
  • Management of network namespaces containers to join existing namespaces
  • Multi-tenant supported with CAS storage for global images

Scope and Principles

Having a clearly defined scope of a project is important for ensuring consistency and focus. These following criteria will be used when reviewing pull requests, features, and changes for the project before being accepted.

Components

Components should not have tight dependencies on each other so that they are able to be used independently. The APIs for images and containers should be designed in a way that when used together the components have a natural flow but still be useful independently.

An example for this design can be seen with the overlay filesystems and the container execution layer. The execution layer and overlay filesystems can be used independently but if you were to use both, they share a common Mount struct that the filesystems produce and the execution layer consumes.

Primitives

containerd should expose primitives to solve problems instead of building high level abstractions in the API. A common example of this is how build would be implemented. Instead of having a build API in containerd we should expose the lower level primitives that allow things required in build to work. Breaking up the filesystem APIs to allow snapshots, copy functionality, and mounts allow people implementing build at the higher levels more flexibility.

Extensibility and Defaults

For the various components in containerd there should be defined extension points where implementations can be swapped for alternatives. The best example of this is that containerd will use runc from OCI as the default runtime in the execution layer but other runtimes conforming to the OCI Runtime specification they can be easily added to containerd.

containerd will come with a default implementation for the various components. These defaults will be chosen by the maintainers of the project and should not change unless better tech for that component comes out. Additional implementations will not be accepted into the core repository and should be developed in a separate repository not maintained by the containerd maintainers.

Releases

containerd will be released with a 1.0 when feature complete and this version will be supported for 1 year with security and bug fixes applied and released.

The upgrade path for containerd is that the 0.0.x patch releases are always backward compatible with its major and minor version. Minor (0.x.0) version will always be compatible with the previous minor release. i.e. 1.2.0 is backwards compatible with 1.1.0 and 1.1.0 is compatible with 1.0.0. There is no compatibility guarantees with upgrades from two minor releases. i.e. 1.0.0 to 1.2.0.

There are not backwards compatibility guarantees with upgrades to major versions. i.e 1.0.0 to 2.0.0. Each major version will be supported for 1 year with bug fixes and security patches.

Scope

The following table specifies the various components of containerd and general features of container runtimes. The table specifies whether or not the feature/component is in or out of scope.

Name Description In/Out Reason
execution Provide an extensible execution layer for executing a container in Create,start, stop pause, resume exec, signal, delete
cow filesystem Built in functionality for overlay, aufs, and other copy on write filesystems for containers in
distribution Having the ability to push and pull images as well as operations on images as a first class API object in containerd will fully support the management and retrieval of images
metrics container-level metrics, cgroup stats, and OOM events in
networking creation and management of network interfaces out Networking will be handled and provided to containerd via higher level systems.
build Building images as a first class API out Build is a higher level tooling feature and can be implemented in many different ways on top of containerd
volumes Volume management for external data out The API supports mounts, binds, etc where all volumes type systems can be built on top of containerd.
logging Persisting container logs out Logging can be build on top of containerd because the containers STDIO will be provided to the clients and they can persist any way they see fit. There is no io copying of container STDIO in containerd.

containerd is scoped to a single host and makes assumptions based on that fact. It can be used to build things like a node agent that launches containers but does not have any concepts of a distributed system.

containerd is designed to be embedded into a larger system, hence it only includes a barebone CLI (ctr) specifically for development and debugging purpose, with no mandate to be human-friendly, and no guarantee of interface stability over time.

Also things like service discovery are out of scope even though networking is in scope. containerd should provide the primitives to create, add, remove, or manage network interfaces and network namespaces for a container but IP allocation, discovery, and DNS should be handled at higher layers.

How is the scope changed?

The scope of this project is a whitelist. If it's not mentioned as being in scope, it is out of scope.
For the scope of this project to change it requires a 100% vote from all maintainers of the project.

Development reports.

Weekly summary on the progress and what is being worked on. https://github.com/containerd/containerd/tree/master/reports

Copyright © 2016 Docker, Inc. All rights reserved, except as follows. Code is released under the Apache 2.0 license. The README.md file, and files in the "docs" folder are licensed under the Creative Commons Attribution 4.0 International License under the terms and conditions set forth in the file "LICENSE.docs". You may obtain a duplicate copy of the same license, titled CC-BY-SA-4.0, at http://creativecommons.org/licenses/by/4.0/.