56 Commits

Author SHA1 Message Date
Dimitri John Ledkov 45f0ff8b19 Clear linux use system binaries, instead of compiling systemd. 2015-06-02 15:40:16 +01:00
Alban Crequy 0ed3d37677 stage1: systemd: update build option
- remove --disable-readahead
- remove --disable-multi-seat-x
- add --disable-selinux

Also, write one option per line for better readability.

I kept the configure --help output order.
2015-05-12 10:03:39 +02:00
Jonathan Boulle 4c64fa6e93 Merge pull request #861 from jonboulle/copyright
*: adjust copyright header + remove NOTICE
2015-05-07 14:38:45 -07:00
Jonathan Boulle 9685f37575 *: adjust copyright header
Inspired by a similar change in the Kubernetes project [1], this changes
the copyright header to the more generic "The rkt Authors" rather than
"CoreOS, Inc.", which is only sometimes correct.

https://github.com/GoogleCloudPlatform/kubernetes/commit/6b3a6e6b983f967c88d14d26542ec6e30c49ebd3
2015-05-03 14:29:15 -07:00
Brandon Philips 40ced98c32 version: bump to v0.5.5 2015-05-01 19:16:44 -04:00
Alban Crequy f183907d9c build: systemd: add patches for systemd-master 2015-04-28 17:24:52 +02:00
Alban Crequy b0b22a6606 build: systemd v219: add new patches 2015-04-28 17:24:52 +02:00
Alban Crequy a5274f92b4 build: ability to choose a different systemd version
When building stage1 from sources with RKT_STAGE1_USR_FROM=src,
it is now possible to choose which systemd tag or branch should be
built:

  $ export RKT_STAGE1_USR_FROM=src
  $ export RKT_STAGE1_SYSTEMD_SRC=git://anongit.freedesktop.org/systemd/systemd
  $ export RKT_STAGE1_SYSTEMD_VER=v215
  $ ./build

By default, it still fetch the upstream git repository with tag v215 as
before. So defining the new variables is not necessary.

It is also possible to build against a local systemd repository:

  $ export RKT_STAGE1_USR_FROM=src
  $ export RKT_STAGE1_SYSTEMD_SRC=/home/user/git/systemd
  $ export RKT_STAGE1_SYSTEMD_VER=HEAD
  $ ./build

This should help developers to test newer systemd versions.

The patches in stage1/rootfs/usr_from_src/patches/ are versioned: the
subdirectory used is defined by $RKT_STAGE1_SYSTEMD_VER. If "HEAD" is
used, the master patchset will be selected.
2015-04-28 17:24:52 +02:00
Eugene Yakubovich 89558960a5 Merge pull request #827 from eyakubovich/cni-intg
CNI integration
2015-04-27 15:03:10 -07:00
Eugene Yakubovich 7abd8f3b84 net: switch to using CNI plugins 2015-04-27 14:43:25 -07:00
Vito Caputo f445d37892 rkt/enter: use pod.getPID() to get container's pid race-free
- Fixup pod.getPID() to cover race between xToRun() and stage1 getting
  around to writing the pid file.

- Rework `rkt enter` to retrieve the pid in rkt/stage0 and supply it to
  stage1 enter.

- Rework stage1 enter to consume pid from argv instead of opening it
  itself, so as to not have to duplicate the same race coverage.

- Some stage1 enter code cleanups thrown in for good measure, particularly
  around the argv forwarding copy which started simple had become unwieldy.
2015-04-24 17:29:30 -07:00
Vito Caputo aa4183a017 stage1/enter: use pexit_if() for errno-valid conditions
Also the capitalized error messages.
2015-04-24 13:46:49 -07:00
Alban Crequy d0d2396079 diagexec: non-root apps 2015-04-24 10:47:58 +02:00
Jonathan Boulle c8a7050a88 version: bump to v0.5.4 2015-04-23 10:39:30 -07:00
Eugene Yakubovich c59e150850 net: remove obsolete 169.254.169.255/32 route 2015-04-15 10:41:37 -07:00
Eugene Yakubovich 98e78d5f08 stage1: add stage1 gc entrypoint
Stage1 GC entrypoint is called as part of
"rkt gc", prior to recursively removing the
pod directory. This give the stage1 to do
any necessary cleanup.
2015-04-14 14:22:57 -07:00
Jonathan Boulle a8afce77b6 version: bump to v0.5.3 2015-03-31 20:38:54 -07:00
Jonathan Boulle 79753c9b19 *: rocket -> rkt 2015-03-31 16:31:21 -07:00
Jonathan Boulle 3fd0303076 *: global containers -> pods rename 2015-03-31 15:55:06 -07:00
Jonathan Boulle 16bcfe9750 version: bump to v0.5.2 2015-03-30 23:10:05 -07:00
Jonathan Boulle d11d31d717 stage1: bump acVersion 2015-03-27 13:59:51 -07:00
Vito Caputo fdcd649471 stage1: add support for building stage1's usr from src
Currently only systemd is being built from source, toggled from the
top-level build script by setting RKT_STAGE1_USR_FROM=src, e.g:
RKT_STAGE1_USR_FROM=src ./build

The default stage1 continues to be coreos-derived, but may be explicitly
specified via:
RKT_STAGE1_USR_FROM=coreos ./build

The stage1 init program has been modified to introspect the "flavor" of
stage1 at runtime, which influences how it invokes systemd-nspawn.

A small series of patches are included to give systemd-nspawn the
functionalities enabled via LD_PRELOAD of the shim in the coreos-derived
stage1.

The systemd source is cloned at build time the first time an
RKT_STAGE1_USR_FROM=src build is performed, at this time the same version
as the coreos image provided is being used, but this can be bumped in the
future.
2015-03-23 19:08:20 -07:00
Vito Caputo 310d3ba4c2 stage1: rename rootfs/usr -> rootfs/usr_from_coreos 2015-03-23 18:56:06 -07:00
Vito Caputo 39f9230780 stage1: replace exit-watcher's sleep with small utility
Moving towards fewer external dependencies, aiming for only systemd being
external so it's the only complicated thing we need to do things like try
pulling from the host or building from source when not deriving stage1 from
a CoreOS image.
2015-03-23 18:56:06 -07:00
Iago López Galeiras 143fc96a37 stage1: prepare-app: unlink /dev/ptmx symlink when it exists 2015-03-23 17:00:21 +01:00
Iago López Galeiras ba2b1f52d9 stage1: prepare-app: prepare /dev/pts for apps
Interactive containers expect /dev/pts.

Also, make /dev/ptmx a symlink to /dev/pts/ptmx.
See https://www.kernel.org/doc/Documentation/filesystems/devpts.txt
2015-03-23 12:58:57 +01:00
Iago López Galeiras 7e125c03ec stage1: prepare-app: refactor dir bind-mounts 2015-03-23 12:58:57 +01:00
Vito Caputo fe95c5daf2 stage1: create /tmp in prepare-app instead of stage0
Also clear umask in prepare-app so modes are used verbatim.
2015-03-19 13:31:08 -07:00
Alban Crequy 9ea9e365b6 stage1: prepare-app: fix volumes during the root bind-mount
The bind mount on / was introduced by
https://github.com/coreos/rocket/pull/626 to fix the "Docker inside
Rocket" use case in https://github.com/coreos/rocket/issues/638

But this introduced a regression on volume mounted via "rkt run
-volume". This patch fixes the regression.

Regression discovered by Iago when testing Flannel from
https://github.com/coreos/rocket/issues/389
2015-03-19 13:08:42 +01:00
Alban Crequy f70c4e8d07 stage1: prepare-app: unlink /dev/shm symlink when it exists 2015-03-17 12:03:45 +01:00
Alban Crequy cf0028c11f stage1: prepare-app: prepare /dev/shm for apps
Docker needs /dev/shm:
https://github.com/coreos/rocket/issues/506
2015-03-17 12:03:45 +01:00
Alban Crequy deb079a16e stage1: prepare-app: make stage2's root a mount point
It is needed to run Docker inside Rocket:
https://github.com/coreos/rocket/issues/506
2015-03-17 12:03:45 +01:00
Alban Crequy 5e6c303f9e stage1: prepare-app: prepare /sys for apps
https://github.com/coreos/rocket/issues/606
2015-03-17 12:03:45 +01:00
Brandon Philips 349cedf54e Merge pull request #546 from endocode/alban/prepare-app
stage1: prepare-app: prepare /dev and /proc for apps
2015-03-05 17:58:42 -08:00
Eugene Yakubovich d19364433b net: added macvlan plugin
macvlan uses the specified host's interface to send the
packets. However macvlan will have its own MAC address
(randomly generated by the kernel) making it look like
yet another interface on the link.

Fixes #478
2015-03-03 10:51:12 -08:00
Alban Crequy e54bb884fc stage1: prepare-app: prepare /dev and /proc for apps
prepare-app runs in stage1, so it knows how to handle dynamic
/dev/console.

It does not change diagexec so it does not break rkt enter.

Bind mount individual /dev entries instead of bind mounting the /dev
directory so rkt run --volume /dev/sda6 (performed in stage0) should
still work.

Do not use a bunch of systemd mount units because they don't create
nonexistent target files. See:
http://lists.freedesktop.org/archives/systemd-devel/2015-February/028657.html
We might revisit this option if systemd mount units automatically create
the nonexistent target files.

Avoid systemd option PrivateDevices to avoid shadowing additional bind
mounts passed with --volume.
2015-03-03 14:25:04 +01:00
Vito Caputo 797baa098c *: rename stage1 entrypoint annotation from init->run
Currently the annotation "coreos.com/rocket/stage1/init" represents the stage1
entrypoint used by `rkt run`.  Renaming to "coreos.com/rocket/stage1/run" is
more consistent and self-documenting, aligning with the `rkt enter` entrypoint
annotation "coreos.com/rocket/stage1/enter".
2015-02-09 13:45:31 -08:00
Eugene Yakubovich 356555864a net: added IP masquerade support 2015-02-06 16:08:39 -08:00
Jonathan Boulle 72395d1ffa *: vendor appc spec
Take two at getting the spec vendored into Rocket with Godep.
Since actool is used during the construction of the stage1.aci, it
really needs to be vendored too to prevent any unexpected divergence
between whatever version the user happens to have in their PATH. Thus,
we introduce a silly dummy package (stage1/dummy.go) to coerce Godep
into vendoring actool. This also requires a slight rearrangement of the
appc repo, moving some functionality from actool itself into the aci
package.
2015-02-05 14:36:40 +01:00
Vito Caputo 310b3e1d7f stage1: set app environment via diagexec instead of systemd
This change places per-app environment files in stage1/rootfs/rkt/env/$id

The stage1 systemd service files no longer contain Environment directives,
instead they simply supply the env file path to diagexec.

`rkt enter` also uses diagexec and needs to enter the same enviroment of the
app being entered.  This commit also modifies the stage1 /enter to supply the
env file to its diagexec invocation, giving `rkt enter` an environment
consistent with the app's.
2015-02-04 17:08:58 -08:00
Eugene Yakubovich 630beda3ae net: cnvt ipmanager to ipam plugin; make use of ipam plugins
- Convert ipamanager into IPAM plugin (static) that uses env
variables instead of cmd line args
- Make bridge and veth plugins call out to IPAM plugin
- Refacor code around the new IPAM plugins
2015-02-02 18:15:51 -08:00
Vito Caputo bae52e60ae *: switch stage1 to aci image format
One may now specify an alternative stage1 in a style like run and fetch:
rkt run --stage1-image foo.com/rocket/stage1 app

--stage1-image defaults to "stage1.aci" within the same directory as the rkt
binary.  This is discovered at runtime via "/proc/self/exe"; as long as the rkt
executable and stage1.aci share a directory it should "just work" regardless of
the directory's location and where rkt is executed from.
2015-01-30 10:51:15 -08:00
Vito Caputo deaf549211 build: use go-bindata -nomemcopy=true to reduce runtime memory req. 2015-01-23 14:58:46 -08:00
Eugene Yakubovich ba9b6bc82a net: use env vars for plugin params; use stage1 rootfs for builtins
Simplifying the plugin interface. No more HTTP interface and plugin
configs. Plugin type maps to executable name in stage1 rootfs or
on host in a well known dir. Env vars are used for parameter passing
to the plugin. Also, default net conf is kept in stage1 rootfs to make
private networking work "out of the box".
2015-01-22 15:17:51 -08:00
Vito Caputo e034b2fb9e stage1/enter: supply a working directory to diagexec
This is currently statically set to "/"; /enter isn't currently
supplied a work directory for the app being entered.
2015-01-16 13:55:49 -08:00
Vito Caputo 32a9acb215 stage1/diagexec: add working directory option
New diagexec calling convention:
diagexec /path/to/chroot /desired/cwd/within/root cmd_within_root [ARGS [...]]
2015-01-16 13:02:08 -08:00
Vito Caputo 0c50c5bffe Merge pull request #330 from vcaputo/enter_post_make
rkt enter
2015-01-12 12:36:17 -08:00
Vito Caputo 265731eb58 rkt enter: implement entering app namespaces
This introduces a stage1 /enter entrypoint which expects:
 * the CWD to be the container root (/var/lib/rkt/containers/$cuuid)
 * argv[1] to be the shorthash app imageid to enter
 * argv[2] to be the command for executing via execvp
 * argv[3+] any additional arguments for the command

An example manual /enter shell invocation would be:
 cd /var/lib/rkt/containers/9793daa1-e064-49a6-9d52-261a992bddd8 && \
 ./enter sha512-9e6a3ab113ed783c1ffdcbbaa7d16f3b /bin/bash -i

"rkt enter" effectively does this after some simple argv parsing/checks and
verification of the container being presently active.

What must occur within /enter is stage1-implementation specific, hence its
inclusion within the stage1 rootfs.

The /enter implemented here consists of a statically-linked minimal C
program which:
   * reads the container's PID from ./pid
   * enters the namespaces of the container's PID 1
   * forks to realize CLONE_NEWPID
   * execs /diagexec in the child using the argv[] /enter received
   * waits for the child to exit

The UX side looks like:
 rkt enter [--imageid IMAGEID] UUID [CMD [ARGS ...]]

 If no IMAGEID is specified, and the container is a singleton then its lone
 app is entered.  Otherwise a list of apps and their ids is printed and the
 user must specify which app to enter in a separate invocation via --imageid.

 If no cmd is specified, /bin/bash is assumed.

 Examples:

  Multiple images, ambiguous enter:
   $ rkt enter 7324849e-80b7-4874-a14b-79de35291485
   Container "7324849e-80b7-4874-a14b-79de35291485" contains multiple apps:
           sha512-8a4a96dac7216ca311962d19ffa00b6c: pauser
           sha512-2893e1a4714bea23ee9f21c7dd6561a4: sleeper
   Unable to determine image id: specify app using "rkt enter --imageid ..."

  Multiple images, specified "pauser":
   $ rkt enter --imageid sha512-8a4a96dac7216ca311962d19ffa00b6c 7324849e-80b7-4874-a14b-79de35291485
   No command specified, assuming "/bin/bash"
   bash-4.3#

  Multiple images, enter "pauser", run /pause:
   $ rkt enter --imageid sha512-8a4a96dac7216ca311962d19ffa00b6c 7324849e-80b7-4874-a14b-79de35291485 /pause
   paused...^C
   $

  Single image:
   $ rkt enter 98d688dc-5665-496c-8556-f553020ccd57
   No command specified, assuming "/bin/bash"
   bash-4.3#
2015-01-09 17:42:39 -08:00
Vito Caputo 486c811761 stage1/rootfs: add missing license headings 2015-01-09 16:49:37 -08:00
Vito Caputo 8553ea1649 stage1/diagexec: use execvp() to facilitate rkt enter
In `rkt enter` usage, users are likely to specify a filename rather than a
path expecting $PATH lookup resolution to occur.
2015-01-09 16:20:19 -08:00