Commit Graph

40 Commits

Author SHA1 Message Date
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Michael Crosby
8ee29a17e6 Bump gc threshold to 40%
Doing tests, this is a better balance for the threshold in reguards to
memory and cpu usage.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-02-02 11:00:34 -05:00
Stephen J Day
0e8f08476c
cmd/containerd-shim: aggressive memory reclamation
To avoid having the shim hold on to too much memory, we've made a few
adjustments to favor more aggressive reclamation of memory from the
operating system. Typically, this would be negligible, on the order of a
few megabytes, but this is impactful when running several containers.

The first fix is to lower the threshold used to determine when to run
the garbage collector. The second runs `runtime/debug.FreeOSMemory` at a
regular interval.

Under test, this result in a sustained memory usage of around 3.7 MB.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-01-24 14:51:13 -08:00
Stephen J Day
2d966df174
cmd/containerd-shim: require unix socket credentials
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-30 20:34:29 -08:00
Stephen J Day
6c416fa3a7
shim: we use ttrpc in the shim now
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-30 12:58:40 -08:00
Michael Crosby
74b3cb3391 Fix exit event handling in shim
Could issues where when exec processes fail the wait block is not
released.

Second, you could not dump stacks if the reaper loop locks up.

Third, the publisher was not waiting on the correct pid.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-28 14:32:06 -05:00
Phil Estes
2556c594ec
Merge pull request #1767 from stevvooe/ttrpc-shim
linux/shim: reduce memory overhead by using ttrpc
2017-11-28 12:43:41 -05:00
Stephen J Day
5764bf1bad
cmd/containerd-shim: set GOMAXPROCS to 2
The shim doesn't need massive concurrency and a bunch of CPUs to do its
job correctly. We can reduce the number of threads to save memory at
little cost to performance.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-27 13:40:35 -08:00
Stephen J Day
e8f52c35ce
linux/shim: reduce memory overhead by using ttrpc
By replacing grpc with ttrpc, we can reduce total memory runtime
requirements and binary size. With minimal code changes, the shim can
now be controlled by the much lightweight protocol, reducing the total
memory required per container.

When reviewing this change, take particular notice of the generated shim
code.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-22 12:21:48 -08:00
Daniel Nephin
f74862a0dd Add structcheck, unused, and varcheck linters.
Warn on unused and dead code

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-21 11:14:37 -05:00
Akihiro Suda
7ef4aa5c25 shim: support non-default binary name
The binary name used for executing "containerd publish" was hard-coded
in the shim code, and hence it did not work with customized daemon
binary name. (e.g. `docker-containerd`)

This commit allows specifying custom daemon binary via `containerd-shim
-containerd-binary ...`.
The daemon invokes this command with `os.Executable()` path.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-11-17 22:21:54 +00:00
Stephen J Day
c5022ad92d
protobuf: use the gogo/types package for empty
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-15 19:08:54 -08:00
Michael Crosby
a522a6c7ee Add publish subcommand for publishing events
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-15 11:30:03 -05:00
Michael Crosby
1fe5a251c4 Move Exec creation to init process
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-13 16:45:25 -05:00
Michael Crosby
13c7c3ef10 Remove urfave cli dep from shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-07 10:51:12 -05:00
Michael Crosby
526d15bd86 Move dial funcs to dialer pkg
This reduces shim size from 30mb to 18mb

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-07 10:51:12 -05:00
Michael Crosby
d22160c28e Vendor typeurl package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-09-19 09:43:55 -04:00
Kenfe-Mickael Laventure
1b79170849
linux: Add RuntimeRoot to RuncOptions
This allow specifying wher the OCI runtime should store its state data.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-31 14:35:05 -07:00
Kenfe-Mickael Laventure
ab0cb4e756
linux: Honor RuncOptions if set on container
This also fix the type used for RuncOptions.SystemCgroup, hence introducing
an API break.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-31 14:35:05 -07:00
Kenfe-Mickael Laventure
3f34c421d3
Add missing "/tasks/exec-started" event topic
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-29 08:27:44 -07:00
Kenfe-Mickael Laventure
9923a49e97
linux/shim: Kill container upon SIG{TERM,KILL}
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-29 08:27:44 -07:00
Kenfe-Mickael Laventure
7ac351cdfe
Share Dialer and DialAddress between client and shim
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-11 09:34:29 -07:00
Kenfe-Mickael Laventure
587a811d09
Check credentials when connecting to shim
NewUnixSocketCredentials was actually never invoked before.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-11 09:34:29 -07:00
Kenfe-Mickael Laventure
8700e23a10
Use root dir when storing temporary checkpoint data
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-03 14:38:18 -07:00
Stephen J Day
7ed88c1e36
linux/shim: use events.Publisher interface
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-31 14:23:51 -07:00
Michael Crosby
7b6ff6ec89 event forwarding without shim
Fixes #1138

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-31 10:05:24 -04:00
Andrew Pennebaker
1d2a079f08
update to github.com/sirupsen/logrus v1.0.0
Signed-off-by: Andrew Pennebaker <apennebaker@datapipe.com>
2017-07-21 15:39:14 -07: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
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
Kenfe-Mickael Laventure
d3e7af2c0a
containerd-shim: Refuse connection from uid/gid different from the shim process
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-06-23 17:50:13 -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
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
497db9ac06 Namespace tasks via runc --root
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-06 16:31:00 -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
Akihiro Suda
2562aca1a3 new service: version
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-05-11 09:07:43 +00: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
3db1ea8d07 [bin] Replace syscall with /x/sys/unix
Replace syscall usage with /sys/unix in the binaries and their packages

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-10 12:01:33 -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