Commit Graph

258 Commits

Author SHA1 Message Date
Ian Campbell
300f083127 Cleanup mounts if we fail to mount one element of rootfs
Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-20 10:50:08 +01:00
Ian Campbell
8b365117a2 containerd-shim: Do not remount root MS_SLAVE
Mounting as MS_SLAVE here breaks use cases which want to use
rootPropagation=shared in order to expose mounts to the host (and other
containers binding the same subtree), mounting as e.g. MS_SHARED is pointless
in this context so just remove.

Having done this we also need to arrange to manually clean up the mounts on
delete, so do so.

Note that runc will also setup root as required by rootPropagation, defaulting
to MS_PRIVATE.

Fixes #1132.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-20 10:50:08 +01:00
Derek McGowan
a8504277cc Merge pull request #1209 from stevvooe/remove-errors
linux, linux/shim: remove error definitions
2017-07-18 19:18:23 -07:00
Stephen J Day
1ecb2ea30d
linux/shim: remove redundant topic prefix
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-18 18:19:25 -07:00
Stephen J Day
6d0bcd5aec
linux, linux/shim: remove error definitions
Since we now have a common set of error definitions, mapped to existing
error codes, we no longer need the specialized error codes used for
interaction with linux processes. The main issue was that string
matching was being used to map these to useful error codes. With this
change, we use errors defined in the `errdefs` package, which map
cleanly to GRPC error codes and are recoverable on either side of the
request.

The main focus of this PR was in removin these from the shim. We may
need follow ups to ensure error codes are preserved by the `Tasks`
service.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-18 15:56:49 -07:00
Kenfe-Mickael Laventure
e4beb7c554
Use constants for runtime event topics
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-07-18 14:19:48 +02:00
Kenfe-Mickael Laventure
a578730a94
Update linux events topic
This also remove the duplicate events for Task{Create,Start,Delete}

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-07-18 13:47:28 +02:00
Kenfe-Mickael Laventure
88c1db5ca5
Move taskList to the runtime package
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-07-13 13:53:22 +02:00
Michael Crosby
e110706376 Merge pull request #1170 from stevvooe/identifier-validation
namespaces, identifiers: split validation
2017-07-12 15:15:17 -07:00
Stephen J Day
9e5bd5a2dc
namespaces, identifiers: split validation
After review, there are cases where having common requirements for
namespaces and identifiers creates contention between applications.  One
example is that it is nice to have namespaces comply with domain name
requirement, but that does not allow underscores, which are required for
certain identifiers.

The namespaces validation has been reverted to be in line with RFC 1035.
Existing identifiers has been modified to allow simply alpha-numeric
identifiers, while limiting adjacent separators.

We may follow up tweaks for the identifier charset but this split should
remove the hard decisions.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-12 14:46:47 -07:00
Michael Crosby
3b8018d8cf Remove protos from Go client API
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-12 14:32:37 -07:00
Michael Crosby
2b6d790ff4 Refactor runtime events into Task* types
This removes the RuntimeEvent super proto with enums into separate
runtime event protos to be inline with the other events that are output
by containerd.

This also renames the runtime events into Task* events.

Fixes #1071

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-12 10:57:57 -07:00
Ian Campbell
194b6e4f06 Start of day configuration of shim debug setting
This makes it possible to enable shim debug by adding the following to
`config.toml`:

    [plugins.linux]
    shim_debug = true

I moved the debug setting from the `client.Config struct` to an argument to
`client.WithStart` since this is the only place it would be used.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-12 17:48:27 +01:00
Michael Crosby
58da62dd0f Add runtime events for pause,resume,checkpoint
Fixes #1068

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-11 12:38:20 -07:00
Derek McGowan
54e2b9db57 Merge pull request #1152 from ijc/drop-unused-variable
linux: Drop unused variable `c` by discarding unused assignment
2017-07-11 09:40:15 -07:00
Ian Campbell
0a580cbb72 linux: Drop unused variable c by discarding unused assignment
The compiler doesn't spot this, but guru does.

This seems to have become unused in 79e6a93624 ("Fix incorrect reference to
the gRPC runtime name as a binary").

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-11 13:28:59 +01:00
Michael Crosby
6578565216 Use event service post for shim events
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-07 16:30:57 -07:00
Michael Crosby
f93bfb6233 Add Exec IDs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-06 15:23:08 -07:00
Michael Crosby
4b9a8ee13e Require *T for typeurl interaction
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-06 13:14:48 -07:00
Michael Crosby
a60511d5aa Use typeurl package for spec types
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-05 15:37:26 -07:00
Samuel Ortiz
b67398af15 linux: Make containerd less runc specific
We hope that containerd supports any OCI compliant runtime, and not only
runc.
This patch fixes all the error messages to not be completely runc
specific and change the initProcess structure to have its runtime
pointer be called 'runtime' and not 'runc'

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-07-03 17:45:23 +02:00
Kenfe-Mickael Laventure
ccbe92dc08 Move WithExit to runcopts package
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-29 15:50:39 -07:00
Michael Crosby
124f430d44 Update base types url for runc opts
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-29 15:44:23 -07:00
Michael Crosby
72831b6985 Use Any instead of []byte
This allows us to get the fully TypeURL for consuming code.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-29 15:32:45 -07:00
Michael Crosby
82d0208aaa Implement options for runtime specific settings
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-29 15:32:45 -07:00
Michael Crosby
e2d5522435 Change ListProcesses to ListPids
These rpcs only return pids []uint32 so should be named that way in
order to have other rpcs that list Processes such as Exec'd processes.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-28 16:10:41 -07:00
Michael Crosby
040558cf81 Remove runtime.Event types
This uses the events service types for runtime events

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-28 10:47:22 -07:00
Michael Crosby
7c8acca29a Move runtime interfaces to runtime package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-28 10:10:59 -07:00
Derek McGowan
a5fa3bb923 Merge pull request #1100 from crosbymichael/update-task
Implement task update
2017-06-27 14:39:45 -07:00
Michael Crosby
6ec84ef83c Add namespace to container metrics
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-27 11:54:14 -07:00
Phil Estes
79e6a93624
Fix incorrect reference to the gRPC runtime name as a binary
Until we have a way to preserve the initial command used to start the
container, we have to default to the default `runc` found on the $PATH.
This code after the last refactor of shim/API is incorrectly using the
gRPC object reference of the v1 runtime as a binary name which causes
os.Exec() errors.

Signed-off-by: Phil Estes <estesp@gmail.com>
Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2017-06-26 19:49:09 -04:00
Michael Crosby
f36e0193a4 Implement task update
This allows tasks to have their resources updated as they are running.

Fixes #1067

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-26 16:38:49 -07:00
Kenfe-Mickael Laventure
6574055dec
linux: Pass correct type when emitting RuntimeDelete event
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-23 17:55:23 -07:00
Kenfe-Mickael Laventure
b7f37e778c
containerd-shim: Do not crash when receiving RPC before a Create() is issued
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-23 17:51:57 -07:00
Kenfe-Mickael Laventure
95afeb7831
containerd-shim: Use abstract namespace for the unix socket
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-23 17:48:08 -07:00
Michael Crosby
990536f2cc Move shim protos into linux pkg
This moves the shim's API and protos out of the containerd services
package and into the linux runtime package. This is because the shim is
an implementation detail of the linux runtime that we have and it is not
a containerd user facing api.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-23 16:21:47 -07:00
Stephen J Day
12c0daa9c9
api/types: consolidate types package
To simplify use of types, we have consolidate the packages for the mount
and descriptor protobuf types into a single Go package. We also drop the
versioning from the type packages, as these types will remain the same
between versions.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-23 13:50:28 -07:00
Michael Crosby
3b9d9dfa3e Fix error on doulbe Kill calls
This returns a typed error for calls to Kill when the process has
already finished.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-23 13:28:48 -07:00
Kenfe-Mickaël Laventure
003ed58859 Merge pull request #1072 from stevvooe/move-events-to-services-pkg
events: move types into service package
2017-06-23 12:02:22 -07:00
Kenfe-Mickael Laventure
0917269a9a
shim: Use correct error when trying to expand runc error
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-23 11:31:16 -07:00
Stephen J Day
c05be46348
events: move types into service package
When using events, it was found to be fairly unwieldy with a number of
extra packages. For the most part, when interacting with the events
service, we want types of the same version of the service. This has been
accomplished by moving all events types into the events package.

In addition, several fixes to the way events are marshaled have been
included. Specifically, we defer to the protobuf type registration
system to assemble events and type urls, with a little bit sheen on top
of add a containerd.io oriented namespace.

This has resulted in much cleaner event consumption and has removed the
reliance on error prone type urls, in favor of concrete types.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-22 19:12:25 -07:00
Stephen J Day
12a6beaeeb
*: update import paths to use versioned services
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-21 18:29:06 -07:00
Michael Crosby
8b2cf6e8e6 Fix Wait() on process/tasks
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-21 13:48:24 -07:00
Michael Crosby
8830866eed Remove events from Runtime
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-21 13:34:24 -07:00
Michael Crosby
94eafaab60 Update GRPC for consistency
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-21 13:34:24 -07:00
Kenfe-Mickael Laventure
fb5a3d2989
Rename variables holding a task from c to t
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-21 09:26:50 -07:00
Evan Hazlett
935645b03a events: add protos
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: update events package to include emitter and use envelope proto

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: add events service

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: enable events service and update ctr events to use events service

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

event listeners

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: helper func for emitting in services

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: improved cli for containers and tasks

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

create event envelope with poster

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: introspect event data to use for type url

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: use pb encoding; add event types

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: instrument content and snapshot services with events

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: instrument image service with events

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: instrument namespace service with events

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: add namespace support

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: only send events from namespace requested from client

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

events: switch to go-events for broadcasting

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-06-20 10:47:28 -04:00
Michael Crosby
94e7f8e943 Setup plugin ids and dependencies
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-14 16:17:20 -07:00
Kenfe-Mickael Laventure
c9064df2cf
Discard grpc logs by default
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-14 11:58:13 -07:00
Kenfe-Mickael Laventure
709ba260de
linux: Ensure shim is killed if we can't connect to it initially
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-14 10:21:48 -07:00
Kenfe-Mickael Laventure
5922cfaba8
linux: Bubble up runc error message
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-14 10:21:48 -07:00
Kenfe-Mickael Laventure
33598cc5d3
linux: Wrap error with contextual message
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-14 10:21:48 -07:00
Kenfe-Mickael Laventure
171759a233
linux: Return grpc error description only
This avoid having "rpc error: code = Unknown" in the final output.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-14 10:21:48 -07:00
Michael Crosby
ff598449d1 Add DeleteProcess API for removing execs
We need a separate API for handing the exit status and deletion of
Exec'd processes to make sure they are properly cleaned up within the
shim and daemon.

Fixes #973

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-12 09:32:23 -07:00
Michael Crosby
588c11852b Move task list to runtimes
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-09 10:37:33 -07:00
Michael Crosby
745398b2e9 Remove tasks map from service
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-09 10:35:17 -07:00
Michael Crosby
497db9ac06 Namespace tasks via runc --root
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-06 16:31:00 -07:00
Michael Crosby
a8c5542ba8 Add checkpoint and restore to client package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-06 09:58:33 -07:00
Phil Estes
71575bf413 Merge pull request #948 from crosbymichael/client-tty
Add client terminal support for IO
2017-06-05 09:41:11 -04:00
Phil Estes
7071276f64 Merge pull request #943 from mlaventure/honor-runtime-conf
Use conf value when killing loaded container
2017-06-01 17:12:17 -04:00
Michael Crosby
00734ab04a Return fifo paths from Shim
This allows attach of existing fifos to be done without any information
stored on the client side.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-01 14:12:02 -07:00
Michael Crosby
6ff220a116 Merge pull request #939 from ijc25/reconnect-shim-event-stream
Reconnect to shim event stream after containerd restart
2017-06-01 09:52:13 -07:00
Kenfe-Mickael Laventure
357c47b1a3 Use conf value when killing loaded container
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-05-31 14:51:28 -07:00
Derek McGowan
dfce91854e
Update travis to run make build
Ensure all packages can be built, even those not yet imported by binaries.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-05-31 13:35:03 -07:00
Michael Crosby
ebf935d990 Add exec support to client
This also fixes a deadlock in the shim's reaper where execs would lockup
and/or miss a quick exiting exec process's exit status.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-31 11:50:23 -07:00
Ian Campbell
a5d246404c Reconnect to shim event stream after containerd restart
There are three aspects which need to be covered:

 - the runtime needs to restart its event pump when it reconnects (in
   loadContainer).
 - on the server side shim needs to monitor the stream context so it knows when
   the connection goes away.
 - if the shim's stream.Send() fails (because the stream died between taking
   the event off the channel and calling stream.Send()) then to avoid losing
   that event the shim should remember it and send it out first on the next
   stream.

The shim's event production machinery only handles producing a single event
stream, so add an interlock to ensure there is only one reader of the
`s.events` channel at a time. Subsequent attempts to use Events will block
until the existing owner is done.

Fixes #921.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-05-31 13:48:44 +01:00
Michael Crosby
ee90a77f63 Rename Image to CheckpointPath in shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-26 10:06:53 -07:00
Yanqiang Miao
e4e80fb7b7 delete the redundant
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-05-26 16:55:49 +08:00
Evan Hazlett
f42c762dc4
updates the execution service to include ContainerID in tasks
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-25 12:15:00 -04:00
Derek McGowan
e1ed4a2ea4
Add json storage for container storage
This is just a temporary storage solution to get
containers running on the new code.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-05-23 14:22:20 -07:00
Stephen J Day
539742881d
api/services: define the container metadata service
Working from feedback on the existing implementation, we have now
introduced a central metadata object to represent the lifecycle and pin
the resources required to implement what people today know as
containers. This includes the runtime specification and the root
filesystem snapshots. We also allow arbitrary labeling of the container.
Such provisions will bring the containerd definition of container closer
to what is expected by users.

The objects that encompass today's ContainerService, centered around the
runtime, will be known as tasks. These tasks take on the existing
lifecycle behavior of containerd's containers, which means that they are
deleted when they exit. Largely, there are no other changes except for
naming.

The `Container` object will operate purely as a metadata object. No
runtime state will be held on `Container`. It only informs the execution
service on what is required for creating tasks and the resources in use
by that container. The resources referenced by that container will be
deleted when the container is deleted, if not in use. In this sense,
users can create, list, label and delete containers in a similar way as
they do with docker today, without the complexity of runtime locks that
plagues current implementations.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-05-22 23:27:53 -07:00
Michael Crosby
d7af92e00c Move Mount into mount pkg
This moves both the Mount type and mountinfo into a single mount
package.

This also opens up the root of the repo to hold the containerd client
implementation.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-22 16:41:12 -07:00
Derek McGowan
b07504c713 Merge pull request #862 from crosbymichael/checkpoint
Initial Support for Checkpoint && Restore
2017-05-22 15:51:10 -07:00
Michael Crosby
7cc1b64bd8 Add checkpoint and restore
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Update go-runc to 49b2a02ec1ed3e4ae52d30b54a291b75

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Add shim to restore creation

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Keep checkpoint path in service

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Add C/R to non-shim build

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Checkpoint rw and image

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Pause container on bind checkpoints

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Return dump.log in error on checkpoint failure

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Pause container for checkpoint

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Update runc to 639454475cb9c8b861cc599f8bcd5c8c790ae402

For checkpoint into to work you need runc version
639454475cb9c8b861cc599f8bcd5c8c790ae402 + and criu 3.0 as this is what
I have been testing with.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Move restore behind create calls

This remove the restore RPCs in favor of providing the checkpoint
information to the `Create` calls of a container.  If provided, the
container will be created/restored from the checkpoint instead of an
existing container.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Regen protos after rebase

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-22 15:34:45 -07:00
Phil Estes
0cd93ba618 Merge pull request #882 from mlaventure/order-exit-events
Ensure shim start & exit events are sent in right order
2017-05-22 12:12:16 -04:00
Kenfe-Mickael Laventure
8ca92a2aa8 Ensure shim start & exit events are sent in right order
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-05-19 15:31:18 -07:00
Stephen J Day
178b4275ca
api/types/container: nice enum values for status
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-05-18 17:48:20 -07:00
Evan Hazlett
70dd7fcc60 shim: Ps -> Processes
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-18 11:05:48 -04:00
Evan Hazlett
ef158f8b5e add support to kill container process by pid
This adds support for signalling a container process by pid.

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

make Ps more extensible

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

ps: windows support

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-18 11:05:48 -04:00
Michael Crosby
cd282f458a Merge pull request #864 from mlaventure/revert-rootfs-error
Revert "Merge pull request #853 from AkihiroSuda/check-rootfs"
2017-05-16 15:05:27 -07:00
Kenfe-Mickael Laventure
dd16c0583b Revert "Merge pull request #853 from AkihiroSuda/check-rootfs"
This reverts commit c1530b5b76, reversing
changes made to 3695ba77bb.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-05-16 14:48:13 -07:00
Kenfe-Mickael Laventure
5523936cf5 Close stdin on create if it wasn't requested and there's no terminal
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-05-16 14:16:47 -07:00
Kenfe-Mickael Laventure
aac425c761 Terminate linux shim on create failure
Since an error is returned via the RPC clients will assume (rightly so)
that a call to the Delete() RPC is not necessary.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-05-16 13:31:06 -07:00
Kenfe-Mickaël Laventure
47718b0930 Merge pull request #861 from justincormack/go-runc-port
Portability fixes for containerd shim
2017-05-16 12:07:08 -07:00
Derek McGowan
c1530b5b76 Merge pull request #853 from AkihiroSuda/check-rootfs
linux: error out if no rootfs specified
2017-05-16 10:38:25 -07:00
Justin Cormack
6a571ecd40 Portability fixes for containerd shim
Update go-runc to master with portability fixes.

Subreaper only exists on Linux, and only Linux runs the shim in a
mount namespace.

With these changes the shim compiles on Darwin, which means the
whole build compiles without errors now.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-16 17:13:32 +01:00
Kenfe-Mickael Laventure
f95ad5a280 Don't print the transport closing error for shim events
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-05-15 15:27:40 -07:00
Kenfe-Mickael Laventure
0457b13043 Allow the shim binary to be specified
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-05-15 15:27:40 -07:00
Akihiro Suda
7a62734d82 linux: error out if no rootfs specified
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-05-14 14:03:26 +00:00
Michael Crosby
01b9f5ec67 Move Container and runtime to plugin pkg
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-11 15:24:12 -07:00
Michael Crosby
23b2b09d13 Update deps after move to containerd org
This updates containerd to use the latest versions of cgroups, fifo,
console, and go-runc from the containerd org.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-10 16:51:48 -07:00
Michael Crosby
2f942e137d Wait for copy routines to be scheduled
Fixes #770

Use a wait group to wait for the `io.Copy` go routines to be scheduled
before continuing to start the container.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-10 11:50:55 -07:00
Random-Liu
f04d74d099 Make it possible to disable stdin when terminal is enabled
Signed-off-by: Random-Liu <lantaol@google.com>
2017-05-05 13:34:29 -07:00
Krasi Georgiev
0e7e89c0f1 fixes #744 no-shim will crash containerd with ctr list and ctr info
Signed-off-by: Krasi Georgiev <krasi.root@gmail.com>
2017-05-01 18:03:02 +03:00
Qiang Huang
455a185d98 Merge pull request #740 from crosbymichael/oom-event
Emit oom events
2017-04-20 17:23:24 -05:00
Michael Crosby
eba88c1752 Add oom event to monitors
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-13 15:18:43 -07:00
Michael Crosby
efe177ed77 Add exited at to events and delete requests
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-13 13:55:58 -07:00
Michael Crosby
e46109ba81 Only set socket on non-nil type creation
Because of go interface unpacking we need to only set the interface on
the opts when we actually have a socket.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-13 09:47:14 -07:00
Michael Crosby
634f0c0c83 Set oom score for containerd and shims
This adds a config option to set the oom score for the containerd daemon
as well as automatically setting the oom score for the shim's lauched so
that they are not killed until the very end of an out of memory
condition.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-12 11:34:32 -07:00
Michael Crosby
9e1acba19f Update deps with sys/unix changes
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-10 13:07:41 -07:00
Michael Crosby
4f7d521510 [exec] Replace syscall with /x/sys/unix
This replaces the syscall usage with sys/unix in the execution code

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-10 11:56:33 -07:00
Phil Estes
4f33aa2b5c Merge pull request #702 from crosbymichael/attach
Expose Pty resize and CloseStdin RPCs
2017-04-10 14:38:30 -04:00
Michael Crosby
7482962b9d Handle restore with dead shim
Add functionality for restoring containers after containerd dies and is
restarted with terminated shims.

This ensures that on restore, if a container no longer has a running
shim, containerd will kill and cleanup the container.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-07 14:22:43 -07:00
Michael Crosby
a7da08b7ba Add Pty and CloseStdin RPCs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-07 11:20:10 -07:00
Kenfe-Mickael Laventure
c5843b7615 Initial windows runtime work
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-04-07 09:20:44 -07:00
Michael Crosby
47225c130c Add ctr exec
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-06 10:36:47 -07:00
Michael Crosby
7715ddcefa Add exec APIs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-05 11:51:56 -07:00
Qiang Huang
4764429cbe Add kill API for execution service
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-04-05 09:03:07 +08:00
Qiang Huang
6132bec05a Add Kill API for shim service
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-04-05 08:26:35 +08:00
Michael Crosby
4f2b443a27 Rewrite imports for new github org
This rewrites the Go imports after switching to the new github org.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-03 14:05:44 -07:00
Phil Estes
efb16dad44 Merge pull request #661 from crosbymichael/stdin-closer
Open stdin write side in shim
2017-04-03 12:25:43 -04:00
unclejack
d2a6630658 utils: remove utils & migrate code to sys
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2017-03-29 21:25:02 +03:00
Michael Crosby
b1fcb1745f Open stdin write side in shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-24 15:41:12 -07:00
Michael Crosby
5e5479718c Merge pull request #619 from crosbymichael/no-shim
Add `no_shim` config for not running with a shim
2017-03-22 13:49:03 -07:00
Michael Crosby
155185c2b2 Add container to monitor in runtime
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-22 11:44:25 -07:00
Ophir Sneh
87f94bf79b Update shim exec rpc to take fewer args
Signed-off-by: Ophir Sneh <otsneh@gmail.com>
2017-03-21 15:34:02 -07:00
Michael Crosby
1d7fa45403 Add no_shim config for not running with a shim
This reuses the exiting shim code and services to let containerd run as
the reaper for all container processes without the use of a shim.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-10 15:28:21 -08:00
Michael Crosby
df48983fe7 Add reaper code for daemon
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-09 16:07:35 -08:00
Michael Crosby
e1731d2e5e Add linux runtime config
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-03-07 16:46:09 -08:00
Derek McGowan
0b44e24c07 Move plugin registration to separate package
Only compile in plugin support on non-windows 1.8.
Re-enable go 1.7.x tests.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-06 17:23:00 -08:00
Akihiro Suda
899a52d655 api: implement fetching the container status
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-03-06 08:26:35 +00:00
Stephen Day
a15aa8e9ab Merge pull request #593 from ijc25/delete-response
Return DeleteResponse from ContainerService.Delete
2017-03-02 10:10:58 -08:00
Ian Campbell
186a9a2acd Return DeleteResponse from ContainerService.Delete
The message was defined but the method was returning empty, plumb through the
result from the shim layer.

Compile tested only.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-03-01 14:59:29 +00:00
Ian Campbell
eae8ca69b7 Do not leak open fd to config.json in newBundle
Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-03-01 11:15:10 +00:00
Michael Crosby
e693cad926 Change linux runtime(w shim) to builtin
Because of the plugin findings and having the default runtime builtin
this makes it much better for development and testing.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-24 15:50:59 -08:00
Michael Crosby
fceafeb4d6 Remvoe go1.7 from travis
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-22 10:28:05 -08:00
Michael Crosby
3101be93bc Load runtimes dynamically via go1.8 plugins
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Add registration for more subsystems via plugins

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Move content service to separate package

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-21 16:29:46 -08:00
Qiang Huang
a717d4dc2d Close shim file when cmd.Start fail
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2017-02-21 08:51:40 -08:00
Michael Crosby
47ececd6b8 Change Container interface to include Info
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-16 09:59:40 -08:00
Michael Crosby
c869eb0c61 Update vendored packages for changes
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-15 15:10:30 -08:00
Michael Crosby
ab8586b7c5 Remove bundles from API
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-02-15 13:56:41 -08:00
Michael Crosby
fe38efda50 Add shim for reattach of processes
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Remove runtime files from containerd

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Update supervisor for orphaned containers

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Remove ctr/container.go back to rpc calls

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Add attach to loaded container

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Add monitor based on epoll for process exits

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Convert pids in containerd to string

This is so that we no longer care about linux or system level pids and
processes in containerd have user defined process id(pid) kinda like the
exec process ids that docker has today.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Add reaper back to containerd

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Implement list containers with new process model

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Implement restore of processes

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Add NONBLOCK to exit fifo open

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Implement tty reattach

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Fix race in exit pipe creation

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Add delete to shim

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Update shim to use pid-file and not stdout

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-02 16:00:22 -08:00
Kenfe-Mickael Laventure
fd63cee703 Translate RootfsPropagation flags from spec to internal config
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-02-02 07:47:59 -08:00
Michael Crosby
c29728a9b0 Merge pull request #94 from rakyll/remove-type
runtime: remove unnecessary intermediate type, Status
2016-01-28 17:40:17 -08:00
Burcu Dogan
167219101f runtime: remove unnecessary intermediate type, Status
Signed-off-by: Burcu Dogan <jbd@google.com>
2016-01-28 00:31:33 +01:00
Tonis Tiigi
b58c572f32 Chown stdio with proper user
If user namespace is used we should chown with a remapped ID.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-01-25 17:59:24 -08:00
Aaron Lehmann
cf9fcdc71a Avoid panic when spec file is missing sections under Resources
Check pointers against nil before dereferencing them. Skip any sections
that are nil, since that's equivalent to having no values defined for
those sections.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-01-15 16:04:52 -08:00
Michael Crosby
c141cb670f Fix nil checks for cgroup fields
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-01-04 13:40:28 -08:00
Kunal Kushwaha
a3cf409ada Fixes the compile issue#62
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2015-12-25 11:58:11 +09:00
Michael Crosby
b296d50493 Update resource on libcontainer change
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-17 13:58:50 -08:00
Michael Crosby
76cf593212 Add oom notifications and pid to create response
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-15 16:22:53 -08:00
Michael Crosby
ec31245f54 Add exec process log support
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-15 11:43:51 -08:00
Michael Crosby
d542ece69c Add tty support from client
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-14 16:47:42 -08:00
Michael Crosby
e480aedaea Add console support
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-14 13:31:30 -08:00
Michael Crosby
9052c886f0 Fix leak in logging and proc pipes
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-11 11:56:01 -08:00
Michael Crosby
e5545a1461 Add basic logging to file support
This currently logs to a json file with the stream type.  This is slow
and hard on the cpu and memory so we need to swich this over to
something like protobufs for the binary logs but this is just a start.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-11 10:26:49 -08:00
Michael Crosby
0470f0790e Add pid to containers output
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-09 15:53:23 -08:00
Michael Crosby
cab1086d27 Fix checkpoint list when no dir
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-08 17:08:39 -08:00
Michael Crosby
f8ee26ffca Merge pull request #14 from LK4D4/add_logging
Add logging and more info
2015-12-08 11:38:13 -08:00
Alexander Morozov
cf3b72852a Add log and more context to errors in Create
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-12-08 11:33:19 -08:00