Commit graph

2249 commits

Author SHA1 Message Date
Daniel J Walsh
8e744621ff
Merge pull request #1334 from sboeuf/ensure_ctr_stopped_2
crio: Ensure container state is stopped when calling StopContainer()
2018-03-03 10:16:16 -05:00
Sebastien Boeuf
1391c5c2fd crio: Ensure container state is stopped when calling StopContainer()
CRI-O works well with runc when stopping a container because as soon
as the container process returns, it can consider every container
resources such as its rootfs as being freed, and it can proceed
further by unmounting it.

But in case of virtualized runtime such as Clear Containers or Kata
Containers, the same rootfs is being mounted into the VM, usually as
a device being hotplugged. This means the runtime will need to be
triggered after the container process has returned. Particularly,
such runtimes should expect a call into "state" in order to realize
the container process is not running anymore, and it would trigger
the container to be officially stopped, proceeding to the necessary
unmounts.

The way this can be done from CRI-O, without impacting the case of
runc, is to explicitly wait for the container status to be updated
into "stopped" after the container process has returned. This way
CRI-O will call into "state" as long as it cannot see the container
status being updated properly, generating an error after a timeout.

Both PollUpdateStatusStopped() and WaitContainerStateStopped() make
use of go routines in order to support a timeout definition. They
follow the waitContainerStop() approach with chControl.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2018-03-02 14:55:29 -08:00
Daniel J Walsh
a5c3e05f9f
Merge pull request #1377 from mrunalp/sym_context_master
Add context to net ns symlink removal errors
2018-03-02 17:06:18 -05:00
Mrunal Patel
61a49a111d
Merge pull request #1392 from umohnani8/pid-ns
Enable per pod PID namespace setting
2018-03-02 13:33:14 -08:00
Daniel J Walsh
8e8224c5b6
Merge pull request #1406 from rhatdan/Makefile
Have make file create the oci/hooks.d directory
2018-03-02 13:56:58 -05:00
Daniel J Walsh
1d89b897f7
Merge pull request #1366 from giuseppe/conmon-additional-command-atexit
conmon: add new option to call cleanup program at exit
2018-03-02 13:23:52 -05:00
Mrunal Patel
ca1cd2b708
Merge pull request #1355 from wking/hook-docs-copy-edit
hooks: Copy-edits for the Markdown docs (RFC 2119, etc.)
2018-03-02 10:05:19 -08:00
Mrunal Patel
fe10bc81c6
Merge pull request #1403 from vbatts/vendor_update
vendor: _actually_ update containers/storage?
2018-03-02 10:04:20 -08:00
Mrunal Patel
66d3ab890f
Merge pull request #1405 from runcom/closed-channel
server: prevent double channel close
2018-03-02 09:44:56 -08:00
Daniel J Walsh
6f7e0e837a Have make file create the oci/hooks.d directory
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-03-02 12:14:16 -05:00
umohnani8
156e21ddf9 Enable per pod PID namespace setting
If the pid namespace mode is set to POD, then the container's namespace
should be set to the namespace of the pod infra container.

Signed-off-by: umohnani8 <umohnani@redhat.com>
2018-03-02 12:04:02 -05:00
umohnani8
e5fdb6bc9e Vendor in latest k8s.io changes
These changes allow for the container's pid namespace to be set to the same
as the pod infra container's namespace if the pid namespace mode is set to POD

Signed-off-by: umohnani8 <umohnani@redhat.com>
2018-03-02 09:31:34 -05:00
Antonio Murdaca
1b86b57b07
server: prevent double channel close
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-03-02 13:43:09 +01:00
4a65baf87b
vendor: _actually_ update containers/storage?
I obviously bungled my attempt in #1391 so this is fixing that.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-03-01 16:40:22 -05:00
Daniel J Walsh
0b736bb43f
Merge pull request #1365 from giuseppe/log-file-always-present
conmon: open+rename the log file instead of unlink+open
2018-03-01 12:50:22 -08:00
Daniel J Walsh
3e328c50a6
Merge pull request #1384 from vbatts/platform-003
lib: abstract out sandbox for platforms
2018-03-01 12:42:34 -08:00
Daniel J Walsh
0a1ae89ba6
Merge pull request #1345 from runcom/fsnotify-hooks
Fsnotify hooks
2018-03-01 12:18:00 -08:00
W. Trevor King
0b08c8437c hooks: Example copy-edits (backticks, etc.)
Also move the English before the example, because folks reading this
documentation already speak English and are just learning the JSON
structure.

The 'console' syntax highlighting is because GitHub uses Linguist [1],
and Linguist recognizes 'console' as an alias for ShellSession [2].
I've chosen 'console' because it's shorter than 'ShellSession' and not
interpreter-specific like 'bash session'.

Dan requested the 'Kpod' -> 'podman' change [3].

[1]: https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
[2]: https://github.com/github/linguist/blob/v6.0.1/lib/linguist/languages.yml#L4289-L4300
[3]: https://github.com/kubernetes-incubator/cri-o/pull/1355#pullrequestreview-98250057

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-03-01 09:14:28 -08:00
Daniel J Walsh
cefb7f8b9e
Merge pull request #1395 from rhatdan/podman
Change all references from kpod to podman
2018-03-01 06:42:47 -08:00
Daniel J Walsh
b8e5769652 Change all references to kpod to podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-03-01 04:14:31 -08:00
Daniel J Walsh
0caee670a0
Merge pull request #1371 from wking/respect-start-pipe-read-errors
conmon: Respect start-pipe read errors
2018-03-01 04:04:45 -08:00
Daniel J Walsh
1c7a32bc83
Merge pull request #1391 from vbatts/vendor_update
vendor: update containers/storage to latest
2018-03-01 03:59:14 -08:00
Antonio Murdaca
f8b6736d81
Merge pull request #1390 from mrunalp/exec_sync_tty_master
execsync: Set terminal to true when we pass -t to conmon
2018-03-01 10:16:22 +01:00
Daniel J Walsh
bb9a5aadd8
Merge pull request #1382 from vbatts/platform-001
crio: abstract the selinux call
2018-02-28 14:05:05 -08:00
Daniel J Walsh
2f659d2fca
Merge pull request #1373 from wking/conmon-optional-exit-dir
conmon: Make --exit-dir optional
2018-02-28 14:04:16 -08:00
Daniel J Walsh
14bda8eddf
Merge pull request #1375 from mrunalp/cni_dir_rw_master
Make the /opt/cni mount rw
2018-02-28 14:03:00 -08:00
72d480c8c0
vendor: update containers/storage to latest
using github.com/LK4D4/vndr, but then trimming all vendored packages
that had changed, back to only containers/storage.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-02-28 16:01:07 -05:00
Mrunal Patel
30af659b92 execsync: Set terminal to true when we pass -t to conmon
We may consider setting it to true all the time but this
should match our previous behavior before we started
using process json for exec.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2018-02-28 10:47:08 -08:00
Mrunal Patel
320a102c1c
Merge pull request #1389 from wking/ignore-gopathok
.gitignore: Ignore /.gopathok
2018-02-28 10:44:30 -08:00
Mrunal Patel
4149ee77a8
Merge pull request #1388 from adelton/no-gopath
The Makefile works without GOPATH set and without install.tools fine.
2018-02-28 10:38:15 -08:00
W. Trevor King
0ebf75fb71 .gitignore: Ignore /.gopathok
We've been occasionally creating this file since 9c44933b (build:
create a local GOPATH if none specified, 2017-03-27, #410).  But it's
recording information about the local environment, not part of our
common source.  Adding it to .gitignore helps avoid having it
accidentally committed.

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-02-28 10:06:15 -08:00
Antonio Murdaca
47b095ad06
Merge pull request #1381 from mrunalp/bump_1.10_dev
version: Bump to 1.10 dev
2018-02-28 19:02:52 +01:00
Jan Pazdziora
96b2d0a4b7 The Makefile works without GOPATH set and without install.tools fine.
The GOPATH layout is created in the Makefile:
mkdir -p "/home/test/cri-o/_output/src/github.com/kubernetes-incubator"
ln -s "/home/test/cri-o" "/home/test/cri-o/_output/src/github.com/kubernetes-incubator"

Signed-off-by: Jan Pazdziora <jpazdziora@redhat.com>
2018-02-28 10:00:16 +01:00
Mrunal Patel
4f1e5bef91 version: Bump to 1.10 dev
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2018-02-27 16:03:03 -08:00
509890acc1
lib: abstract out sandbox for platforms
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-02-27 16:16:48 -05:00
23ff4427e2
crio: abstract the selinux call
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-02-27 16:14:51 -05:00
Mrunal Patel
f94948d8ec Add context to net ns symlink removal errors
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2018-02-26 10:29:32 -08:00
Giuseppe Scrivano
a62b39ffa4
conmon: open+rename the log file instead of unlink+open
at no time the log file is not accessible by its path.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-02-26 10:09:12 +01:00
W. Trevor King
1390740df2 conmon: Make --exit-dir optional
CRI-O's server relies on this for creation attempts, but it can set
the option.  conmon itself doesn't need to care one way or the other.
Perhaps it is being called by a process that doesn't care about the
container exit code or has another way to access that information.
With this commit, we trust callers to set --exit-dir if they want it,
instead of requiring non-exec callers to set it.

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-02-24 20:48:42 -08:00
Mrunal Patel
4fd94187bc Make the /opt/cni mount rw
kubernetes daemon sets want to be able to drop plugin
payload into the /opt/cni/bin directory.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2018-02-24 07:56:02 -08:00
Antonio Murdaca
8ea79e755f
Merge pull request #1369 from rhatdan/selinuxopt
Fix SELINUXOPT handling
2018-02-24 16:47:53 +01:00
Giuseppe Scrivano
e6145b3596
conmon: add new option to call cleanup program at exit
add the possibility to run a custom command, and optionally provide
additional arguments to it, when conmon exits.

For example, it could be possible to delete the terminated container
with:

conmon [...] --exit-command /usr/bin/runc \
             --exit-command-arg delete \
             --exit-command-arg $CONTAINER_UUID

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-02-24 13:11:08 +01:00
Daniel J Walsh
51b52191e7 Fix SELINUXOPT handling
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-02-24 04:49:29 -05:00
W. Trevor King
1262234531 conmon: Respect start-pipe read errors
Avoid:

  $ make clean && make conmon.o 2>&1
  rm -f conmon.o cmsg.o ../bin/conmon
  cc -std=c99 -Os -Wall -Wextra -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DVERSION=\"1.9.0-dev\" -DGIT_COMMIT=\""74cd1ec97c13a9784ce5e67a9e50e8977b5d2f38"\"   -c -o conmon.o conmon.c
  conmon.c: In function ‘main’:
  conmon.c:1175:3: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
     read(start_pipe_fd, buf, BUF_SIZE);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

by catching and exiting on any read errors.  A read error here would
be because the caller died before writing to the start pipe, and we
don't want to continue in those cases because it would reopen the
cgroup race discussed in af4fbcd9 (conmon: Don't leave zombies and fix
cgroup race, 2017-06-09, #583).  af4fbcd9 is where this line
originally landed, and it didn't have error checking then.

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-02-23 11:25:29 -08:00
Daniel J Walsh
74cd1ec97c
Merge pull request #1359 from giuseppe/conmon-version
conmon: implement --version
2018-02-23 13:28:39 -05:00
Mrunal Patel
0b87fe448f
Merge pull request #1367 from runcom/fix-selinuxopt
Makefile: fix SELINUXOPT generation
2018-02-23 07:46:07 -08:00
Antonio Murdaca
7f82f9bbe8
Makefile: fix SELINUXOPT generation
This patch fixes selinuxopt generation as found in:

```
install /usr/sbin/selinuxenabled -D -m 644 crio.conf /etc/crio/crio.conf
```

The above is clearly wrong when installing the configuration because
`commmand -v` outputs the path of selinuxenabled as well, resulting in

/usr/bin/selinuxenabled -Z

This patch fixes that by just echoing the -Z as needed.

Issue introduced in
https://github.com/kubernetes-incubator/cri-o/pull/1363

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-02-23 16:06:01 +01:00
Giuseppe Scrivano
6a23a293d7
conmon: add new option --version
Print the version and exit immediately.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-02-23 09:41:48 +01:00
Giuseppe Scrivano
96a9afedf6
Makefile: split declarations to Makefile.inc
so that they can be reused by another Makefile

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-02-23 09:41:48 +01:00
Mrunal Patel
d30663558f
Merge pull request #1362 from wking/install-prerequisites
Makefile: Fix install.* prerequisites
2018-02-22 19:22:58 -08:00