Compare commits

...

1213 commits
v0.3 ... master

Author SHA1 Message Date
Antonio Murdaca
54e76afc03
Merge pull request #1281 from wking/gofmt-show-diff
Makefile: Use 'git diff' to show gofmt changes
2018-01-24 15:32:49 +01:00
Daniel J Walsh
4fee97abe3
Merge pull request #1278 from remore/patch-1
Fix a few minor errors in the tutorial document
2018-01-24 04:15:33 -05:00
Kei Sawada
a50f352eb4 Update tutorial.md to fix a few minor errors
Signed-off-by: Kei Sawada <k@swd.cc>
2018-01-24 14:47:32 +09:00
Mrunal Patel
ed40d645cd
Merge pull request #1255 from runcom/panics-grpc-getters
server: use grpc getters to avoid panics
2018-01-23 07:43:08 -08:00
W. Trevor King
8dbc2d1fff Makefile: Use 'git diff' to show gofmt changes
This makes fixing errors easier.  Before this commit, errors looked
like [1]:

  $ make gofmt
  !!! 'gofmt -s' needs to be run on the following files:
  ./lib/config.go
  make: *** [gofmt] Error 1

But that's not very helpful when your local gofmt thinks the file is
fine.  With this commit, errors will look like:

  $ make gofmt
  find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
  git diff --exit-code
  diff --git a/lib/config.go b/lib/config.go
  index 1acca8c7..6a63b2b0 100644
  --- a/lib/config.go
  +++ b/lib/config.go
  @@ -2,7 +2,7 @@ package lib

   import (
          "bytes"
  -"io/ioutil"
  +       "io/ioutil"

          "github.com/BurntSushi/toml"
          "github.com/kubernetes-incubator/cri-o/oci"
  make: *** [Makefile:68: gofmt] Error 1

(or whatever, I just stuffed in a formatting error for demonstration
purposes).

Also remove the helper script in favor of direct Makefile calls,
because with Git handling difference reporting and exit status, this
becomes a simpler check.  find's -exec, !, and -path arguments are
specified in POSIX [2].

[1]: https://travis-ci.org/kubernetes-incubator/cri-o/jobs/331949394#L1075
[2]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-01-22 16:47:09 -08:00
Mrunal Patel
ddb14b7303
Merge pull request #1269 from wking/server-capabilities-setup-helper
server/container_create: Factor out setupCapabilities helper
2018-01-22 15:29:22 -08:00
Mrunal Patel
924821e4bf
Merge pull request #1277 from wking/namespace-test-helper
test/namespaces: Factor out pid_namespace_test helper
2018-01-20 19:49:38 -08:00
W. Trevor King
080b84dfcd test/namespaces: Factor out pid_namespace_test helper
DRY up this code.  The ${parameter:-word} syntax is in POSIX [1].

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-01-20 15:58:47 -08:00
Mrunal Patel
214096b7ed
Merge pull request #1268 from wking/libdevmapper-install-check
hack/libdm_installed.sh: Add a test for libdevmapper.h
2018-01-20 09:19:24 -08:00
Antonio Murdaca
8c87b6104f
Merge pull request #1267 from mrunalp/update_readme_1.9
Add 1.9 release to compatibility table
2018-01-20 02:28:20 +01:00
Mrunal Patel
b7995aa526
Merge pull request #1275 from wking/remove-unused-play-png
docs: Remove the unused play.png
2018-01-19 17:02:33 -08:00
W. Trevor King
822a6516cf docs: Remove the unused play.png
The last consumer was removed in 1bf6d203 (Remove kpod code after
repository move, 2017-11-02, #1111).

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-01-19 16:12:39 -08:00
W. Trevor King
523326b7ba server/container_create: Factor out setupCapabilities helper
Having a separate function holding the details of this makes reading
createSandboxContainer easier.

While I was moving the code, I've also cleaned up two things:

* The nil capabilities check is now earlier, where before it had been
  between the ALL handling and the non-ALL handling.

* I've added a capPrefixed variable to avoid having multiple
  toCAPPrefixed calls per capability.

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-01-19 11:52:45 -08:00
W. Trevor King
826298483a hack/libdm_installed: Add a test for libdevmapper.h
Avoid crashing 'make' with:

  No package 'devmapper' found

by disabling the devmapper driver when the library it requires is not
installed.  Also give the libdm_no_deferred_remove script a more
specific name to avoid confusion.

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-01-19 11:43:24 -08:00
Mrunal Patel
7851115693 Add 1.9 release to compatibility table
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2018-01-19 10:37:51 -08:00
Antonio Murdaca
77561e95cf
Merge pull request #1264 from wking/test-readme-plugins-moved-from-cni
test/README: Update the CNI plugins instructions for /cni → /plugins
2018-01-18 23:58:08 +01:00
Antonio Murdaca
cbfdda868a
Merge pull request #1263 from wking/doc-stale-make-output
kubernetes: Simplify and freshen the required-files table
2018-01-18 23:54:15 +01:00
W. Trevor King
282b900433 test/README: Update the CNI plugins instructions for /cni -> /plugins
Catching up with the Dockerfile change from f51b0a10 (Dockerfile: move
to containernetworking/plugins, 2017-05-25, #536).  The new plugins
commit from f51b0a10 is still the current Dockerfile entry.

This commit also replaces the previous 'go get' call with a git clone
to match the Dockerfile's approach.  I've added an additional 'cd'
call so I don't have to repeat $GOPATH/... more than once, but other
than that, the example matches the current Dockerfile entry.

I've also removed some line-continuation slashes we've been dragging
around since the section landed 07ccda33 (tests: Install CNI
configuration files by default, 2017-04-06, #434).  I'm guessing they
were a copy/paste bug from the Dockerfile, but this example has new
prompts for each command (so it doesn't need continuation) while the
Dockerfile is using && chaining (so it does).

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-01-18 14:12:33 -08:00
Mrunal Patel
1bb5846d7d
Merge pull request #1261 from wking/clear-containers-moved
test/README: Clear Containers moved to clearcontainers/runtime
2018-01-18 14:01:42 -08:00
W. Trevor King
15d839ea0d kubernetes: Simplify and freshen the required-files table
The cri-o entries are stale vs. the content currently installed by the
Makefile.  This commit drops them and just references the make call
before starting the table, which lets us stay DRY.

runc is not built from the cri-o repository.  The docs have claimed it
was since 983aec63 (doc: Add instruction to run cri-o with kubernetes,
2017-01-31, #353), but it's independent like the CNI plugins.

The CNI plugins were moved to containernetworking/plugins in
containernetworking/cni@bc0d09e (plugins: moved to
containernetworking/plugins, 2017-05-17, containernetworking/cni#457).

I've added a link to the in-repo policy.json example.  We probably
also want to link to the docs (for the version we vendor?) [1], but
I've left that alone for now.

The CNI config examples were removed from the project README in
9088a12c (contrib: cni: provide example CNI configurations,
2016-12-24, #295).  I've adjusted the reference to point to the new
location, although again, I'd rather replace this with links to
upstream docs.

[1]: 3d0304a021/docs/policy.json.md

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-01-18 13:49:50 -08:00
W. Trevor King
bf8a99c085 tutorial: Drop 'make install' output to stay DRY
'make install' hasn't installed crio.conf since 8b632729 (Install to
/usr/local to avoid conflicts with vendor binaries, 2017-01-04, #304).
And Make output is usually not particularly interesting.

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-01-18 13:27:39 -08:00
W. Trevor King
2bf750c871 tutorial: Drop install.config output to stay DRY
install.config has also installed rio-umount.conf since 51b225474
(Tell oci-umount where to remove mountpoints inside container, #937,
2017-09-21).  And Make output is usually not particularly interesting.

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-01-18 13:18:28 -08:00
Mrunal Patel
ba2b4a03d0
Merge pull request #1262 from wking/mailmap
.mailmap: Add entries for inconsistent users
2018-01-18 10:55:53 -08:00
W. Trevor King
8c7c70c2db .mailmap: Add entries for inconsistent users
Where the same user had multiple entries, I mostly went with whichever
entry had the most-recent non-merge commits.

The order is alphabetical according to Emacs' sort-lines.

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-01-18 10:17:00 -08:00
W. Trevor King
e124834b0d test/README: Clear Containers moved to clearcontainers/runtime
And changed the name of their binary.  This commit catches the docs up
with intel/cc-oci-runtime#1065 (merged 2017-09-25).

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-01-18 09:47:56 -08:00
Antonio Murdaca
cb8033cd19
Merge pull request #1244 from rhatdan/hooks-args
Allow additional arguments to be passed into hooks
2018-01-15 23:29:45 +01:00
Antonio Murdaca
8c190a683c
server: use grpc getters to avoid panics
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-01-12 16:14:29 +01:00
Mrunal Patel
d0e0303921
Merge pull request #1252 from runcom/node-e2e
[DO NOT MERGE] contrib: test: add node-e2e job
2018-01-11 10:13:36 -08:00
Antonio Murdaca
8d2a572ead
contrib: test: add node-e2e job
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-01-11 16:56:47 +01:00
Daniel J Walsh
22e25158ca
Merge pull request #1251 from vbatts/Makefile_config_target
Makefile: installing a config, requires a config
2018-01-11 06:12:47 -05:00
27c2eda635
Makefile: installing a config, requires a config
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-01-10 16:23:35 -05:00
Daniel J Walsh
23d20c9db5 Allow additional arguments to be passed into hooks
If a packager wants to be able to support addititional arguments on his
hook this will allow them to setup the configuration with these arguments.

For example this would allow a hook developer to add support for a --debug
flag to change the level of debugging in his hook.

In order to complete this task, I had to vendor in the latest
github.com://opencontainers/runtime-tools, which caused me to have to fix a
Mount and Capability interface calls

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-01-09 13:44:16 -05:00
Mrunal Patel
41aaf4e3d8
Merge pull request #1250 from giuseppe/fix-tmpdir-files
syscontainer: create /var/run/crio
2018-01-09 10:01:11 -08:00
Giuseppe Scrivano
2cb22eba49
syscontainer, fedora: create /var/run/crio
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-01-09 18:01:03 +01:00
Giuseppe Scrivano
6bb1b7e17d
syscontainer, rhel: create /var/run/crio
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-01-09 18:00:53 +01:00
Giuseppe Scrivano
b1b380d67b
syscontainer, centos: create /var/run/crio
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-01-09 18:00:43 +01:00
Antonio Murdaca
6f4d7c1ae0
Merge pull request #1216 from rhatdan/conmon
Improve error messages on missing runtime
2018-01-06 14:48:22 +01:00
Mrunal Patel
c351bc81e1
Merge pull request #1245 from giuseppe/system-container-read-env-from-file
contrib: system containers read env from /etc/sysconfig/crio-(network|storage)
2018-01-04 14:31:43 -08:00
Giuseppe Scrivano
b5167d4e8f
syscontainer, centos: read env variables from files
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-01-04 20:14:52 +01:00
Giuseppe Scrivano
1f75ec82e1
syscontainer, fedora: read env variables from files
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-01-04 20:14:39 +01:00
Giuseppe Scrivano
3881f375b9
syscontainer, rhel: read env variables from files
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-01-04 20:14:29 +01:00
Mrunal Patel
ad46c581fa
Merge pull request #1243 from rhatdan/Makefile
Add -i flag to speed up compilation of cri-o packages
2018-01-04 10:54:48 -08:00
Daniel J Walsh
3c1c6d047e Add -i flag to speed up compilation of cri-o packages
Instead of compiling all of the *.go files each time, the
-i flag will cause them to be only compiled if they changed.

This will make developers much happier.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-01-04 10:53:33 -05:00
Mrunal Patel
a34038350c
Merge pull request #1237 from spiffxp/update-code-of-conduct
Update code-of-conduct.md
2018-01-02 09:38:52 -08:00
Aaron Crickenberger
a28eb8374e Update code-of-conduct.md
Refer to kubernetes/community as authoritative source for code of conduct

Signed-off-by: Aaron Crickenberger <spiffxp@gmail.com>
2018-01-02 06:55:21 -08:00
Mrunal Patel
295a11eb17
Merge pull request #1239 from jongwu/enable_arm64
Add bsdmainutils tool to Dockerfile to enable integration test on arm64
2018-01-01 18:04:27 -08:00
Mrunal Patel
28976738de
Merge pull request #1240 from wanghaoran1988/fix_log
fix log
2018-01-01 18:03:30 -08:00
Haoran Wang
88b13dfddf fix log
Signed-off-by: Haoran Wang <haowang@redhat.com>
2017-12-29 14:25:55 +08:00
Jianyong Wu
8b1fefad71 Add bsdmainutils tool to Dockerfile to enable integration test on arm64
Build image for integration test on arm64 will fail for lack of
hexdump. Add bsdmainutils tool to eliminate that failure and let
build image succussfully

Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2017-12-28 16:45:56 +08:00
Mrunal Patel
6b91df3da7
Merge pull request #1236 from runcom/cpuset-ctr-create
container_create: set cpuset cpus|mems
2017-12-23 12:20:45 -08:00
Antonio Murdaca
de0be63495
container_create: set cpuset cpus|mems
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-12-20 19:20:57 +01:00
Daniel J Walsh
a85f3127d8 Improve error messages on missing runtime
Also stat.h is included twice,
Add more info on log file name and error when failing to open.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-12-18 16:46:19 -05:00
Daniel J Walsh
6c0b79b706
Merge pull request #1208 from runcom/moar-tests
contrib: test: integration: enable more e2e kube tests
2017-12-18 10:25:50 -05:00
Mrunal Patel
aee7dea272
Merge pull request #1227 from runcom/bump-runc-systemd-race
bump runc to c6e4a1ebeb1a72b529c6f1b6ee2b1ae5b868b14f
2017-12-15 08:56:40 -08:00
Antonio Murdaca
e344ad105a
Merge pull request #1116 from nalind/storage-update-2
Update containers/image and containers/storage
2017-12-15 17:01:29 +01:00
Antonio Murdaca
43119a7b13
Merge branch 'lock-free-ops' into moar-tests
* lock-free-ops:
  lib,oci: drop stateLock when possible
2017-12-15 16:46:42 +01:00
Antonio Murdaca
ecc572e7cf
lib,oci: drop stateLock when possible
Should fix a possible deadlock in, at least, ListPodSandbox.
There seems to be no reason to hold stateLock when doing operations on
the memory_store for containers and sandboxes.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-12-15 15:31:58 +01:00
Antonio Murdaca
455245e65b
bump runc to c6e4a1ebeb1a72b529c6f1b6ee2b1ae5b868b14f
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-12-15 14:33:44 +01:00
Antonio Murdaca
7d2bde110a
contrib: test: integration: enable more e2e kube tests
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-12-14 22:21:42 +01:00
Nalin Dahyabhai
fa90249c59 Playbooks: install the atomic-registries package
Install atomic-registries to get a /etc/containers/registries.conf file,
so that we can resolve image names that don't include domain portions.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-14 14:23:53 -05:00
Nalin Dahyabhai
72442d0957 Don't skip a critest that we now pass
We can pass the "listImage should get exactly 2 repoTags in the result
image" test now, so we no longer need to skip it.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-14 14:23:53 -05:00
Nalin Dahyabhai
0ab8c507f4 Install python-rhsm-certificates, handle python-boto
Add python-rhsm-certificates to the list of packages that we require, so
that the required certificates are available for the
pull-image-with-signature tests.

Add per-distribution package install tasks so that we install either
python2-boto or python-boto, depending on whether we're running on
Fedora or RHEL/CentOS, respectively.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-14 14:23:53 -05:00
Nalin Dahyabhai
492f758176 Playbooks: don't assume the default network is eth0
Replace instances of "ansible_eth0.ipv4.address" with
"ansible_default_ipv4.address" in the integration test playbook, so that
we can run tests without depending on the name of the primary network
interface being "eth0".

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-14 14:23:53 -05:00
Nalin Dahyabhai
893aa4e8c7 Be more diligent about cleaning up failed-to-create containers
If server/Server.createSandboxContainer() fails after calling
server/Server.StorageRuntimeServer().CreateContainer(), cleanup logic in
server/Server.CreateContainer() won't try to clean it up, but we still
need to clean up the on-disk container and its layer.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-14 14:23:53 -05:00
Nalin Dahyabhai
6a456d1502 Use crictl instead of crioctl in image integration tests
Use crictl instead of crioctl in some of the integration tests that
exercise image handling.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-14 14:23:53 -05:00
Nalin Dahyabhai
5ea050fc12 Handle truncated IDs in imageService.ResolveNames()
Have ResolveNames() check if the value that it's been given is a
truncated version of the ID of a locally-available image, and if it is,
return the value as it was given.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-14 14:23:53 -05:00
Nalin Dahyabhai
ff7bbb4f0d Switch to ImageServer.UntagImage in RemoveImage handler
Add an UntagImage() method to pkg/storage/ImageServer, which will check
if the passed-in NameOrID is a name.  If so, it merely removes that name
from the image, removing the image only if it was the last name that the
image had.  If the NameOrID is an image ID, the image is removed, as
RemoveImage() does.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-14 14:23:53 -05:00
Nalin Dahyabhai
f3b7065bd8 Return image references from the storage package
The image's canonical reference is a name with a digest of the image's
manifest, so in imageService.ImageStatus() and
imageService.ListImages(), divide the image's name list into tagged and
digested values, and if we have names, add canonical versions.

In Server.ContainerStatus(), return the image name as it was given to us
as the image, and the image digested reference as the image reference.

In Server.ListImages(), be sure to only return tagged names in the
RepoTags field.  In Server.ImageStatus(), also return canonical
references in the RepoDigests field.

In Server.PullImage(), be sure that we consistently return the same
image reference for an image, whether we ended up pulling it or not.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-14 14:23:52 -05:00
Nalin Dahyabhai
553979e1fc storage: API fixups
github.com/containers/image/types.ImageReference.NewImage() can take a
*github.com/containers/image/types.SystemContext now, so pass it one if
pkg/storage/imageService.CanPull() has one to give it.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-14 11:06:55 -05:00
Nalin Dahyabhai
0651d3a8de Update containers/image and containers/storage
Bump containers/image to 3d0304a02154dddc8f97cc833aa0861cea5e9ade, and
containers/storage to 0d32dfce498e06c132c60dac945081bf44c22464.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-14 11:06:23 -05:00
Mrunal Patel
2fa1f3f74a
Merge pull request #1221 from runcom/split-critest-from-e2e
CI: split critest from e2e
2017-12-13 16:53:20 -08:00
Antonio Murdaca
d91df68638
CI: split critest from e2e
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-12-14 00:09:36 +01:00
Mrunal Patel
da50e6ca11
Merge pull request #1197 from runcom/sys-cont
contrib: import system containers
2017-12-13 09:22:55 -08:00
Mrunal Patel
ebc249cad8
Merge pull request #1214 from runcom/fix-1.10-vendor
vendor: bump to kube 1.10/master
2017-12-11 11:14:15 -08:00
Antonio Murdaca
f317ffce5b
vendor: bump to kube 1.10/master
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-12-11 16:45:48 +01:00
Mrunal Patel
a85ea609db
Merge pull request #1207 from runcom/fix-exec-termianl
container_exec: fix terminal true process json
2017-12-07 14:44:38 -08:00
Antonio Murdaca
afeab27a36
container_exec: fix terminal true process json
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-12-07 20:51:05 +01:00
Mrunal Patel
1f3fbdc987
Merge pull request #1206 from nlacasse/state-ignore-stderr
Only parse stdout from "state" command.  Ignore stderr.
2017-12-07 11:29:25 -08:00
Nicolas Lacasse
1138af9e59 Don't parse stderr as json when calling "state" command.
Some oci runtimes may used stderr for logging.  Cri-o should not try to
parse this output as json when calling the "state" command.

Signed-off-by: Nicolas Lacasse <nlacasse@google.com>
2017-12-06 09:52:54 -08:00
Antonio Murdaca
06904d4dbb
contrib: import system containers
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-12-02 12:24:40 +01:00
Mrunal Patel
85f303f3ff
Merge pull request #1198 from runcom/list-sandboxes-refactor
lib: sandbox: refactor to memory store
2017-12-01 11:36:46 -08:00
Mrunal Patel
989d275e76
Merge pull request #1170 from alexandrst88/fix-tutorial
Update install.md relevant documentation
2017-12-01 09:20:38 -10:00
Antonio Murdaca
d168fc5fec
lib: sandbox: refactor to memory store
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-12-01 18:16:08 +01:00
Daniel J Walsh
b9ffd277b9
Merge pull request #1192 from runcom/no-libkpod
libkpod -> lib rename
2017-12-01 08:44:44 -05:00
Antonio Murdaca
910cfab6e9
Merge pull request #910 from sameo/topic/bats
test: Add timeout before checking for status
2017-12-01 13:30:13 +01:00
Samuel Ortiz
a2e08d5dc4 test: Add timeout before checking for status
Under some slow environment (nested VMs) or with some
not as fast runtimes (Clear Containers), asking for a
status right away is racy.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-12-01 10:21:50 +01:00
Antonio Murdaca
0eaa52c356
Merge pull request #1184 from willstudy/unit_test
Adding unit tests for server/secrets.go
2017-12-01 10:04:30 +01:00
Antonio Murdaca
0ab5e80c38
Merge pull request #1193 from mrunalp/go_1.8.5
Bump up go version to 1.8.5
2017-11-30 22:19:34 +01:00
Mrunal Patel
2cae11ba35 Merge pull request #1189 from runcom/fix-apparmor-master
container_create: fix apparmor from container config
2017-11-30 08:56:46 -10:00
Mrunal Patel
40da5c2c16
Merge pull request #1186 from runcom/fixups-env-master
Fix env handling on exec
2017-11-30 08:54:33 -10:00
Antonio Murdaca
b8bba70f99
libkpod -> lib rename
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-30 17:08:26 +01:00
Mrunal Patel
32d2c2d57c Bump up go version to 1.8.5
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-11-30 08:02:02 -08:00
Antonio Murdaca
c8aad704dd
container_create: fix apparmor from container config
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-30 16:12:16 +01:00
Antonio Murdaca
ea0bf448fe
test: add exec/execsync env conflict test
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-30 12:54:58 +01:00
Antonio Murdaca
902acca4af
container_create: correctly set image and kube envs
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-30 12:28:50 +01:00
Antonio Murdaca
b59f31a2d5
oci: do not append conmon env to container process
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-30 11:23:42 +01:00
Antonio Murdaca
c6f68f1bf1
container_exec: use process file with runc exec
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-30 11:23:37 +01:00
Oleksandr Stepanov
a71948e9e7
Fixed install.md documentation
Signed-off-by: Oleksandr Stepanov <alexandrst88@gmail.com>
2017-11-30 10:38:20 +02:00
Mrunal Patel
6faef13293
Merge pull request #1168 from weiwei04/remove_crioctl
remove crioctl source code
2017-11-29 17:06:51 -10:00
Mrunal Patel
b2a78eba2b
Merge pull request #1185 from runcom/fix-runtime-deps
README.md: add all runtime dependencies
2017-11-29 05:47:13 -10:00
Antonio Murdaca
bae4d2241f
README.md: add all runtime dependencies
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-29 15:57:17 +01:00
Wei Wei
3006a2159a drop crioctl source code
Signed-off-by: Wei Wei <weiwei.inf@gmail.com>
2017-11-29 21:07:50 +08:00
Antonio Murdaca
5f5a7a3648
Merge pull request #1162 from mrunalp/add_partial_support
conmon: Add support for partial/newline log tags
2017-11-29 11:47:09 +01:00
Liu Chang
c0ad5277e6 Adding unit tests for server/secrets.go
Signed-off-by: Liu Chang <liuchang@qiniu.com>
2017-11-29 17:42:19 +08:00
Mrunal Patel
d10490bccf test: Add an integration test for partial line in logs
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-11-28 18:57:26 -08:00
Mrunal Patel
4cf4137be0 conmon: Add support for partial/newline log tags
This is for ttps://github.com/kubernetes/kubernetes/pull/55922

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-11-28 18:57:21 -08:00
Mrunal Patel
4a32d0ff33
Merge pull request #1183 from runcom/fix-image-pull-master
image_pull: fix image resolver
2017-11-28 16:49:15 -10:00
Antonio Murdaca
87f1ae214f
image_pull: fix image resolver
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-28 23:53:18 +01:00
Mrunal Patel
63371009ae
Merge pull request #1181 from runcom/remove-git-validation-ci
CI: drop git-validation as it's never used
2017-11-28 12:46:35 -10:00
Antonio Murdaca
03fb727f2b
CI: drop git-validation as it's never used
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-28 11:40:06 +01:00
Antonio Murdaca
851759c73b
Merge pull request #1179 from willstudy/unit_test
Adding unit tests for server/utils.go
2017-11-27 19:34:24 +01:00
Daniel J Walsh
8518e06e81
Merge pull request #1166 from willstudy/dev
Improve the readability of crio.8.md
2017-11-27 11:08:05 -05:00
Liu Chang
42800cc96b Adding unit tests for server/utils.go
Signed-off-by: Liu Chang <liuchang@qiniu.com>
2017-11-27 16:01:00 +08:00
Liu Chang
bf515de94d Improve the readability of crio.8.md
Signed-off-by: Liu Chang <liuchang@qiniu.com>
2017-11-27 11:04:09 +08:00
Mrunal Patel
070b8bfdc5
Merge pull request #1176 from runcom/fix-e2e-1.0
contrib: parametrize the crio socket for kube
2017-11-22 09:36:15 -10:00
Mrunal Patel
7508cdeace
Merge pull request #1173 from runcom/fix-cve
Add /proc/scsi to masked paths
2017-11-22 05:35:33 -10:00
Antonio Murdaca
67e2d28c86
Merge pull request #1171 from WeiZhang555/fix-readme
Cleanup: remove redundant lines in tutorial
2017-11-22 14:53:44 +01:00
Antonio Murdaca
2f344c7533
contrib: parametrize the crio socket for kube
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-22 14:14:06 +01:00
Antonio Murdaca
a75362dca0
Add /proc/scsi to masked paths
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-22 12:25:43 +01:00
z00280905
2fbbf49541 Cleanup: remove redundant lines in tutorial
Signed-off-by: z00280905 <zhangwei555@huawei.com>
2017-11-22 17:37:11 +08:00
Mrunal Patel
73c1a9823f
Merge pull request #1167 from runcom/wire-critest
CI: wire in critest
2017-11-21 06:16:19 -10:00
Antonio Murdaca
6da7193ff5
CI: wire in critest
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-21 11:19:37 +01:00
Antonio Murdaca
b3f59f31ad
Merge pull request #1159 from weiwei04/replace_crioctl_with_crictl_wip
Replace crioctl with crictl
2017-11-20 15:27:30 +01:00
Wei Wei
25dfde9044 replace crioctl with crictl
Signed-off-by: Wei Wei <weiwei.inf@gmail.com>
2017-11-20 13:46:52 +08:00
Daniel J Walsh
6c8ab88e9e
Merge pull request #1163 from mrunalp/pid_ns_opt_in
Make pid namespace sharing optional and disabled by default
2017-11-19 06:06:35 -05:00
Mrunal Patel
946307e5c2 Make pid namespace sharing optional and disabled by default
We reverse the logic so that pid ns sharing is disabled by default.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-11-18 06:47:06 -08:00
Daniel J Walsh
e23723d62e
Merge pull request #1161 from cevich/nuke_old_rpm_stuffs
Remove disused contrib/rpm
2017-11-17 15:07:00 -05:00
Mrunal Patel
d68da8929a
Merge pull request #1149 from weiwei04/share_pid_namespace
share pid namespace for Pod container
2017-11-17 08:12:49 -10:00
Chris Evich
bbd9a6528c Remove disused contrib/rpm
I don't believe the files in this dir are actually used anymore.  Remove
them so content can be added to this directory in the future w/o
clashing.

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-11-17 11:49:18 -05:00
Wei Wei
702ab3ee3a share pid namespace for Pod container
Signed-off-by: Wei Wei <weiwei.inf@gmail.com>
2017-11-17 09:56:33 +08:00
Mrunal Patel
7b837b5a1e
Merge pull request #1156 from weiwei04/replace_crioctl_with_crictl
replace crioctl with crictl in e2e
2017-11-15 09:38:21 -10:00
Daniel J Walsh
31111ba651
Merge pull request #1154 from runcom/move-crio-socket
Move crio default sock to /var/run/crio/crio.sock
2017-11-15 10:14:22 -05:00
Wei Wei
b0b6611bdf replace crioctl in e2e with crictl
Signed-off-by: Wei Wei <weiwei.inf@gmail.com>
2017-11-15 16:15:54 +08:00
Antonio Murdaca
429a687ced
Merge pull request #1153 from mrunalp/add_kube_version_var
test: Add a version var for kube branches
2017-11-14 23:06:01 +01:00
Mrunal Patel
3596aa0155 test: Add a version var for kube branches
This allows us to cache a k8s branch for cri-o 1.0 branch
while allowing overriding of k8s branch in master and other
newer cri-o branches.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-11-14 09:58:53 -08:00
Mrunal Patel
8fe6dd36a4
Move crio default sock to /var/run/crio/crio.sock
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-14 16:11:43 +01:00
Daniel J Walsh
e7471600f8
Merge pull request #585 from runcom/comp-matrix
README.md: add compatibility matrix
2017-11-14 10:02:40 -05:00
Antonio Murdaca
21252ed22d
Merge pull request #1151 from mdshuai/fix-test-typo
fix syntax for test/README.md
2017-11-14 10:36:47 +01:00
Antonio Murdaca
692af73b0b
README.md: add compatibility matrix
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-14 09:39:30 +01:00
DeShuai Ma
e90e0c7062 fix typo for test/README.md
Signed-off-by: DeShuai Ma <dma@redhat.com>
2017-11-14 15:29:27 +08:00
Mrunal Patel
a447b2985c
Merge pull request #1148 from agonzalezro/config-tests
Add tests for server/config.go
2017-11-13 18:58:50 -10:00
Mrunal Patel
6ed8fbeea2
Merge pull request #1150 from runcom/bump-kube-1.9-master
vendor: bump to Kube 1.9/master
2017-11-13 10:54:45 -10:00
Antonio Murdaca
7a675ccd92
vendor: bump to Kube 1.9/master
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-13 19:57:20 +01:00
Mrunal Patel
7076c73172
Merge pull request #1152 from runcom/deprecate-crioctl
hack: validate tests for crioctl deprecation
2017-11-13 07:41:57 -10:00
Antonio Murdaca
8ae0aee7e5
hack: validate tests for crioctl deprecation
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-13 16:55:45 +01:00
Álex González
c3f86cd016
Add tests for server/config.go
The tests are trying to read an write configuration files and check that the
fields are being set or saved properly.

A folder fixtures/ was created on server/ as well adding an example crio.conf
file to it.

Note: some extra paths about Vagrant and VSCode were added to gitignore.
Signed-off-by: Álex González <agonzalezro@gmail.com>
2017-11-13 13:43:47 +01:00
Mrunal Patel
25ac83196f
Merge pull request #1146 from runcom/setspp
container_create: set the seccomp profile in the container object
2017-11-12 09:36:35 -10:00
Antonio Murdaca
586eda8245
container_create: set the seccomp profile in the container object
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-12 17:51:32 +01:00
Daniel J Walsh
edf2300205
Merge pull request #1142 from runcom/fixies-bump
Bump v1.8.0
2017-11-12 06:24:35 -05:00
Antonio Murdaca
4d1e77ff9d
version: bump v1.9.0-dev
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-12 01:54:20 +01:00
Antonio Murdaca
80f54bc14d
version: bump v1.8.0
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-12 01:54:20 +01:00
Antonio Murdaca
99e8676967
container_list: guard against list filter being nil
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-12 01:54:20 +01:00
Antonio Murdaca
e99a78edff
*: add crictl.yaml
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-12 01:54:19 +01:00
Antonio Murdaca
33f699bad4
server: validate labels size to avoid dos
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-12 01:54:19 +01:00
Antonio Murdaca
befd719812
Revert "Merge pull request #654 from nalind/storage-update"
This reverts commit 4c06116c18, reversing
changes made to c5e73ba65f.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-12 01:54:19 +01:00
Antonio Murdaca
98f7591d5f
Merge pull request #1132 from sak0/dev
allow update running/created container.
2017-11-12 01:51:04 +01:00
CuiHaozhi
a7f919f071 allow update running/created container.
Signed-off-by: CuiHaozhi <cuihaozhi@chinacloud.com.cn>
2017-11-11 11:04:07 -05:00
Mrunal Patel
56eb473aaa
Merge pull request #1139 from runcom/close-img
pkg: storage: image: close image after using it
2017-11-10 05:15:52 -10:00
Daniel J Walsh
e9200aacba
Merge pull request #1110 from edsantiago/more_testing_fixes
Various test-scaffolding fixes
2017-11-10 08:22:06 -05:00
Antonio Murdaca
4f4e228274
pkg: storage: image: close image after using it
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-10 14:21:22 +01:00
Daniel J Walsh
4fb52c2b12
Merge pull request #1133 from runcom/prom-runtime-metrics
server: add prometheus metrics for CRI operations
2017-11-10 07:30:59 -05:00
Daniel J Walsh
71d2131c8c
Merge pull request #1138 from runcom/fix-image-policy
image_pull: repull when image ID (config digest) changed
2017-11-10 05:28:07 -05:00
Antonio Murdaca
8611c2dfef
image_pull: repull when image ID (config digest) changed
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-09 19:46:55 +01:00
Antonio Murdaca
190650ecca
Merge pull request #1131 from nalind/update-tar-split
Bump github.com/vbatts/tar-split
2017-11-09 18:43:36 +01:00
Antonio Murdaca
b959f8996d
server: add prometheus metrics for CRI operations
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-09 16:51:00 +01:00
Nalin Dahyabhai
7d9a89e3a7 Bump github.com/vbatts/tar-split
Update vendor/github.com/vbatts/tar-split to v0.10.2, to fix
CVE-2017-14992, per https://github.com/vbatts/tar-split/pull/42.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-11-09 09:16:34 -05:00
Antonio Murdaca
9d3c442b7b
Merge pull request #1130 from cevich/fix_clone_k8s_two
Fix Local modifications exist in repository
2017-11-09 14:50:18 +01:00
Chris Evich
d49fb788da Fix Local modifications exist in repository
Depending on the state of upstream repositories, it's possible the
kubernetes repo could change between the ``setup`` and ``run`` phase.
Alternatively, something during ``setup`` itself could mangle the repo.

Add an option to force clone the kubernetes repo.  This gives support
for testing on multiple CRI-O branches, realizing some benefit from
caching, yet also allows hauling in brand-new-kubernetes for the e2e
tests.

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-11-08 12:34:45 -05:00
Antonio Murdaca
f4883dd27a
Makefile: do not install man1 files
kpod removal actually removed all man1 docs but the Makefile was still
referencing man1 stuff. CRI-O doesn't have man1 so let's drop that
altogether now.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-08 16:11:55 +01:00
Daniel J Walsh
c9b3d3df28
Merge pull request #1111 from mheon/remove_kpod
Remove kpod code after repository move
2017-11-07 14:44:40 -05:00
Ed Santiago
b7697672f0 Various test-scaffolding fixes
* Skip some tests if the bridge-custom plugin is
  unavailable. This CNI plugin is not distributed in
  any RPM, it is only available by compiling from a
  side branch in runcom's private github. We can't
  use it in a real integration-test setting.

* Don't use `run()` inside cleanup handlers. It will
  override $status, which is a double whammy:
   - successful cleanup will mask a test failure
   - when a test is `skip()`ed, crictl may fail,
     and $status will indicate failure.

* seccomp test: use existing $SECCOMP_PROFILE instead of
  assuming a path under $CRIO_ROOT

Signed-off-by: Ed Santiago <santiago@redhat.com>
2017-11-06 07:14:33 -07:00
Daniel J Walsh
6b6d634cfc
Merge pull request #1115 from mountkin/fix-makefile
fix "docker run" command in Makefile
2017-11-06 05:08:25 -05:00
Mrunal Patel
3f9e539bde
Merge pull request #1117 from runcom/setup-cwd
container_create: setup cwd for containers
2017-11-04 05:21:26 -07:00
Shijiang Wei
d5ffe34758 fix "docker run" command in Makefile
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2017-11-04 16:51:47 +08:00
Matthew Heon
c37d369259 Add readme pointer to new kpod repository
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-11-03 14:37:42 -04:00
Matthew Heon
1bf6d20309 Remove kpod code after repository move
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-11-03 14:37:42 -04:00
Antonio Murdaca
140f85df72
container_create: setup cwd for containers
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-03 19:23:44 +01:00
Antonio Murdaca
19d90e7c23
Merge pull request #1114 from mrunalp/env_fix_1.8
Add HOSTNAME env var to container
2017-11-03 16:49:46 +01:00
Mrunal Patel
70201fdf96 travis: Take out make lint for go tip
It is failing and our source can't be compatible with stable and tip
at the same time.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-11-02 20:25:34 -07:00
Mrunal Patel
c44c712a42 test: Add a test for HOSTNAME env
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-11-02 20:25:07 -07:00
Mrunal Patel
fa1ad4f54e Add HOSTNAME env var to container
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-11-02 10:24:56 -07:00
Mrunal Patel
6a43d07bae
Merge pull request #947 from runcom/release-1.8
bump to 1.8
2017-11-02 09:53:56 -07:00
Antonio Murdaca
4dce8e12a0
build k8s and cri-tools in place
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-02 16:12:47 +01:00
Mrunal Patel
4e2c6911ad
container: Don't add rprivate to all mounts
This fixes the mount propagation tests

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-11-02 16:07:52 +01:00
Mrunal Patel
815bb7652b
sandbox: Use first class sysctls instead of annotations
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-02 16:07:52 +01:00
Antonio Murdaca
c25530ac0b
server: implement update container resources
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-02 16:07:52 +01:00
Antonio Murdaca
7d7024999b
sandbox, ctrs: fixup seccomp for 1.8
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-02 16:07:52 +01:00
Antonio Murdaca
c70198617f
container_create: set mount propagation
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-02 16:07:51 +01:00
Antonio Murdaca
e41ba62b19
container_create: honor no_new_privs
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-02 16:07:51 +01:00
Antonio Murdaca
91d9b4fc29
cmd: crio: correctly stop the streaming server
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-02 16:07:51 +01:00
Antonio Murdaca
d6e819133d
*: initial update to kube 1.8
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-02 16:07:51 +01:00
Daniel J Walsh
2453222695
Merge pull request #1108 from runcom/md2man-ubunut
README.md: add go-md2man to build dep in Ubuntu
2017-11-02 10:20:10 -04:00
Antonio Murdaca
ed9f4c094a
README.md: add go-md2man to build dep in Ubuntu
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-02 12:27:34 +01:00
Mrunal Patel
87192d0c8c
Merge pull request #1106 from runcom/add-dot-github
*: add .github
2017-11-01 14:23:16 -07:00
Antonio Murdaca
0478365d95
*: add .github
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-01 20:18:00 +01:00
Daniel J Walsh
fe69289566
Merge pull request #1080 from baude/kpod_create.pr
Kpod create.pr
2017-11-01 13:44:28 -04:00
Mrunal Patel
62b157c324
Merge pull request #1103 from spiffxp/assignees-to-approvers
Rename OWNERS assignees: to approvers:
2017-11-01 10:13:32 -07:00
baude
b85fe5ab90 Fix conmon and runc paths for kpod tests
Tests for kpod create and run were failing because the conmon
binary was being hardcoded.  We added a  --conmon global optioni
for kpod so we could pass in the conmon path from the helpers
file during tests

Signed-off-by: baude <bbaude@redhat.com>
2017-11-01 10:53:52 -05:00
Aaron Crickenberger
46742e1216 Rename OWNERS assignees: to approvers:
They are effectively the same, assignees is deprecated

Signed-off-by: Aaron Crickenberger <spiffxp@gmail.com>
2017-11-01 08:48:44 -07:00
Mrunal Patel
c23e8fc78f
Merge pull request #1101 from mrunalp/network_settings
test: Add networking settings for critest
2017-11-01 07:51:40 -07:00
Daniel J Walsh
37fff3cff3
Merge pull request #1104 from rhatdan/master
Remove VERSION file
2017-11-01 09:18:30 -04:00
Daniel J Walsh
699fc11edf Remove VERSION file
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-11-01 08:06:40 -04:00
Daniel J Walsh
dce6f3c2ef
Merge pull request #1100 from rhatdan/args
Report error when arguments given to crio command
2017-11-01 08:03:18 -04:00
Daniel J Walsh
063b25cef5 Report error when arguments given to crio command
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-31 16:15:54 -04:00
Mrunal Patel
87e7280f5a test: Add networking settings for critest
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-31 13:14:50 -07:00
baude
c6cc205b78 Reviewer comments and suggestions incorporated.
Signed-off-by: baude <bbaude@redhat.com>
2017-10-31 14:10:47 -05:00
Mrunal Patel
4c06116c18
Merge pull request #654 from nalind/storage-update
Do not merge: Bump containers/storage and containers/image
2017-10-31 10:31:26 -07:00
baude
7f7ccc375f kpod create and run
Add the ability to run create a container with kpod.  Also, be able to run
(create and start) a container.  If the user asks for -it, be able to
attach a terminal to the container.

Signed-off-by: baude <bbaude@redhat.com>
2017-10-31 09:55:35 -05:00
baude
484a26d540 cmd/kpod/parse.go: Provided by Urvashi Mohnani
Signed-off-by: baude <bbaude@redhat.com>
2017-10-31 09:55:35 -05:00
Daniel J Walsh
409a228a73 Add kpod run and kpod create CLI front ends
Add kpod-run/kpod-create man page and command completions

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

This patch implements the ability to create and run containers
using kpod

Signed-off-by: Matthew Heon <mheon@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-31 09:55:35 -05:00
Nalin Dahyabhai
2e5e92730a Switch to ImageServer.UntagImage in RemoveImage handler
Add an UntagImage() method to pkg/storage/ImageServer, which will check
if the passed-in NameOrID is a name.  If so, it merely removes that name
from the image, removing the image only if it was the last name that the
image had.  If the NameOrID is an image ID, the image is removed, as
RemoveImage() does.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-31 10:30:18 -04:00
Nalin Dahyabhai
3f2bc09231 Return image references in ImageStatus()
The image's canonical reference is a name with a digest of the image's
manifest, so compute and return that value as the image's reference in
ImageStatus() and in ContainerStatus().

We don't auto-store a name based on the image digest when we pull one by
tag, but then CRI doesn't need us to do that.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-31 10:29:06 -04:00
Nalin Dahyabhai
beef44840e Update kpod push test
Since we've got stable image IDs now, pushing an image from local
storage to local storage ends up attaching the both names to a single
image, so we need to update the test's expectations.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-31 10:29:05 -04:00
Nalin Dahyabhai
9dab0eee24 Remove dead code
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-31 10:29:05 -04:00
Nalin Dahyabhai
88deb3934f Update PushImage() for newer containers/image
The updated containers/image and containers/storage don't require as
many workarounds to be able to push images.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-31 10:29:05 -04:00
Nalin Dahyabhai
1346755565 Bump containers/image and containers/storage
Update to proposed changes in containers/image, and bump
containers/storage to 04ad0b827097209ca65e59b5fd768511f3b1ae91, which is
currently the tip of the master branch.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-31 10:29:05 -04:00
Daniel J Walsh
c5e73ba65f
Merge pull request #1085 from jasonbrooks/patch-1
add golang-github-cpuguy83-go-md2man dep
2017-10-31 10:27:19 -04:00
Daniel J Walsh
051cafbd62
Merge pull request #1095 from TomSweeneyRedHat/dev/tsweeney/docfix/12
Change runc location of runc in tutorial.md
2017-10-31 10:26:37 -04:00
Daniel J Walsh
dbaf500c0b
Merge pull request #1094 from runcom/makefile-fixes
Makefile: output binaries under bin/
2017-10-31 09:07:40 -04:00
Antonio Murdaca
63b1706de8
Makefile: output binaries under bin/
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-30 17:48:29 +01:00
Daniel J Walsh
f6555bd868
Merge pull request #1087 from runcom/sort-mounts
container_create: sort mounts before adding them to the spec
2017-10-30 12:40:00 -04:00
Jason Brooks
fad19c8082 add golang-github-cpuguy83-go-md2man dep
Signed-off-by: Jason Brooks <jbrooks@redhat.com>

On CentOS, I needed this for `make` build step to complete
2017-10-30 08:33:41 -07:00
TomSweeneyRedHat
cbb380c974 Change runc location of runc in tutorial.md
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-10-30 09:50:49 -04:00
Daniel J Walsh
e22a3c9aea
Merge pull request #1090 from runcom/cmux-http-read-timeout
cmd: crio: set ReadTimeout on the info endpoint
2017-10-30 09:08:36 -04:00
Antonio Murdaca
158d53e62a
cmd: crio: set ReadTimeout on the info endpoint
This will avoid the goroutines leak we've been seeing during
performance tests. Goroutines count returns to normal after containers
cleanup.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-29 21:56:55 +01:00
Antonio Murdaca
15afc4d3de
container_create: sort mounts before adding them to the spec
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-29 12:31:18 +01:00
Antonio Murdaca
3ae3c41256
Merge pull request #1086 from mrunalp/lint_fix
lint fixes
2017-10-29 06:13:21 +01:00
Mrunal Patel
03f9350a15 lint fixes
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-28 13:17:00 -07:00
Daniel J Walsh
c269bf7b99
Merge pull request #1081 from mheon/libpod_labels
Update libpod to support labels
2017-10-27 12:34:14 -07:00
Mrunal Patel
c54658cb7b
Merge pull request #1083 from lsm5/unitfile-fixes
expand limits for tests
2017-10-27 10:25:12 -07:00
Lokesh Mandvekar
74f744dc34
systemd: expand limits for tests
Borrowed from:
https://github.com/projectatomic/atomic-system-containers/pull/136

From: Antonio Murdaca <runcom@redhat.com>
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2017-10-27 10:50:02 -04:00
Matthew Heon
90b44cbf34 Shut down libpod runtime's store if error occurs in NewRuntime
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-27 09:50:09 -04:00
Daniel J Walsh
596a97119b Merge pull request #1043 from mheon/kpod_container_skeleton
Libpod container creation logic
2017-10-26 16:26:06 -07:00
Mrunal Patel
1442bb7ed7 Merge pull request #1076 from runcom/close-ch
server: correctly return and close ch from exits routine
2017-10-26 11:00:42 -07:00
Matthew Heon
97ad00b708 Add labels and stop signal to libpod's container code
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-26 11:13:42 -04:00
Antonio Murdaca
584a256388
server: correctly return and close ch from exits routine
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-26 16:55:18 +02:00
Mrunal Patel
b416ee13a0 Merge pull request #1074 from umohnani8/pull_flags
Add --tls-verify, --cert-dir, and --quiet flags to kpod pull
2017-10-25 18:52:50 -07:00
umohnani8
f9992d71a3 Add --tls-verify, --cert-dir, and --quiet flags to kpod pull
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-10-25 16:28:18 -04:00
Matthew Heon
1ef3e96974 Fix gofmt and golint issues
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-25 13:08:49 -04:00
Matthew Heon
3b60d38769 Address review comments
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-25 12:04:52 -04:00
Matthew Heon
9b563f7970 Update libpod logic for placing containers in pods
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-25 11:51:45 -04:00
Matthew Heon
88e2acdc4f Add create/start times. Add helpers for locating common files.
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-25 10:45:32 -04:00
Matthew Heon
3262565d61 Add support for setting conmon sockets directory in libpod
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-25 10:45:32 -04:00
Matthew Heon
872c59da8f Refactor container code in preparation for saving state
Also adds terminal handling code to libpod

Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-25 10:45:32 -04:00
Matthew Heon
241653e152 Add container creation logic to Libpod
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-25 10:45:32 -04:00
Daniel J Walsh
8d78e3cfac Merge pull request #1072 from rhatdan/master
Copy CONTRIBUTING.md from skopeo
2017-10-25 07:30:07 -07:00
Daniel J Walsh
e92aec8b97 Merge pull request #1073 from rhatdan/readme
Add ascii cinema to README for login/logout/diff
2017-10-25 07:29:38 -07:00
Daniel J Walsh
fb804f5602 Merge pull request #1015 from umohnani8/authflag
Add authfile flag to pull and push
2017-10-25 06:16:58 -07:00
Daniel J Walsh
17ad51011e Add ascii cinema to README for login/logout/diff
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-25 13:10:56 +00:00
Daniel J Walsh
14f111bd8d Copy CONTRIBUTING.md from skopeo
We need to tell people about contributing to the CRI-O project

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-25 13:07:25 +00:00
Daniel J Walsh
a3cd7c422c Merge pull request #1052 from mheon/conmon_socket_as_arg
Make attach sockets directory an argument in Conmon
2017-10-24 21:48:33 -07:00
Daniel J Walsh
c9f837aca1 Merge pull request #1056 from literalice/patch-runcpath
fixes runc install path on Dockerfile
2017-10-24 21:47:24 -07:00
Daniel J Walsh
2e26e9b2ec Merge pull request #1050 from rhatdan/selinux
We need to release the SELinux label when we destroy the sandbox
2017-10-24 21:44:30 -07:00
Daniel J Walsh
2f43183c35 Merge pull request #1068 from nalind/default-store
libpod: set the default Store to match a Runtime
2017-10-24 21:40:56 -07:00
Mrunal Patel
e6d2d60e4d Merge pull request #1065 from nalind/mapsize
Fix a copy/paste error in libpod initializers
2017-10-24 21:02:36 -07:00
Mrunal Patel
cd04b45540 Merge pull request #1067 from nalind/secrets-test
Fixups for crio_secrets.bats
2017-10-24 21:01:56 -07:00
Mrunal Patel
5a4ffef9d3 Merge pull request #1066 from nalind/storage-opts
tests: rename $STORAGE_OPTS to $STORAGE_OPTIONS
2017-10-24 21:01:33 -07:00
Daniel J Walsh
c2c148f18d We need to release the SELinux label when we destroy the sandbox
This will release the MCS Label to be used again.  Only do this if we
don't have another sandbox using the same label.

Also vendor in the latest selinux go bindings, which fixes a leak and
properly reserves the SELinux label we are going to use.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-25 02:35:20 +00:00
Nalin Dahyabhai
9d0d48b2ce Rename $STORAGE_OPTS to $STORAGE_OPTIONS
Rename our $STORAGE_OPTS variable to $STORAGE_OPTIONS, so that the
storage library doesn't try to use its contents as default driver
options.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-24 21:52:16 -04:00
Nalin Dahyabhai
a467615423 Fixups for crio_secrets.bats
Remove the directory named by "$MOUNT_PATH", not "MOUNT_PATH".
Run "cat /proc/mounts" instead of "mount" in the test container.
Run "grep" using the "run" helper when we want to capture its output.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-24 21:49:55 -04:00
Nalin Dahyabhai
499b2fa180 Fix a copy/paste error in libpod initializers
When copying the GID map at startup, size the map correctly.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-24 21:48:47 -04:00
Nalin Dahyabhai
a5fb2b4b11 libpod: set the default Store to match a Runtime
When initializing a Runtime, set the default Store for the
containers-storage transport in the image library to the same one that
we're using, so that the calling process sees the same set of images
in the Runtime that it sees when going through the image library.

Update the kpod_push test so that it no longer has to specify a location
in the destination image reference, since the default should already be
passed to kpod as global options.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-24 21:47:10 -04:00
Mrunal Patel
863e137bde Merge pull request #1039 from runcom/fix-process-exec
oci: respect process spec on exec
2017-10-24 17:23:58 -07:00
Matthew Heon
e66da6046d Rename conmon argument to socket-dir-path
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-24 18:28:53 -04:00
Masatoshi Hayashi
9191a994fc fixes runc install path on Dockerfile
In the config file (/etc/crio/crio.conf) installed by `make install.config` , runc runtime path is specified "/usr/bin/runc"

Signed-off-by: Masatoshi Hayashi <literalice@monochromeroad.com>
2017-10-25 07:23:13 +09:00
Nalin Dahyabhai
4af9ae4bc2 kpod_kill.bats: drop redundant variables
Drop duplicate definitions of variables that are already defined in
helpers.bash.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-24 18:17:15 -04:00
Antonio Murdaca
c316e5d8cf
oci: respect process spec on exec
This patch fixes exec to use the original (start-time) process exec
configuration. Otherwise, we were creating a brand new spec process w/o
additional groups for instance.
Spotted while integrating CRI-O with cri-test...The test was failing
with:
```
• Failure [10.640 seconds]
[k8s.io] Security Context
/home/amurdaca/go/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:72
  bucket
  /home/amurdaca/go/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/security_context.go:407
    runtime should support SupplementalGroups [It]
    /home/amurdaca/go/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/security_context.go:272

    Expected
        <[]string | len:1, cap:1>: ["0"]
    to contain element matching
        <string>: 1234
```

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-24 22:39:17 +02:00
umohnani8
d855e2c8ad Add authfile flag to pull and push
Push and pull can now access any cached registry credentials from the auth file

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-10-24 16:32:09 -04:00
Antonio Murdaca
0914a7a667 Merge pull request #1053 from mrunalp/update_godbus_dep
vendor: Update godbus dependency to a389bd
2017-10-24 21:59:33 +02:00
Matthew Heon
042f31fe68 Add default CRI-O socket path back to conmon
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-24 15:42:23 -04:00
Matthew Heon
ae5fc471ea Make attach sockets directory an argument in Conmon
This is required to enable ongoing work in libpod

Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-24 15:42:23 -04:00
Antonio Murdaca
e95f75e8f2 Merge pull request #1058 from mrunalp/revert_swap
Revert "integration-playbook: Idempotent Swapping"
2017-10-24 21:10:33 +02:00
Antonio Murdaca
26ca82b23d Merge pull request #1054 from mrunalp/oom_test_loop
test: Test for OOM condition in a loop
2017-10-24 20:25:41 +02:00
Chris Evich
61c643330e Revert "integration-playbook: Idempotent Swapping"
This reverts commit b198c57cfb.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-24 09:36:56 -07:00
Mrunal Patel
56cda43444 test: Test for OOM condition in a loop
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-23 21:07:22 -07:00
Mrunal Patel
9ec09fa3ae vendor: Update godbus dependency to a389bdde4dd695d414e47b755e95e72b7826432c
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-23 12:34:05 -07:00
Antonio Murdaca
7ab9c55a12 Merge pull request #1042 from rhatdan/Makefile
Makefile
2017-10-21 12:21:53 +02:00
Mrunal Patel
d7d2ce7ce2 Merge pull request #1044 from runcom/fix-host-pid
fix host pid handling for containers and share uts ns
2017-10-19 14:11:41 -07:00
Daniel J Walsh
fd43871187 Merge pull request #1037 from mrunalp/revert_move_sock
Revert "Move crio default sock to /var/run/crio/crio.sock"
2017-10-19 15:41:16 -04:00
Daniel J Walsh
c46b875fe7 Merge pull request #1001 from cevich/fix_reswap
integration-playbook: Don't re-swap
2017-10-19 15:17:23 -04:00
Antonio Murdaca
da725f3e5f
fix host pid handling for containers and share uts ns
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-19 21:13:28 +02:00
Daniel J Walsh
655b47fdc4 Strip out debuginfo and other content to make images smaller
This can be overriden by passing in the

make SHRINKFLAGS=

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-19 17:34:24 +00:00
Daniel J Walsh
6835afaa54 Change buildtags based on installed environment.
Determine if selinux is available before building cri-o with support.
Don't add ostree support to crio or any tools other then kpod.
cri-o does not use ostree.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-19 17:34:24 +00:00
Mrunal Patel
b0e9f0eba8 Revert "Move crio default sock to /var/run/crio/crio.sock"
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-19 10:13:49 -07:00
Mrunal Patel
3be3936d7d Merge pull request #1041 from runcom/fix-e2e
contrib: test: fix e2e cmdline
2017-10-19 10:05:20 -07:00
Antonio Murdaca
d91877dbb2
contrib: test: fix e2e cmdline
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-19 16:37:26 +02:00
Antonio Murdaca
12ce3ba3ed Merge pull request #1030 from mrunalp/move_crio_sock
Move crio default sock to /var/run/crio/crio.sock
2017-10-19 00:53:10 +02:00
Daniel J Walsh
c2b7f37bd3 Merge pull request #1017 from baude/cri_tests_sandbox
server/sandbox_list.go: No error on filtered list find by ID
2017-10-18 16:10:11 -04:00
Chris Evich
b198c57cfb integration-playbook: Idempotent Swapping
If the playbook is run multiple times or a host already has
swap configured, re-adding swap over the existing file
will cause untold problems.  Also, it will not persist across
reboots unless added to fstab.

Avoid this by checking if any swap is active. If not
create a unique swapfile and format it.  Then enable
it to persist across reboots.

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-10-18 13:42:07 -04:00
Daniel J Walsh
b3ceb2a450 Merge pull request #1031 from rhatdan/seccomp
Update to latest seccomp filters in moby
2017-10-18 11:46:30 -04:00
Daniel J Walsh
704ebacab8 Update to latest seccomp filters in moby
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-18 05:14:30 -04:00
Mrunal Patel
c04f585a53 Merge pull request #1021 from runcom/fix-crio-versioning
version: fix version handling and kube info
2017-10-17 22:04:55 -07:00
Mrunal Patel
542994ff2a Merge pull request #1025 from edsantiago/safer_conmon_chmod
Issue #1024: don't chmod a nonexistent file
2017-10-17 22:04:04 -07:00
Mrunal Patel
761e73c82e Move crio default sock to /var/run/crio/crio.sock
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-17 22:02:53 -07:00
Mrunal Patel
eafb7f7105 Merge pull request #1014 from runcom/oci-kill-all-fix
oci: fixes to properly handle container stop action
2017-10-17 21:59:32 -07:00
Mrunal Patel
f237cdb2a5 Merge pull request #1023 from edsantiago/restore_cni_plugin
restore lost cni-plugin option
2017-10-17 15:21:39 -07:00
Mrunal Patel
f2c4ed765b Merge pull request #1018 from nalind/majorminor
Update golang.org/x/sys
2017-10-17 14:38:01 -07:00
Mrunal Patel
43ae97e43c Merge pull request #1026 from umohnani8/secrets_patch
Fixed logic flaw in the secrets mounts
2017-10-17 14:35:38 -07:00
Daniel J Walsh
fa23808bd6 Merge pull request #1019 from williamsandrew/add-missing-sudo
docs: Add missing `sudo` command in tutorial
2017-10-17 15:08:48 -04:00
Andrew Williams
67db54ea54 docs: Add missing sudo command in tutorial
Signed-off-by: Andrew Williams <williams.andrew@gmail.com>
2017-10-17 12:49:31 -05:00
umohnani8
a11b1f953d Fixed logic flaw in the secrets mounts
Tested on a REHL box and found out that the mounts were not showing up
Had a logic flaw, where if the mount was "host:container"
Was setting the mount source to "host" and destination to "ctrRunDir/container"
When instead, the mount source should be "ctrRunDir/container" and destination "container"
with the data copied from "host" to "ctrRunDir/container"

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-10-17 13:08:42 -04:00
Ed Santiago
e24cfb90c0 fixup! Restore conmon permissions in teardown()
Signed-off-by: Ed Santiago <santiago@redhat.com>
2017-10-17 11:00:26 -06:00
Ed Santiago
0852f5c188 Issue #1024: don't chmod a nonexistent file
New network test makes improper assumptions about conmon path.
Use predefined CONMON_BINARY variable instead.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2017-10-17 10:07:35 -06:00
Ed Santiago
c476706271 restore lost cni-plugin option
Commit d5b5028c undid part of my pr#953 (cni plugin path). Restore it.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2017-10-17 09:02:20 -06:00
Antonio Murdaca
e07ba4b2d1
version: fix version handling and kube info
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-17 10:44:50 +02:00
Antonio Murdaca
c6f5a290d8
oci: fixes to properly handle container stop action
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-17 00:21:17 +02:00
Nalin Dahyabhai
e19811238f Update golang.org/x/sys
Update our vendored copy of golang.org/x/sys to version
9aade4d3a3b7e6d876cd3823ad20ec45fc035402 to get the new Major() and
Minor() helpers.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-16 17:50:30 -04:00
baude
179a3f9c0e server/sandbox_list.go: No error on filtered list find by ID
We should not error when we try to find a pod ID in a filtered
list of sandboxes; instead we should return an empty struct
and log it.

This fixes another cri-test failure.

Signed-off-by: baude <bbaude@redhat.com>
2017-10-16 16:36:15 -05:00
Daniel J Walsh
04951dcc6e Merge pull request #1016 from runcom/runc-version
CI: use a fixed runc version, not master
2017-10-16 13:18:11 -04:00
Antonio Murdaca
ab68c553d8
CI: use a fixed runc version, not master
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-16 14:50:13 +02:00
Daniel J Walsh
24f131584b Merge pull request #1013 from rhatdan/vendor
Vendor in latest containers/storage
2017-10-16 06:12:34 -04:00
Daniel J Walsh
70b1661e10 Vendor in latest containers/storage
Container/storage has been enhanced to speed up the compiling and loading
of json files.  This should make make cri-o a little bit faster.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-14 09:41:25 +00:00
Daniel J Walsh
774d44589c Merge pull request #1008 from TomSweeneyRedHat/dev/tsweeney/kpod_load
Update kpod load to add signature-policy (2)
2017-10-14 05:34:13 -04:00
Daniel J Walsh
4de3964686 Merge pull request #999 from mheon/libpod_in_memory_state
Working state implementation for libpod
2017-10-13 19:15:41 -04:00
Daniel J Walsh
7b9a5c259e Merge pull request #992 from baude/cri_tests_sec
Initial fixes for cri-tests
2017-10-13 19:15:08 -04:00
TomSweeneyRedHat
54a043bfcd Update kpod load to add signature-policy (2)
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-10-13 16:28:15 -04:00
Mrunal Patel
cd1bac5ee0 Merge pull request #1012 from mrunalp/release_1.0.0
Release 1.0.0
2017-10-13 13:06:17 -07:00
Daniel J Walsh
9888bc3ed6 Merge pull request #1011 from rhatdan/cleanup
Fix references to CRI-O
2017-10-13 15:52:22 -04:00
Mrunal Patel
0908ad16d7 version: Switch 1.8.0-rc1-dev
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-13 11:27:13 -07:00
Mrunal Patel
a636972c3e version: Release 1.0.0
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-13 11:26:46 -07:00
Daniel J Walsh
4e126d7798 Fix references to CRI-O
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-13 13:48:00 -04:00
Mrunal Patel
5b62041194 Merge pull request #1010 from runcom/oci-kill-all
oci: kill all processes in a container not just the main one
2017-10-13 08:54:58 -07:00
Mrunal Patel
38c2a34b46 Merge pull request #1009 from sameo/topic/ctr-create-2s-fix
oci: Remove useless crio-conmon- cgroup deletion
2017-10-13 08:53:29 -07:00
baude
fc2cae39ef Initial fixes for cri-tests
We now can pass 37/55 tests with this PR.  Remaining tests include may be fixed
with 1.8.

[Fail] [k8s.io] Security Context bucket [It] runtime should support RunAsUserName
[Fail] [k8s.io] Security Context NamespaceOption [It] runtime should support HostPID
[Fail] [k8s.io] PodSandbox runtime should support sysctls [It] should support unsafe sysctls
[Fail] [k8s.io] PodSandbox runtime should support basic operations on PodSandbox [It] runtime should support removing PodSandbox [Conformance]
[Fail] [k8s.io] Streaming runtime should support streaming interfaces [It] runtime should support portforward [Conformance]
[Fail] [k8s.io] Security Context SeccompProfilePath [It] runtime should not support a custom seccomp profile without using localhost/ as a prefix
[Fail] [k8s.io] Image Manager [It] listImage should get exactly 2 repoTags in the result image [Conformance]
[Fail] [k8s.io] PodSandbox runtime should support sysctls [It] should support safe sysctls
[Fail] [k8s.io] Security Context NoNewPrivs [It] should not allow privilege escalation when true
[Fail] [k8s.io] Security Context SeccompProfilePath [It] runtime should support an seccomp profile that blocks setting hostname with SYS_ADMIN
[Fail] [k8s.io] Container runtime should support mount propagation [It] mount with 'rslave' should support propagation from host to container
[Fail] [k8s.io] Container runtime should support mount propagation [It] mount with 'rshared' should support propagation from host to container and vice versa
[Fail] [k8s.io] Networking runtime should support networking [It] runtime should support port mapping with host port and container port [Conformance]
[Fail] [k8s.io] Security Context SeccompProfilePath [It] should support seccomp localhost/profile on the container
[Fail] [k8s.io] Container runtime should support log [It] runtime should support starting container with log [Conformance]
[Fail] [k8s.io] Security Context bucket [It] runtime should support RunAsUser
[Fail] [k8s.io] Security Context bucket [It] runtime should support SupplementalGroups
[Fail] [k8s.io] Security Context SeccompProfilePath docker/default [It] should support seccomp docker/default on the container

Signed-off-by: baude <bbaude@redhat.com>
2017-10-13 08:36:14 -05:00
Antonio Murdaca
ab2a4839d7
oci: kill all processes in a container not just the main one
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-13 14:37:25 +02:00
Daniel J Walsh
c4f7506896 Merge pull request #1000 from nalind/bats-fixes
Fixes to use of bats in integration tests
2017-10-13 07:07:59 -04:00
Samuel Ortiz
29121c8c0c oci: Remove useless crio-conmon- cgroup deletion
It always fails because conmon is still there.
But more importantly it adds a 2 seconds delay to the container
creation as we're trying to delete a cgroup but we can't.

With this patch a container creation is down to typically less than
150ms instead of 2+ seconds.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-10-13 11:58:23 +02:00
Nalin Dahyabhai
ddb8fb30cc Correct our usage of the bats run helper
The bats "run" helper function sets "$status", so there's no point to
checking the value of "$status" when we haven't used the "run" helper to
run a command, and we almost always want to be checking the value after
we have used the helper.

There's no need to run commands like 'sleep' or 'rm -f' with the helper,
since they're not expected to fail, and if they do, it's probably
indicative of a larger problem that we want to allow to cause tests to
fail.

Helper functions like start_crio already check "$status" when they call
"run", so we don't need to check it again after they return.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-12 17:54:47 -04:00
Nalin Dahyabhai
a88f6840d8 Look up the container's name for kpod-stop-by-name
In the kpod-stop-by-name test, use 'kpod inspect' to look up the name of
the container, rather than predicting the name that crio will assign.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-12 17:54:47 -04:00
Mrunal Patel
436194290a Merge pull request #1004 from umohnani8/secrets_patch
Follow up changes on secrets patch
2017-10-12 14:40:46 -07:00
umohnani8
d1aea31786 Follow up changes on secrets patch
Deleted mounts.conf file and moved the secrets mount paths
to a list (default-mounts) in crio.conf

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-10-12 15:10:07 -04:00
Daniel J Walsh
5b41729b6c Merge pull request #942 from umohnani8/secrets_patch
Add secrets support to crio
2017-10-12 11:04:20 -04:00
Daniel J Walsh
a8224f8be1 Merge pull request #1002 from mrunalp/lint_fix
test: Modify Fatal to Fatalf as we have a specifier
2017-10-12 09:27:40 -04:00
umohnani8
d5b5028cb9 Add secrets patch to crio
Allows the user to define secret paths in /etc/containers/mounts.conf
These are then volume mounted into the container

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-10-11 20:00:38 -04:00
Mrunal Patel
bb4b2e9fea test: Modify Fatal to Fatalf as we have a specifier
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-10-11 14:51:11 -07:00
Daniel J Walsh
d7cbdfce76 Merge pull request #886 from baude/kpod_json
Return Valid JSON for empty data
2017-10-11 16:26:23 -04:00
baude
3907e0d346 Return Valid JSON for empty data
For commands that ask for JSON results, if the input to the Go JSON
marshaller is empty, it will return a byte array with a literal
"null" in it.  If that is the case, we should output [] instead
as at least that is valid JSON and will not break consumers of the
data.

Signed-off-by: baude <bbaude@redhat.com>
2017-10-11 13:28:18 -05:00
Daniel J Walsh
3363064622 Merge pull request #996 from mrunalp/fix_format
test: Fix format specifier
2017-10-11 13:03:16 -04:00
Matthew Heon
92def27645 Working in-memory state implementation
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-10-11 12:56:17 -04:00
Daniel J Walsh
915f918907 Merge pull request #998 from rhatdan/cleanup
Add information on kpod login/logout
2017-10-11 11:08:56 -04:00
Daniel J Walsh
436a803542 Add information on kpod login/logout
Add video for kpod-export

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-11 13:37:13 +00:00
Daniel J Walsh
3991a0531c Merge pull request #810 from umohnani8/kpod_login
Add "kpod login" command
2017-10-11 09:13:21 -04:00
Mrunal Patel
7c2c9a8c85 test: Fix format specifier
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-10-10 16:23:54 -07:00
Mrunal Patel
8c83014476 Merge pull request #994 from edsantiago/safe_netcat
nc (netcat): don't block when run interactively
2017-10-10 16:23:07 -07:00
Daniel J Walsh
132dae4094 Merge pull request #989 from umohnani8/flag_change
Changed debug flag to log-level in kpod/main.go
2017-10-10 17:05:29 -04:00
umohnani8
5d48e1aca5 Vendor in latest containers/image
Add support for kpod login/logout

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-10-10 17:02:57 -04:00
umohnani8
d664a58a6d Add 'kpod login' and 'kpod logout' commands
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-10-10 17:02:57 -04:00
umohnani8
b21a3e36ac Add docker/config package to containers/image/pkg
This package is used in authenticating a user for kpod login
and can be used for authentication in kpod push, pull etc.

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-10-10 16:58:40 -04:00
Daniel J Walsh
772f4b1515 Merge pull request #988 from umohnani8/libpod-part2
Continue switching from libkpod to libpod
2017-10-10 16:55:53 -04:00
Daniel J Walsh
680f3a09e1 Merge pull request #953 from edsantiago/parameterize_cni_plugin
Parameterize CRIO_CNI_PLUGIN
2017-10-10 16:55:03 -04:00
Ed Santiago
d54a139f6d nc (netcat): don't block when run interactively
When running the test suite interactively, "Connect to pod
hostport from the host" test hangs because nc thinks it's
got a bidirectional connection. Running with </dev/null
closes the connection after receiving the expected data,
letting the tests proceed.

This is just a suggestion for n00b-friendliness. Running
interactively is rare, but it's exactly where a n00b
will begin, and the hang costs a little time and energy
to track down.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2017-10-10 13:03:08 -06:00
umohnani8
b4d3b560d3 Changed debug flag to log-level in kpod/main.go
The change in flag from debug to log-level was causing cri-o to fail when started
There was a reference to the debug flag in kpod/main.go that had not been changed

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-10-10 14:55:14 -04:00
umohnani8
356df5d18e Continue switching from libkpod to libpod
Refactored rmi, images, diff, and history.
Made fixes to kpod images in the way it was handing the templates as well as printing the image names

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-10-10 11:22:09 -04:00
Mrunal Patel
bbd7321a7a Merge pull request #991 from runcom/kube-1.7.8
bump to kube v1.7.8
2017-10-10 07:41:40 -07:00
Daniel J Walsh
cfd7aec1c3 Merge pull request #960 from ashcrow/rebase-895
kpod rmi by ID untagged: %name incorrect
2017-10-10 07:56:43 -04:00
Antonio Murdaca
b6be0f0bd7
bump to kube v1.7.8
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-10-10 10:58:44 +02:00
Daniel J Walsh
19df68605b Merge pull request #990 from TomSweeneyRedHat/dev/tsweeney/fixread
Add video for pause/unpause to README.md
2017-10-09 16:31:56 -04:00
Daniel J Walsh
7efeada9df Merge pull request #983 from rhatdan/docs
Add documentation on kpod attach
2017-10-09 16:14:19 -04:00
TomSweeneyRedHat
0f31a61113 Add video for pause/unpause to README.md
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-10-09 14:57:37 -04:00
Daniel J Walsh
825f7f290b Merge pull request #949 from mrunalp/test_fix_kube_dns
test: Fix kube dns bring up in cluster
2017-10-07 05:59:01 -04:00
Daniel J Walsh
df5110dfd5 Add documentation on kpod attach
Add a man page on how to achieve the same user experience as using
kpod attach by using either the kpod logs or kpod exec commands.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-06 20:56:05 +00:00
Mrunal Patel
8c9fcfce0d Merge pull request #984 from mrunalp/readme_fixes
readme: Fix rc version and specify cgroup driver for k8s
2017-10-06 13:20:37 -07:00
Mrunal Patel
93af568246 readme: Fix rc version and specify cgroup driver for k8s
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-06 11:52:14 -07:00
Mrunal Patel
9c518dc03b test: Fix kube dns bring up in cluster
We have to call hack/local-up-cluster from kubernetes directory
as it makes relative calls to cluster/kubectl.sh. The failure
of these calls led to kube-dns not coming up.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-06 11:50:27 -07:00
Daniel J Walsh
19f37f5c14 Merge pull request #955 from sameo/topic/delete_container
Handle container creation failures gracefully
2017-10-06 11:54:10 -04:00
Daniel J Walsh
974bafe012 Merge pull request #950 from sameo/topic/loglevel
main: Define -log-level option
2017-10-06 09:51:07 -04:00
Daniel J Walsh
e5d2c0af5f Merge pull request #979 from mrunalp/log_size_min
Make sure log-size-max is atleast as big as read buffer
2017-10-06 09:23:48 -04:00
Mrunal Patel
f17f122ef3 Merge pull request #906 from dcbw/net-test
test: add test for network teardown on sandbox error
2017-10-05 21:18:09 -07:00
Mrunal Patel
309a744075 Merge pull request #976 from mrunalp/bump_go_1.8.4
test: Update go to 1.8.4
2017-10-05 18:06:48 -07:00
Mrunal Patel
067cbff207 Make sure log-size-max is atleast as big as read buffer
We need log-size-max to be bigger than the read buffer in conmon
to accurately truncate it.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-05 15:06:38 -07:00
Dan Williams
cc2b27132e test/network: clean up tests
Signed-off-by: Dan Williams <dcbw@redhat.com>
2017-10-05 16:41:54 -05:00
Dan Williams
8392f5f757 test: add test for network teardown on sandbox setup errors
Signed-off-by: Dan Williams <dcbw@redhat.com>
2017-10-05 16:41:54 -05:00
Samuel Ortiz
f9bad6cc32 oci: Use error logs for container creation failures
They are more critical than simple debug strings.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-10-05 22:53:20 +02:00
Samuel Ortiz
a5e5ccb365 main: Replace -debug with -log-level
Running crio with -debug is very verbose. Having more granularity
on the log level can be useful when e.g. only looking for errors.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-10-05 22:53:20 +02:00
Samuel Ortiz
d27451029b oci: Increase the container creation timeout
Under very heavy loads (e.g. 100 pods created at the same time), VM
based runtimes can take more than 10 seconds to create a pod.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-10-05 22:52:33 +02:00
Samuel Ortiz
eae1b7d6bd oci: Delete container resources upon creation failure
When cri-o assumes the container creation failed, we need to let the
runtime know that we're bailing out so that it cancels all ongoing
operation.
In container creation timeout situations for example, failing to
explictly request the runtime for container deletion can lead to large
resource leaks as kubelet re-creates a failing container, while the
runtime finishes creating the previous one(s).

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-10-05 22:52:33 +02:00
Daniel J Walsh
5b2652c3e3 Merge pull request #975 from rhatdan/cleanup
Cleanup READMEs and Man pages
2017-10-05 14:59:19 -04:00
Mrunal Patel
c3630f807e test: Update go to 1.8.4
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-05 11:30:15 -07:00
Daniel J Walsh
61441c1272 Merge pull request #974 from mrunalp/bump_rc3
Release 1.0.0-rc3
2017-10-05 13:47:01 -04:00
Daniel J Walsh
3e7227789b Cleanup READMEs and Man pages
Alphabatize correctly and add missing content.  Also add video.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-05 13:39:53 -04:00
Mrunal Patel
18039484ac version: Switch to 1.0.0-rc4-dev
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-05 09:37:41 -07:00
Mrunal Patel
d2c6f64125 version: Release 1.0.0-rc3
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-05 09:37:07 -07:00
Daniel J Walsh
06e8fb9fdf Merge pull request #966 from baude/exit_code
BUGFIX: Invalid return codes in kpod
2017-10-05 08:29:12 -04:00
Daniel J Walsh
30d163900f Merge pull request #895 from baude/kpod_rmi_name
kpod rmi by ID untagged: %name incorrect
2017-10-05 08:28:04 -04:00
Daniel J Walsh
4e4a7c5c1d Merge pull request #959 from rhatdan/validate
validateFlags command line options to make sure the user entered a value
2017-10-04 18:29:57 -04:00
Daniel J Walsh
6657873d9d Merge pull request #967 from TomSweeneyRedHat/dev/tsweeney/ps_fix
Add pause state to ps, touchup kpod man page
2017-10-04 18:27:26 -04:00
baude
e27230bbaf kpod rmi by ID untagged: %name incorrect
As described in https://github.com/kubernetes-incubator/cri-o/issues/888, when
deleting by ID, the name being returned for the untagged message was "".

Signed-off-by: baude <bbaude@redhat.com>
2017-10-04 15:16:10 -05:00
baude
ee2b84167c kpod rmi by ID untagged: %name incorrect
As described in https://github.com/kubernetes-incubator/cri-o/issues/888, when
deleting by ID, the name being returned for the untagged message was "".

Signed-off-by: baude <bbaude@redhat.com>
2017-10-04 15:49:51 -04:00
baude
3611f92ddf BUGFIX: Invalid return codes in kpod
Set the exitsdir for kpod back to /var/run/crio... so kpod can benefit
from the container exit file.

Because 0 is the int32 blank value, kpod needs its own container state
struct with the omitempty removed so it can actually display 0 in
its default json output.

Signed-off-by: baude <bbaude@redhat.com>
2017-10-04 09:34:28 -05:00
TomSweeneyRedHat
f92ed659ab Add pause state to ps, touchup kpod man page
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-10-04 07:42:21 -04:00
Daniel J Walsh
04e96d05fc validateFlags command line options to make sure the user entered a value
When a user enters a CLI with a StringFlags or StringSliceFlags and does not add
a value the CLI mistakently takes the next option and uses it as a value.

This usually ends up with an error like not enough options or others.  Some times
it could also succeed, with weird results.  This patch looks for any values that
begin with a "-" and return an error.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-04 09:36:29 +00:00
Mrunal Patel
3e2ad8f10a Merge pull request #969 from mrunalp/btrfs_build
Btrfs build
2017-10-03 18:01:14 -07:00
Mrunal Patel
a643e533d8 Skip building btrfs support if library isn't installed
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-10-03 13:18:36 -07:00
Daniel J Walsh
1a61584c2f Merge pull request #970 from nikhita/fix-design-proposal-link
tutorial: fix link after design proposal move
2017-10-03 06:08:34 -04:00
Nikhita Raghunath
37debee9a2 Fix link to design proposal 2017-10-03 11:53:58 +05:30
Mrunal Patel
a8ea146d71 Merge pull request #963 from stevekuznetsov/skuznets/assume-golang
Install Golang from source
2017-10-02 10:06:14 -07:00
Steve Kuznetsov
40132d786d
Install Go directly from upstream, not through RPM
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
2017-10-02 07:18:41 -07:00
Daniel J Walsh
e5749088b2 Merge pull request #962 from kinvolk/dongsu/fix-panic-run-podsandbox
server: fix 2 panics in RunPodSandbox
2017-10-02 09:18:06 -04:00
Daniel J Walsh
88fc20be1e Merge pull request #948 from rhatdan/quota
Add Overlay Quota support
2017-10-02 08:48:06 -04:00
Daniel J Walsh
f33b59861b Merge pull request #878 from umohnani8/refactor_tests
Refactor kpod tests
2017-10-02 08:45:25 -04:00
Nalin Dahyabhai
2491d38e03 Also refactor setting flags for running kpod
* Remove duplicate definitions of storage-related flags for kpod, since
  we set them in helpers.bash now, and the other locations that were
  also setting it were doing so after loading the definitions in
  helpers.
* Set kpod storage flags after checking if we need to force use of the
  "vfs" storage driver for cri-o, to make sure kpod also ends up with
  the same override if we're using one.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-09-29 16:37:07 -04:00
Daniel J Walsh
e16bb3feb3 Refactor kpod tests
Move kpod tests from kpod.bats to kpod_[commandname].bats
Also make sure all status checks have a echo $output before them.

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-09-29 16:37:07 -04:00
Daniel J Walsh
6866589be7 Drop btrfs support from RHEL and CentOS
Packages are no longer available to build on RHEL and CentOS and
btrfs is not longer supported, so we should not build with it.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-29 20:34:29 +00:00
Daniel J Walsh
1a41d6ecd4 Remove references to overlay2 in the code
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-29 20:34:29 +00:00
Daniel J Walsh
51fc13abf3 Add documentation on setting up quota
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-29 20:34:29 +00:00
Daniel J Walsh
29bd1c79dd Vendor in container storage
This should add quota support to cri-o

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-29 20:34:29 +00:00
Mrunal Patel
e838611fdd Merge pull request #954 from mrunalp/add_pquota
test: Add task to enable xfs pquota support
2017-09-29 10:38:34 -07:00
Mrunal Patel
e0ffa43c34 test: Add flags to enable xfs pquota support
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-29 10:31:46 -07:00
Dongsu Park
644a4af377 server: handle cases of securityContext, namespaceOptions being nil
Both GetSecurityContext() and GetNamespaceOptions() can return nil.
In these cases, cri-o will panic like this:

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x1 pc=0x1cc43f6]

goroutine 66 [running]:
.../cri-o/server.(*Server).RunPodSandbox(0xc42060e300, 0x7f611d37a0b8,
0xc420207e60, 0xc42015e318, 0x0, 0x0, 0x0)
        .../cri-o/server/sandbox_run.go:261 +0xfe6
.../cri-o/vendor/k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime._RuntimeService_RunPodSandbox_Handler(0x2180920,
0xc42060e300, 0x7f611d37a0b8, 0xc420207e60, 0xc420505950, 0x0, 0x0, 0x0,
0x64ed0d, 0xc42064bc80)
        .../cri-o/vendor/k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime/api.pb.go:3645 +0x279
.../cri-o/vendor/google.golang.org/grpc.(*Server).processUnaryRPC(0xc4200a4240,
0x33f28e0, 0xc4204b0360, 0xc42074a870, 0xc420476de0, 0x33bcd38, 0xc420207e30, 0x0, 0x0)
```

Signed-off-by: Dongsu Park <dongsu@kinvolk.io>
2017-09-29 17:00:16 +02:00
Dongsu Park
2080744963 server: fix panic when assigning entry to nil map
When running cri-tests with cri-o, I found out that cri-o panicked
immediately with the following message. Fix it by accessing to the
labels map only if it's non-nil.

```
panic: assignment to entry in nil map

goroutine 57 [running]:
.../cri-o/server.(*Server).RunPodSandbox(0xc42048e000, 0x7efcad4cd400,
0xc42066ec90, 0xc4201703d0, 0x0, 0x0, 0x0)
        .../cri-o/server/sandbox_run.go:225 +0xda5
.../cri-o/vendor/k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime
._RuntimeService_RunPodSandbox_Handler(0x21793e0, 0xc42048e000,
0x7efcad4cd400, 0xc42066ec90, 0xc4204fe780, 0x0, 0x0, 0x0, 0x0, 0x0)
        .../cri-o/vendor/k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime/api.pb.go:3645 +0x279
.../cri-o/vendor/google.golang.org/grpc.(*Server).processUnaryRPC(0xc420
09e3c0, 0x33e79c0, 0xc4203d1950, 0xc42080a000, 0xc4202bb980, 0x33b1d58,
0xc42066ec60, 0x0, 0x0)
        .../cri-o/vendor/google.golang.org/grpc/server.go:638 +0x99c
```

Signed-off-by: Dongsu Park <dongsu@kinvolk.io>
2017-09-29 16:19:21 +02:00
Mrunal Patel
7d5d652f65 Merge pull request #945 from cevich/just_collect_results
Write playbook to collect results from subjects
2017-09-28 18:39:18 -07:00
Daniel J Walsh
3394b3b2d6 Merge pull request #958 from umohnani8/man_pages
Made some changes to man pages
2017-09-28 14:59:54 -04:00
Chris Evich
9024bdbc28 integration: Fix chdir in wrapper script
Previously the wrapper changed to $WORKSPACE prior to executing
the ansible-playbook command.  This has the unintended consequence of
preventing use of relative paths.  Fix this by using absolute paths in
wrapper script instead of changing directories.

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-09-28 14:05:25 -04:00
Chris Evich
493a72bbc9 integration: Use vars_files in plays
It's unsightly and hard to maintain collections of references and long
lists across multiple playbooks/include files.  Centralize them all
in ``vars.yml``, then include that in all plays.

Minor: Update all files with a newline at the start and end.

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-09-28 14:05:25 -04:00
Chris Evich
a30a118fe6 integration: Collect subject results
Add a playbook to pull down the integration and e2e testing
logs/xml.  By default they will appear in a 'artifacts' subdirectory
of wherever the ``results.yml`` playbook lives. If the ``$WORKSPACE``
env. var is set and non-empty, the subdirectory will be created
there instead.

Inside the ``artifacts`` directory, further sub-directories are created,
one for each subject's Ansible inventory name.  Within those
sub-directories are all the collected logs from that host.  In this way,
automation may simply archive the entire 'artifacts' directory to
capture the important log files.

(Depends on PR #935)

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-09-28 14:05:25 -04:00
Chris Evich
76e25eea42 integration: jUnit output from e2e
Processing node-e2e.log into jUnit format is insane, it's chock-full of
terminal escape codes.  They would either need to be scraped/removed or
disabled somehow.  Instead, take advantage of ``e2e.go --report-dir=``
option.  This will cause it to store native jUnit results in the
specified directory for later collection.  The jUnit results are also
needed for the google test grid.

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-09-28 14:05:25 -04:00
Chris Evich
0e55fb2ea3 integration: Add color + readable logging
When run by hand, it's much easier to spot things going wrong when
they're colored in red.  Add an ansible.cfg to make that happen.  This
also sets a default output log file (``$ARTIFACTS/main.log``) - that
doesn't contain color-codes.

When executing against multple hosts, the output can sometimes become
difficult to read, esp. with lots of async. tasks.  The callback_plugin
script reorganizes how the console and log is organized, making it
clearer which host did what and when.

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-09-28 14:05:25 -04:00
Daniel J Walsh
7e3d0c652d Merge pull request #853 from mheon/libpod_state
Add skeletons for libpod container, pod, state
2017-09-28 13:11:08 -04:00
Daniel J Walsh
a40aa7ad54 Merge pull request #907 from baude/kpod_kill
Add support for kpod kill
2017-09-28 12:59:38 -04:00
umohnani8
5a1314547a Made some changes to man pages
kpod ps manpage had misleading info
Fixed the Global options and options in other man pages

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-09-28 11:45:01 -04:00
Matthew Heon
00e1ac7b25 Move runtime Pod and Container APIs to separate files
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-09-28 11:18:47 -04:00
Matthew Heon
ae5634f8dd Add errors listing to libpod
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-09-28 11:18:47 -04:00
Matthew Heon
f8e48aad29 Change names of GetContainers and GetPods
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-09-28 11:16:09 -04:00
Matthew Heon
35e951fc8c Add basic skeletons of state handling, containers and pods
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-09-28 11:16:09 -04:00
Matthew Heon
2850fb60a5 Add basic state interface for libpod
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-09-28 11:13:11 -04:00
Matthew Heon
ee24340f0c Make runtimes invalid on shutdown to prevent furhter use
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-09-28 11:13:11 -04:00
Matthew Heon
bb77300641 Move everything in libpod into a single package for simplicity
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-09-28 11:13:11 -04:00
Daniel J Walsh
251f16af80 Merge pull request #883 from umohnani8/libpod
Continue switching commands from libkpod to libpod
2017-09-28 11:09:01 -04:00
baude
7b062cf4c1 Add support for kpod kill
Kill one or more containers using a user-provided signal.  If not signal
is provided, KILL is used.

Signed-off-by: baude <bbaude@redhat.com>
2017-09-28 09:34:21 -05:00
Daniel J Walsh
e2c87f515b Merge pull request #925 from baude/kpod_wait
Add kpod wait
2017-09-28 05:08:53 -04:00
Daniel J Walsh
e70802863e Switch kpod load/push/save to use libpod runtime
Since this is the last use of libpod/images/copy.go,
removing that code

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-27 22:33:20 -04:00
Mrunal Patel
d669878914 Merge pull request #937 from rhatdan/umount
Tell oci-umount where to remove mountpoints inside container
2017-09-27 13:57:10 -07:00
Ed Santiago
b2d347d8cd Parameterize CRIO_CNI_PLUGIN
Allow overriding CRIO_CNI_PLUGIN (default: /opt/cni/bin) and
make sure it gets written to our crio.conf file. This is
intended for running cri-o tests with containernetworking-cni
rpm which installs into /usr/libexec/cni

Signed-off-by: Ed Santiago <santiago@redhat.com>
2017-09-27 14:19:20 -06:00
Mrunal Patel
0f01268557 Merge pull request #952 from stevekuznetsov/skuznets/e2e-fail
Don't ignore failures in the e2e suite
2017-09-27 09:26:49 -07:00
Steve Kuznetsov
5b763286ff
Don't ignore failures in the e2e suite
There are no tasks that we need to run after the suite has finished,
like we do with the integration suite, so it does not make sense to
ignore the errors coming out of the e2e suite.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
2017-09-27 08:11:27 -07:00
baude
3bf23b684a Add kpod wait
Waits on one or more containers to stop and prints the container's
return code

Signed-off-by: baude <bbaude@redhat.com>
2017-09-27 09:03:33 -05:00
Daniel J Walsh
214adee0ef Merge pull request #926 from TomSweeneyRedHat/pause
Add `kpod pause` and `kpod unpause`
2017-09-27 09:33:22 -04:00
Daniel J Walsh
154283764d Merge pull request #866 from vbatts/fine_grain_targets
Makefile: break out the `install` target
2017-09-27 09:20:26 -04:00
Mrunal Patel
41372dba70 Merge pull request #940 from vbatts/no-pivot
*: allow to not use pivot_root
2017-09-26 16:18:08 -07:00
Daniel J Walsh
8e6d5b1c9a Merge branch 'master' of github.com:kubernetes-incubator/cri-o into umount
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-26 21:41:02 +00:00
Daniel J Walsh
8949e669c9 Modify kpod tag to use libpod runtime interface
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-26 16:14:34 -04:00
53a9472b94
man-pages: add no_pivot information
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-09-26 11:35:09 -04:00
d6a44bf111
*: allow to not use pivot_root
runc has a `--no-pivot` flag, that uses MS_MOVE instead.

This patch set bubbles up a runtime config to enable using no-pivot
globally.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-09-26 11:35:00 -04:00
Antonio Murdaca
0ff3580f05 Merge pull request #891 from mrunalp/cfg_log_max
Max log size config
2017-09-26 17:04:57 +02:00
a22d04de4b
Makefile: break out the install target
Where `make install` still has the same behaviour, but you could instead
only `make install.bin` if you don't need the man pages.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-09-26 09:32:39 -04:00
Daniel J Walsh
9db7cf1370 Add kpod pause and kpod unpause
Implement the ability to pause and unpause running containers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-09-26 08:38:07 -04:00
Daniel J Walsh
45747cc5d0 Merge pull request #946 from sameo/topic/readme
README: Update status
2017-09-26 07:54:18 -04:00
Samuel Ortiz
266e620ea9 README: Update status
We're at rc2 now.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-09-26 12:24:14 +02:00
Mrunal Patel
37e282a29b docs: Add docs for log size max
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-25 16:08:09 -07:00
Mrunal Patel
d47061ac57 test: Add a test for log size max
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-25 15:37:55 -07:00
Mrunal Patel
4d0270d138 crio: Add flag for --log-size-max
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-25 15:37:10 -07:00
Mrunal Patel
c7d33e1899 conmon: Re-open the log file to not exceed max log file size
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-25 15:36:14 -07:00
Mrunal Patel
82899bdb4e conmon: Track the number of bytes written to the container log file
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-25 15:35:25 -07:00
Mrunal Patel
48d0706a49 Add log size max flag to conmon and pass it on container create
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-25 15:31:31 -07:00
Mrunal Patel
bb11ee522b oci: Add log size max to container
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-25 15:28:29 -07:00
Mrunal Patel
c7f5347673 Add log size max configuration
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-25 15:27:21 -07:00
Mrunal Patel
db0bd66fca Merge pull request #917 from runcom/fixes-rc3-0
Fix Origin test and update kube to v1.7.6
2017-09-25 14:55:42 -07:00
Antonio Murdaca
a8ee86b1cc Merge pull request #943 from mrunalp/info_client
client: Add crio client package
2017-09-25 23:04:04 +02:00
Daniel J Walsh
51b2254742 Tell oci-umount where to remove mountpoints inside container
This patch set add crio-umount.conf file which tells oci-umount plugin
to look for leaked mount points in /var/lib/containers/storage/* and
/var/run/containers/*

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-25 15:21:17 -04:00
Antonio Murdaca
3dd043c581
sandbox_network: pass sandbox to newPodNetwork
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-25 21:08:11 +02:00
Antonio Murdaca
6c871769b4
server: more fixes for selinux and privileged mode
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-25 21:08:11 +02:00
Antonio Murdaca
7b0bde4362
container_create: fix seccomp annotations
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-25 21:08:11 +02:00
Antonio Murdaca
59c0218a9c
container_create: follow symlink for mount host path
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-25 21:08:11 +02:00
Antonio Murdaca
5e7c932771
vendor: update kube to v1.7.6
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-25 21:08:11 +02:00
Antonio Murdaca
e8cfe3b867
container_create: support seccomp docker/default annotation
Fixes the following Origin/Kube test:

```
• Failure [10.323 seconds]
[k8s.io] Security Context [Feature:SecurityContext]
/go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/test/e2e/framework/framework.go:619
  should support seccomp alpha docker/default annotation
[Feature:Seccomp] [It]
  /go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/test/e2e/security_context.go:133

  Expected error:
      <*errors.errorString | 0xc420cbacf0>: {
          s: "expected \"2\" in container output: Expected\n
<string>: Seccomp:\t0\n    \nto contain substring\n    <string>: 2",
      }
      expected "2" in container output: Expected
          <string>: Seccomp:	0

      to contain substring
          <string>: 2
  not to have occurred
}
```

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-25 21:08:11 +02:00
Mrunal Patel
1beb75d839 test: Add steps for testing crio client
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-25 11:59:40 -07:00
Mrunal Patel
50baca10e9 Add crio annotations to container endpoint
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-25 11:59:40 -07:00
Mrunal Patel
2e3d5240c2 client: Add crio client package
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-25 11:59:40 -07:00
Mrunal Patel
4fadbea75d Merge pull request #927 from stevekuznetsov/skuznets/dont-pull-code-in-test
Refactor integration test playbooks
2017-09-25 11:58:11 -07:00
Steve Kuznetsov
e160796d4e
Refactor the CRI-O test playbook to be more modular
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
2017-09-25 10:02:04 -07:00
Mrunal Patel
89f18fa7b5 Merge pull request #928 from cevich/fix_missing_fedora_dep
integration-playbook: Add hidden dependencies
2017-09-22 10:19:05 -07:00
Chris Evich
bedf75dcfc integration-playbook: Require RHEL repos.
Both the base and extras repos are required.  Rather than try to fuss
around with subscription manager, require two variables be defined
pointing to the baseurl's to use.  Assert that these variables are set
and non-empty.

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-09-21 13:01:08 -04:00
Chris Evich
78c400ccd3 integration-playbook: Increase test timeout
Depending on circumstances out of our control, the 'integration tests'
may take longer than an hour (3600 seconds).  Since the maximum time
is referenced in several places, define a variable with a larger value
then reference it from the affected tasks.

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-09-21 13:01:08 -04:00
Chris Evich
e6b5fc7d53 integration-playbook: Add hidden dependencies
Previously, an internal playbook installed many extra
necessary/unnecessary packages before this playbook even started.  Since
this is a terrible design, move all dependencies here so that nothing is
unwritten.  This includes installing some deps. for ansible itself
(which must be done as a raw command).

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-09-21 13:01:08 -04:00
Chris Evich
29c4d890c8 Faster venv-ansible-playbook.sh
If running a playbook more than once, there's no need to re-bootstrap
the virtual environment.  Assume if the verified crio directory already
exists, it should be used (after re-asserting hashes of requirements).

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-09-21 12:59:33 -04:00
Daniel J Walsh
d153815f74 Merge pull request #936 from rhatdan/readme
Describe in readme `kpod cp` man page
2017-09-21 10:02:07 -04:00
Daniel J Walsh
fd6446ade5 Describe in readme kpod cp man page
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-21 12:20:26 +00:00
Antonio Murdaca
0fc411d4fe Merge pull request #905 from mrunalp/bump_rc2
version: Release 1.0.0-rc2
2017-09-20 15:20:31 +02:00
Daniel J Walsh
2282b5339f Merge pull request #922 from ashcrow/add-libkpod-config-unit-test
test: Add libkpod config tests
2017-09-19 15:14:41 -04:00
Steve Milner
65faae6782 test: Add libkpod config tests
- config_test.go for testing libkpod/config.go
- testdata/config.toml as a fixture for config_test.go

Signed-off-by: Steve Milner <smilner@redhat.com>
2017-09-19 09:32:57 -04:00
Daniel J Walsh
5e3c53c172 Merge pull request #909 from rhatdan/lastError
We should not be exiting with exit(1)
2017-09-18 07:46:53 -04:00
Mrunal Patel
7e7a097395 Merge pull request #913 from runcom/v1.0.0-rc2-patches
V1.0.0 rc2 patches
2017-09-17 21:03:54 -07:00
Antonio Murdaca
a11b8cd8ec
sandbox, ctr: SELinux fixes
server: fix selinux labels for pod and containers

Signed-off-by: Antonio Murdaca <runcom@redhat.com>

sandbox: set selinux labels from request, not defaults

Signed-off-by: Antonio Murdaca <runcom@redhat.com>

container_create: use sandbox's selinux if container's nil

Signed-off-by: Antonio Murdaca <runcom@redhat.com>

sandbox: correctly init selinux labels

First, we weren't correctly initializing selinux labels. If any of
(level, user, role, type) was missing from kube selinux options, we
were erroring out. This is wrong as kube sends just `level=s0`
sometimes and docker itself allows `--security-opt label=level:s0`.
This patch directly initializes selinux labels, correctly, and adds a
test to verify it.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>

test: testdata: use container_runtime_t selinux type

RHEL SELinux policy doesn't have `container_t` type but we're using it
in our fixtures. That means Fedora integration tests pass because
`container_t` is in Fedora's container policy but RHEL is broken.
Fix it by using `container_runtime_t` which is aliased in Fedora policy
to `container_t`.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-17 22:40:17 +02:00
Antonio Murdaca
ec42a40936
server: use grpc getters
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-17 10:19:32 +02:00
Antonio Murdaca
c1d158bba4
Makefile: always use vfs to test in container
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-17 10:19:32 +02:00
Antonio Murdaca
d93f86c26c
Dockerfile: remove not needed image copy
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-17 10:19:31 +02:00
Antonio Murdaca
9ec518491f
server: correctly set hostname
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-17 10:19:31 +02:00
Antonio Murdaca
0c1383fd30
test: add inspect integration tests
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-17 10:19:31 +02:00
Antonio Murdaca
e26e48ec87
server: add inspect unit test
The inspect endpoint is used mainly in the CRI-O cAdvisor handler.
Let's make sure we don't break it by adding some trivial unit tests.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-17 10:19:29 +02:00
Daniel J Walsh
33fc0231f7 Merge branch 'master' of github.com:kubernetes-incubator/cri-o into lastError
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-16 06:10:01 -04:00
Daniel J Walsh
dbc2b404a3 Merge pull request #841 from baude/kpod_pull_name
libkpod/image/copy.go: Add pull by short-name
2017-09-16 05:12:47 -04:00
Daniel J Walsh
d03ea10be2 Merge pull request #890 from mrunalp/bind_docs
docs: Add missing bind option in docs and command help
2017-09-16 05:11:17 -04:00
Daniel J Walsh
dacfddc42c Merge pull request #899 from umohnani8/vendor_containers/image
Vendor in latest containers/storage
2017-09-16 05:09:29 -04:00
Daniel J Walsh
8320d65581 Merge pull request #915 from umohnani8/kpod_ps
Modified namespace field in json struct
2017-09-16 05:02:32 -04:00
Mrunal Patel
f59e9dae1c docs: Add missing bind option in docs and command help
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-09-15 16:12:13 -07:00
Daniel J Walsh
a001b177d6 We should not be exiting with exit(1)
There is cleanup code that will never get run.
This code will print out all errors and then return the last error.
This should allow for proper cleanup.

Also cleanup help to switch usage and description.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-15 17:51:34 -04:00
umohnani8
036658b844 Modified namespace field in json struct
The namespace field was not being omitted when empty

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-09-15 17:30:25 -04:00
Daniel J Walsh
b82bf55404 Merge pull request #900 from TomSweeneyRedHat/dev/tsweeney/docfix5
Add a few build dependencies to README.md
2017-09-15 16:47:52 -04:00
Mrunal Patel
9f663c9b66 Merge pull request #912 from TomSweeneyRedHat/dev/tsweeney/clifix
Update urfave/cli to v1.20.0
2017-09-15 12:56:47 -07:00
TomSweeneyRedHat
a29bb63613 Add a few build dependencies to README.md
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-09-15 07:56:30 -04:00
TomSweeneyRedHat
359def92f1 Update urfave/cli to v1.20.0
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-09-14 23:39:15 -04:00
umohnani8
cfc2393d58 Vendor in latest containers/storage
Fixes store.lock issue comming up when using store.Names

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-09-14 09:54:39 -04:00
baude
951a943d16 libkpod/image/copy.go: Add pull by short-name
If the user provides kpod pull a short name like 'debian', we
still want the pull to be sucessful.  As such, when a short
name is provided, we get the list of searchable registries via
the systemregistries code in containers-storage.  We then
append a tag of 'latest' (if not provided) and we formulate
a list of possible fully-qualified image names to try.

Vendor update for containers-storage to bring in the system_registries
code.

Also includes a patch from Nalin to fix compilation errors.

Signed-off-by: baude <bbaude@redhat.com>
2017-09-14 08:33:10 -05:00
Mrunal Patel
9dcd8c47e7 version: Switch to 1.0.0-rc3-dev
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-13 12:47:35 -07:00
Mrunal Patel
6784a66f2d version: Release 1.0.0-rc2
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-13 12:43:40 -07:00
Mrunal Patel
400713a58b Merge pull request #904 from runcom/fix-manifest-list
fix issue with official images and manifest lits
2017-09-13 12:42:18 -07:00
Antonio Murdaca
22f96b1806
fix issue with official images and manifest lits
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-13 19:01:06 +02:00
Daniel J Walsh
05713958f2 Merge pull request #894 from TomSweeneyRedHat/dev/tsweeney/docfix4
Add golang version note to README.md
2017-09-12 17:48:30 -04:00
Daniel J Walsh
1eb9f8ed8c Merge pull request #887 from baude/kpod_fix_rmi_by_id
cmd/kpod/rmi.go: Fix deletion by ID
2017-09-12 13:44:16 -04:00
Daniel J Walsh
ac5596cf62 Merge pull request #855 from baude/kpod_stop2
kpod stop -- stop one or more containers
2017-09-12 12:27:21 -04:00
Daniel J Walsh
98ab11f460 Merge pull request #885 from rhatdan/debug
Only print error message on kpod error not stacktrace
2017-09-12 11:52:26 -04:00
TomSweeneyRedHat
e2f46a34a6 Add golang version note to README.md
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-09-12 11:29:11 -04:00
Mrunal Patel
ae5739c3de Merge pull request #884 from dcbw/clean-up-sandbox
server: clean up sandbox network when running the sandbox fails
2017-09-11 16:58:45 -07:00
baude
aca658b423 kpod stop -- stop one or more containers
Stop one or more containers. Specific a timeout value
that if the stop operation exceeds, will forcibly stop
the container.

Signed-off-by: baude <bbaude@redhat.com>
2017-09-11 17:03:27 -05:00
baude
f0b94a41e8 cmd/kpod/rmi.go: Fix deletion by ID
When deleting by ID, kpod rmi was only "untagging" the image
and not actually removing it.

Signed-off-by: baude <bbaude@redhat.com>
2017-09-11 16:52:57 -05:00
Daniel J Walsh
75a60cf519 Only print error message on kpod error not stacktrace
If the user specifies --debug flag then print stack trace.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-11 19:40:06 +00:00
Dan Williams
6a58bdf787 server: clean up sandbox network when running the sandbox fails
Runtimes need to clean up anything that needs it if RunPodSandbox()
fails.

Signed-off-by: Dan Williams <dcbw@redhat.com>
2017-09-11 14:19:27 -05:00
Daniel J Walsh
c56dcf2cb5 Merge pull request #863 from umohnani8/version
kpod version
2017-09-11 12:10:11 -04:00
Mrunal Patel
10b72d8bfa Merge pull request #875 from rhatdan/docs
Cleanup README.md and transfer.md with latest kpod
2017-09-11 08:08:07 -07:00
Daniel J Walsh
a3a0bb5e55 Merge pull request #871 from umohnani8/kpod_ps
Add namespace flag to kpod ps
2017-09-11 10:14:39 -04:00
Daniel J Walsh
030b462e35 Merge pull request #877 from runcom/carry-748
Add image pull with signature integration test
2017-09-11 09:40:33 -04:00
Daniel J Walsh
51fa9f3baa Cleanup README.md and transfer.md with latest kpod
Add a couple of new ascicinema also

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-11 08:31:38 -04:00
Aaron Weitekamp
adb0d19416
Add image pull with signature integration test
Signed-off-by: Aaron Weitekamp <aweiteka@redhat.com>
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-11 13:34:30 +02:00
Mrunal Patel
0f8cce1a4f Merge pull request #876 from runcom/redir-stderr-to-stdout
contrib: test: redirect stderr to stdout
2017-09-10 10:17:21 -07:00
umohnani8
12512e418b Update kpod version and info to show beta version
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-09-10 12:17:43 -04:00
umohnani8
38e9f07844 Add namespace flag to kpod ps
The namespace flag prints out information about the namespaces

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-09-10 11:21:49 -04:00
Antonio Murdaca
c9672671db
contrib: test: redirect stderr to stdout
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-09 18:13:56 +02:00
Daniel J Walsh
36584e6f34 Merge pull request #830 from umohnani8/update_load-save
Update kpod load and save for oci-archive
2017-09-09 05:58:54 -04:00
Daniel J Walsh
b5ed8b34c0 Merge pull request #843 from baude/kpod_tag
cmd/kpod/tag.go: Do not assume docker.io for tagging
2017-09-09 05:43:15 -04:00
Antonio Murdaca
f35108d114 Merge pull request #631 from runcom/e2e-conformance
contrib: test: switch node-e2e to e2e
2017-09-09 10:26:20 +02:00
Antonio Murdaca
500eb04b25 Merge pull request #874 from mrunalp/version_dirty_commit
version: Add -dirty if compiled binary includes uncommited changes
2017-09-09 10:05:18 +02:00
Mrunal Patel
e13803043a version: Add -dirty if compiled binary includes uncommited changes
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-09-08 16:17:57 -07:00
Antonio Murdaca
dd1c617467
contrib: test: switch node-e2e to e2e
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-09 00:44:21 +02:00
Antonio Murdaca
5f7c5ee119 Merge pull request #872 from mrunalp/dev_version
version: Add -dev to VERSION
2017-09-09 00:03:54 +02:00
Mrunal Patel
1fe4afd29a version: Bump up to rc2-dev
Signed-off-by: Mrunal Patel <mrunal@localhost.localdomain>
2017-09-08 15:02:55 -07:00
Antonio Murdaca
bb1da978e3 Merge pull request #870 from mrunalp/bump_rc_1
Bump up version to rc 1
2017-09-08 23:34:31 +02:00
Mrunal Patel
086aa910d4 Bump up version to 1.0.0-rc.1
We add a VERSION file and pass the gitCommit and version
to the binary builds in the Makefile.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-08 13:23:59 -07:00
Mrunal Patel
77db25f5bb Merge pull request #856 from umohnani8/kpod_ps
Slight modification to kpod ps based on QE feedback
2017-09-08 11:47:27 -07:00
Mrunal Patel
3211d506a0 Merge pull request #819 from umohnani8/kpod_history
Modify the JSON output of kpod history
2017-09-08 11:45:58 -07:00
Mrunal Patel
0ae21a5f08 Add support for displaying git commit in version
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-08 10:16:01 -07:00
Antonio Murdaca
6d2b19acbb Merge pull request #860 from mrunalp/img_size_id
pkg: storage: image: get size from image ID
2017-09-08 19:12:46 +02:00
umohnani8
79c09d4343 Update kpod load and save for oci-archive
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-09-08 10:33:58 -04:00
umohnani8
216e35db18 Modify the JSON output of kpod history
The JSON output was being modified to type string, fixed that
to be of the same type as the source
This is better for further processing of the JSON output if needed
Restructured kpod history a bit as well

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-09-08 10:33:09 -04:00
umohnani8
45c7100253 Slight modification to kpod ps based on QE feedback
QE noticed that kpod ps --last 0 was returning the running containers
Fixed that problem so that it returns nothing

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-09-08 10:32:11 -04:00
Antonio Murdaca
836919876a pkg: storage: image: get size from image ID
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-08 07:27:48 -07:00
Mrunal Patel
f9387aca28 Merge pull request #865 from runcom/fix-ci
contrib: test: run kube tests in CI with same cgroup driver
2017-09-08 07:24:09 -07:00
Antonio Murdaca
2fa8b3a948 Merge pull request #867 from vbatts/readme_formatting
README: more copy-pastable code sample
2017-09-08 16:03:54 +02:00
87aa0f58e4
README: more copy-pastable code sample
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-09-08 09:27:50 -04:00
Antonio Murdaca
09a8d1a751
contrib: test: run kube tests in CI with same cgroup driver
Our CI tests on RHEL and Fedora and we want to test the systemd cgroup
driver. However, kubelet needs to run in tests with systemd cgroup
driver as well, or tests fail. This patch fixes broken CI because of
not matching cgroup driver between CRI-O and the kubelet.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-08 14:26:39 +02:00
Daniel J Walsh
3c468b6f51 Merge pull request #803 from rhatdan/libpod
Move libkpod/image libkpod/layer to libpod/images and libpod/layers
2017-09-07 15:20:31 -04:00
Antonio Murdaca
b8a6d358e7 Merge pull request #562 from rhatdan/hooks
Add support for running oci-hooks
2017-09-07 19:06:01 +02:00
Antonio Murdaca
e5b5ffdeac Merge pull request #846 from mrunalp/fix_cgroup_config
Fix cgroup config
2017-09-07 19:04:25 +02:00
Mrunal Patel
631359ed69 Merge pull request #849 from runcom/fix-caps
container_create: handle cap add/drop ALL
2017-09-07 09:53:11 -07:00
Antonio Murdaca
af0a494251
container_create: handle cap add/drop ALL
Kubelet can send cap add/drop ALL. Handle that in CRI-O as well.
Also, this PR is re-vendoring runtime-tools to fix capabilities add to
add caps to _all_ caps set **and** fix a shared memory issue (caps set
were initialized with the same slice, if one modifies one slice, it's
reflected on the other slices, the vendoring fixes this as well)

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-07 16:43:33 +02:00
Mrunal Patel
7f4f630b98 Merge pull request #852 from runcom/fixies-42
*: bunch of fixes...
2017-09-07 07:37:37 -07:00
Mrunal Patel
b13e881a9b Merge pull request #858 from runcom/fix-add-registry
pkg: storage: fix additional registries
2017-09-07 07:34:57 -07:00
Antonio Murdaca
f7cbbf5e69 Merge pull request #813 from cevich/addswap
Add file-backed swap to prevent OOM
2017-09-07 14:56:08 +02:00
Antonio Murdaca
70657ea19a Merge pull request #854 from dcbw/cni-updates
Use CNI driver from cri-o/ocicni instead of internal one
2017-09-07 12:33:31 +02:00
Antonio Murdaca
1f908f0890
pkg: storage: fix additional registries
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-07 11:57:16 +02:00
Antonio Murdaca
e8553a124d
container_create: better handling of devices
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-07 10:13:22 +02:00
Antonio Murdaca
b7b57e8731
container_create: Add TERM=xterm when tty=true
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-07 10:13:22 +02:00
Antonio Murdaca
cde40ad5ca
container_create: set privileged on ctr only if also on sandbox
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-07 10:13:22 +02:00
Antonio Murdaca
dacc5c3ece
*: correctly wait and close servers
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-07 10:13:21 +02:00
Mrunal Patel
a81e90a9c9 Merge pull request #848 from runcom/panic-img
pkg: storage: fix panic when no image names
2017-09-06 17:31:34 -07:00
Dan Williams
0df30c5319 server: port to github.com/cri-o/ocicni; remove pkg/ocicni
Signed-off-by: Dan Williams <dcbw@redhat.com>
2017-09-06 16:07:50 -05:00
Dan Williams
3db6ba7667 vendor: add github.com/cri-o/ocicni
Signed-off-by: Dan Williams <dcbw@redhat.com>
2017-09-06 16:03:58 -05:00
Dan Williams
aec99d6f80 vendor: update CNI to 0.6.0
Signed-off-by: Dan Williams <dcbw@redhat.com>
2017-09-06 16:03:57 -05:00
Daniel J Walsh
9f282717da Begin converting kpod pull to use libpod/runtime
We want to drop brute force mechainism for handling image
movement, this patch experiments with moving kpod pull
to use new libpod interfaces.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-06 19:38:47 +00:00
Daniel J Walsh
e18e962238 Move libkpod/image libkpod/layer to libpod/images and libpod/layers
Begin moving image and layer handling out of libkpod into libpod.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-06 19:25:45 +00:00
Daniel J Walsh
47ef2f66df Merge pull request #850 from ashcrow/lint-install-info
lint: Exit and give instructions when linter missing
2017-09-06 13:31:46 -04:00
Mrunal Patel
cb1cad28db sandbox: Check cri-o and kubelet cgroup managers are same
We ensure that cri-o and kubelet are started with compatible
cgroup managers.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-06 09:57:10 -07:00
Mrunal Patel
ac12018973 Merge pull request #814 from runcom/cache-ip-sandbox
cache sandbox's IP address
2017-09-06 09:51:03 -07:00
Antonio Murdaca
a51bc9753f
oci: add a note about crio-conmon- sub-cgroup with cgroupfs
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-06 17:14:53 +02:00
Antonio Murdaca
f9bf4b15e8
server: inspect: send full ctr log path
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-06 17:14:53 +02:00
Antonio Murdaca
e1125af435
server: expose container Name and IP
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-06 17:14:53 +02:00
Antonio Murdaca
5947698818
test: replace bash CNI plugin with a custom bridge
Because we need a working CNI plugin to setup a correct netns so
sandbox_run can grab a working IP address.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-06 17:14:53 +02:00
Daniel J Walsh
257c3d2744 Merge pull request #839 from umohnani8/rm
Implement kpod rm
2017-09-06 10:59:35 -04:00
Steve Milner
9c240aed8e lint: Exit and give instructions when linter missing
Signed-off-by: Steve Milner <smilner@redhat.com>
2017-09-06 10:15:20 -04:00
baude
529eb5bdb7 cmd/kpod/tag.go: Do not assume docker.io for tagging
When performing a tag, if a shortname was provided, tag.go would
preprend docker.io to the shortname through the ParseNormalized
function.  Here we work around that such that is a short name
and tag are provided, the resulting tag will be shortname:tag.  If
a shortname is provided without a tag, we append "latest" as the
tag.

Added specific tag tests too

Signed-off-by: baude <bbaude@redhat.com>
2017-09-06 09:00:00 -05:00
Antonio Murdaca
6c4a508fc9 Merge pull request #845 from mrunalp/cgroup_info
inspect: Add cgroup driver to info output
2017-09-06 14:48:56 +02:00
Antonio Murdaca
ccb44fd047 Merge pull request #840 from umohnani8/vendor_containers/image
Vendor in latest containers/image
2017-09-06 14:11:25 +02:00
Antonio Murdaca
6624eb60c8 Merge pull request #844 from rhatdan/selinux
When installing content make sure it gets labeled correctly.
2017-09-06 13:27:20 +02:00
Antonio Murdaca
b29c6108e2
pkg: storage: fix panic when no image names
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-06 11:32:53 +02:00
Mrunal Patel
612dcc0267 Add k8s function to compress cgroupfs path to systemd
We are copying this to avoid getting in lots of dependencies.
We also remove now unused function.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-05 19:16:15 -07:00
Mrunal Patel
923f50b0f3 inspect: Add cgroup driver to info output
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-05 15:24:39 -07:00
Daniel J Walsh
d375aab45a When installing content make sure it gets labeled correctly.
This patch will check to see if SELinux is enabled and then pass
the -Z flag to the install command, which causes install to label
all created content with the system default labels.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-05 17:09:28 -04:00
Daniel J Walsh
c88bc13b07 Implement kpod rm
Kpod rm removes a container from the system

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-09-05 14:35:36 -04:00
umohnani8
e9467dc540 Vendor in latest containers/image
Adds support for credential helpers

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-09-05 14:19:10 -04:00
Daniel J Walsh
139d0841e8 Add support for oci-hooks to libkpod
Add new directory /etc/crio/hooks.d, where packagers can drop a json config
file to specify a hook.

The json must specify a valid executable to run.
The json must also specify which stage(s) to run the hook:
prestart, poststart, poststop
The json must specify under which criteria the hook should be launched
If the container HasBindMounts
If the container cmd matches a list of regular expressions
If the containers annotations matches a list of regular expressions.
If any of these match the the hook will be launched.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-05 07:39:31 -04:00
Antonio Murdaca
2ac2832686
server: container_create: store sandbox's ip in annotations
So it can be later retrieved when needed (cadvisor)

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-02 02:05:58 +02:00
Antonio Murdaca
5d637f015d
*: store sandbox IP
Don't call into net namespace on every status call

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-02 02:05:12 +02:00
Antonio Murdaca
8538c4067a Merge pull request #834 from mrunalp/inspect_add_sandbox
server: Add sandbox to container info
2017-09-01 22:41:07 +02:00
Antonio Murdaca
11fbcd235c Merge pull request #822 from mrunalp/label_infra_ctr
sandbox: Add special label to infra container
2017-09-01 22:10:54 +02:00
Daniel J Walsh
553521f03f Merge pull request #805 from baude/config
Make kpod parse configuration file
2017-09-01 14:57:14 -04:00
Mrunal Patel
ec27f5b615 server: Add sandbox to container info
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-01 11:50:18 -07:00
Mrunal Patel
e9378f23ca server: Lookup infra containers as well in endpoint
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-01 10:25:10 -07:00
Mrunal Patel
138a40540f server: Add special k8s label to infra containers
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-01 10:25:04 -07:00
Antonio Murdaca
35ada86b04 Merge pull request #833 from runcom/bump-runc-2
Dockerfile: bump runc commit
2017-09-01 19:06:05 +02:00
baude
266fc193e7 Make kpod parse configuration file
kpod must parse the crio configuration file or the storage
is not set up correctly.  By default it is not.  We now read
/etc/crio/crio.conf in as the configuration file unless it is
overriden by the user and the global -c|--config switch.

Signed-off-by: baude <bbaude@redhat.com>
2017-09-01 11:14:40 -05:00
Mrunal Patel
49c1fd27ac server: Add infra container store to track them separately
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-01 08:49:08 -07:00
Mrunal Patel
b4f9fc8c2c server: Rename infra container to POD
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-09-01 08:47:55 -07:00
Mrunal Patel
5650a793bd Merge pull request #831 from runcom/fix-socket
serve grpc and http on the same socket
2017-09-01 07:28:06 -07:00
Antonio Murdaca
76d41478bf
Dockerfile: bump runc commit
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-01 16:25:52 +02:00
Antonio Murdaca
39006d4cdd
serve grpc and http on the same socket
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-09-01 12:37:10 +02:00
Antonio Murdaca
f3bbd44734 Merge pull request #826 from mrunalp/info_sock
server: Use crio socket for info/inspect endpoints
2017-09-01 11:09:54 +02:00
Mrunal Patel
a913cb0b5d server: Use crio socket for info/inspect endpoints
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-08-31 21:30:54 -07:00
Mrunal Patel
c7b625d4fd Merge pull request #828 from runcom/bump-k8s-1.7.5
vendor: bump to kube v1.7.5
2017-08-31 18:43:22 -07:00
Daniel J Walsh
8728194571 Merge pull request #829 from umohnani8/vendor_containers/image
Vendor in changes made to containers/image for OCI
2017-08-31 19:08:18 -04:00
Daniel J Walsh
ab4e7a9a35 Merge pull request #804 from 14rcole/kpod-cmd-list
Remove duplicate kpod command names
2017-08-31 17:02:58 -04:00
umohnani8
3d23f22292 Vendor in changes made to containers/image for OCI
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-08-31 16:40:13 -04:00
Mrunal Patel
22ee46d468 Merge pull request #827 from cevich/add_test_requirements2
Minor: Make wrapper script non-zero exits fatal.
2017-08-31 13:19:30 -07:00
Chris Evich
4f1d303824 Minor: Update venv req. hashes for internal CI
Signed-off-by: Chris Evich <cevich@redhat.com>
2017-08-31 15:25:19 -04:00
Mrunal Patel
f08a5f7162 Merge pull request #824 from runcom/enhance-inspect
server: inspect: add log path and mount point for cadvisor
2017-08-31 11:33:50 -07:00
Antonio Murdaca
eca8457468
vendor: bump to kube v1.7.5
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-31 19:36:07 +02:00
Chris Evich
8689fe8aed Minor: Make wrapper script non-zero exits fatal.
Signed-off-by: Chris Evich <cevich@redhat.com>
2017-08-31 13:06:58 -04:00
Antonio Murdaca
b16d73ab2f
server: image_list: report image size
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-31 17:50:25 +02:00
Antonio Murdaca
69fc590fc3
server: inspect: add log path and mount point for cadvisor
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-31 17:49:07 +02:00
Mrunal Patel
378b9c0d2f Merge pull request #823 from cevich/add_test_requirements
Add Ansible playbook env. setup wrapper script
2017-08-31 07:09:55 -07:00
Antonio Murdaca
c070da051c Merge pull request #821 from mrunalp/crio_info
server: Add a /info endpoint
2017-08-31 16:08:18 +02:00
Chris Evich
054793b80e Add Ansible playbook env. setup wrapper script
The environment executing the test playbooks matters.  Establish a
script to bootstrap a known-good and fixed-version python virtual
environment.  Spell out precise execution requirements in a standard
pip 'requirements.txt' file, including version numbers and hashes.

Upon executing the ``venv-ansible-playbook.sh`` wrapper, a virtual
environment is setup and contained within a fixed (or temporary)
directory, with full logs from setup.  If this is to be preserved
across executions, the ``$WORKSPACE`` environment variable must be
set and exported beforehand.

Example execution command-line provided in script file

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-08-31 06:10:48 -04:00
Daniel J Walsh
f889a578d4 Merge pull request #820 from mikebrow/travis-update
streamlining travis
2017-08-31 05:35:01 -04:00
Mrunal Patel
004330df8f server: Add a /info endpoint
This will give a way for client to get information about crio daemon.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-08-30 20:50:04 -07:00
Mrunal Patel
f557020994 Merge pull request #816 from mrunalp/inspect_container
server: Add an inspect endpoint for containers
2017-08-30 19:08:10 -07:00
Mike Brown
4ce18f3b28 streamlining travis
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2017-08-30 17:21:23 -05:00
Daniel J Walsh
2dccf1b3e5 Merge pull request #808 from mheon/libpod_runtime_skeleton
Add basic skeleton of libpod runtime
2017-08-30 14:52:47 -04:00
Mrunal Patel
58bc35ab40 server: Add an inspect endpoint for containers
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-08-30 11:45:56 -07:00
Chris Evich
f65d548ac2 Add file-backed swap to prevent OOM
Without any swap space enabled, it's possible some intensive operation
can chew up all the memory on the test VM.  Enabling swap space will
prevent this for minor cases, but could lead to disk-thrashing if the
memory demand is excessive.

Since the test system never reboots, using a file-backed swap should
suffice. Though not ideal, it's easy to setup and doesn't require any
interactions with the cloud that owns the VM or the job that created it.

Signed-off-by: Chris Evich <cevich@redhat.com>
2017-08-30 14:01:25 -04:00
Mrunal Patel
173d56cc67 Merge pull request #818 from baude/ps_command
cmd/kpod/ps.go: Use getCommand for JSON
2017-08-30 09:59:02 -07:00
baude
94602a1e85 cmd/kpod/ps.go: Use getCommand for JSON
The getCommand func strips out unwanted characters around the
command of the container.  The JSON output should use this func
like the regular ps output for both consistency and because
Python does a literal interpretation of the bracket [] characters
when consuming as JSON.

Signed-off-by: baude <bbaude@redhat.com>
2017-08-30 09:26:20 -05:00
Antonio Murdaca
35eea14c66 Merge pull request #806 from rajatchopra/master
monitor CNI networks continuously
2017-08-30 12:12:33 +02:00
Mrunal Patel
d634468da6 Merge pull request #812 from runcom/fix-cgroupfs-naming
server: container_create: fix cgroupfs scopes naming
2017-08-29 17:52:45 -07:00
Antonio Murdaca
f51ca87857
*: constify cgroups stuff
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-30 01:10:39 +02:00
Antonio Murdaca
c199f63dba
oci: join crio-conmon for cgroupfs
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-29 23:00:02 +02:00
Antonio Murdaca
dd2b4a8907
server: container_create: fix cgroupfs scopes naming
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-29 23:00:00 +02:00
Matthew Heon
2a121111b5 Add basic skeleton of libpod runtime
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-08-29 13:57:20 -04:00
Daniel J Walsh
85215abf7e Merge pull request #807 from nalind/kpod-storage-status
kpod: add more storage information to "info"
2017-08-29 13:53:58 -04:00
Ryan Cole
380ea16232 Remove duplicate kpod command names
Some kpod commands were listed twice in main.go.  Removed these
duplicates and alphabetized the remaining commands to prevent this
from happening in the future

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-29 11:25:35 -04:00
Mrunal Patel
662e80492c Merge pull request #801 from runcom/not-exist-exit
server: container_remove: ignore not existent exit file
2017-08-29 07:58:33 -07:00
Daniel J Walsh
62f275c784 Merge pull request #802 from baude/add_image_id_to_ps
Add image_id to json output
2017-08-29 06:57:45 -04:00
Daniel J Walsh
3e7cbc9fe7 Merge pull request #795 from rhatdan/kpod-push-compression
Disable compression by default.
2017-08-29 06:54:07 -04:00
Antonio Murdaca
745a05ee86 Merge pull request #799 from runcom/fix-make-install-systemd
Makefile: force symlink to cri-o.service
2017-08-29 11:59:42 +02:00
Antonio Murdaca
c2a4fc740f
oci: wait a while for exit file to show up
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-29 11:25:51 +02:00
Antonio Murdaca
f35147e23c
cmd: {crio,crioctl}: bump to beta
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-29 11:25:33 +02:00
baude
6f492593ec Add image_id to json output
Consumers of the json output, like the atomic cli, need the ID of the
image for the container as well as the name.  Specifically, it is used
to tract "used" and "vulnerable" images.

Signed-off-by: baude <bbaude@redhat.com>
2017-08-28 20:44:22 -05:00
Nalin Dahyabhai
eef5e6d5da kpod: add more storage information to "info"
Have the "kpod info" command also package up the driver-level status
information that the github.com/containers/storage.Store's Status()
method returns.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-08-28 17:32:03 -04:00
Rajat Chopra
1084ce691a monitor CNI networks continuously
Signed-off-by: Rajat Chopra <rchopra@redhat.com>
2017-08-28 15:47:15 -04:00
Daniel J Walsh
3473e8afed Merge pull request #798 from TomSweeneyRedHat/dev/tsweeney/docfix2
Touchup apt to apt-get in README.md
2017-08-28 09:38:57 -04:00
Antonio Murdaca
8a0b851b88
server: container_remove: ignore not existent exit file
Found out that during OpenShift testing, node was trying to remove
containers (probably in a bad state) and was failing the removal with
this kind of error:

E0828 13:19:46.082710    1235 kuberuntime_gc.go:127] Failed to remove
container
"e907f0f46b969e0dc83ca82c03ae7dd072cfe4155341e4521223d9fe3dec5afb": rpc
error: code = 2 desc = failed to remove container exit file
e907f0f46b969e0dc83ca82c03ae7dd072cfe4155341e4521223d9fe3dec5afb: remove
/var/run/crio/exits/e907f0f46b969e0dc83ca82c03ae7dd072cfe4155341e4521223d9fe3dec5afb:
no such file or directory

I believe it's ok to ignore this error as it may happen conmon will
fail early before exit file is written.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-28 15:37:00 +02:00
Antonio Murdaca
9fac90525e
Makefile: force symlink to cri-o.service
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-28 14:59:35 +02:00
Daniel J Walsh
2d358fff37 Merge pull request #788 from umohnani8/kpod_ps
Modify the JSON output of kpod ps
2017-08-28 08:48:08 -04:00
Daniel J Walsh
e48f7a3491 Remove compress variable
No reason to carry this temporary variable for documentation purposes.
If in the future we find that it is necessary to add a CLI option, we
can add the variable then.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-08-28 08:29:42 -04:00
Ryan Cole
865612c3db Disable compression by default
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-28 08:29:42 -04:00
TomSweeneyRedHat
c678bef2bb Touchup apt to apt-get in README.md
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-08-28 07:30:58 -04:00
umohnani8
d76e500b59 Modify the JSON output of kpod ps
Changed the JSON output to hold the actual type of the data.
For example the creation time of a container will be of form time.Time.
The human readable output modifies all the fields to type string, which
is not helpful when the JSON output wants to be used for further processing.

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-08-27 20:41:50 -04:00
Mrunal Patel
6473eec86a Merge pull request #796 from runcom/fix-makefile-idempotent
Makefile: install alias, not symlink
2017-08-27 12:24:57 -07:00
Antonio Murdaca
609ec81360 Merge pull request #789 from mrunalp/close_dbus_conn
utils: Fix close conn after starting scope
2017-08-27 20:22:54 +02:00
Mrunal Patel
8cad9840fa utils: Fix close conn after starting scope
This fixes the goroutine leak in cri-o.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-08-27 07:34:45 -07:00
Mrunal Patel
6d88985d8b Merge pull request #794 from runcom/fix-crictl
*: fix crictl vendor
2017-08-27 07:23:33 -07:00
Antonio Murdaca
d26ad19327
Makefile: install alias, not symlink
ln -s errors out with file exists if you run make install.systemd twice
or more. This patch installs the alias directly w/o using a symlink so
it can be run multiple times w/o errors.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-27 16:03:13 +02:00
Daniel J Walsh
e5ec48b686 Merge pull request #792 from mrunalp/update_readme
Update readme
2017-08-27 06:50:07 -04:00
Antonio Murdaca
59ba89d64d
*: fix crictl vendor
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-27 10:54:36 +02:00
Mrunal Patel
39d37f2b8f readme: Link to CRI documentation and update status to beta
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-08-26 16:36:55 -07:00
Mrunal Patel
a38419af88 Merge pull request #787 from runcom/max-threads
server: set golang runtime max threads
2017-08-24 10:27:34 -07:00
Antonio Murdaca
98da370173
server: set golang runtime max threads
SetMaxThreads from runtime/debug in Golang is called to set max threads
value to 90% of /proc/sys/kernel/threads-max
Should really help performance.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-23 19:35:08 +02:00
Mrunal Patel
236b10a1a1 Merge pull request #786 from rhatdan/readme
Update README
2017-08-23 07:50:25 -07:00
Daniel J Walsh
878d374f37 Update README
Add missing kpod-ps information
Add link for kpod history video.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-08-23 07:36:10 -04:00
Daniel J Walsh
7af1ae71ed Merge pull request #776 from umohnani8/kpod_ps
Add 'kpod ps' command
2017-08-23 07:08:31 -04:00
Mrunal Patel
a1071649f0 Merge pull request #784 from vbatts/no_images_list
kpod-images: don't nil pointer on empty list
2017-08-22 14:57:33 -07:00
Mrunal Patel
94469cc788 Merge pull request #780 from runcom/move-master-kube-1.7
*: update kube vendor to v1.7.4
2017-08-22 14:44:03 -07:00
umohnani8
35ca80abe6 Add 'kpod ps' command
kpod ps lists the containers currently stored

Displays the list of containers

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-08-22 16:40:45 -04:00
41c689ac77
kpod-images: don't nil pointer on empty list
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-08-22 14:15:58 -04:00
Antonio Murdaca
49bdd59406
*: initial wire in of crictl from cri-tools
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-22 20:14:49 +02:00
Antonio Murdaca
8088d7a1e2
*: fix lint issues
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-22 17:32:18 +02:00
Antonio Murdaca
d56bf090ce
*: update kube vendor to v1.7.4
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-22 17:32:14 +02:00
Daniel J Walsh
c67859731f Merge pull request #778 from nalind/kpod-shutdown
kpod: shut down the storage library at exit
2017-08-22 07:02:36 -04:00
Nalin Dahyabhai
6f27dddf93 kpod images: output multiple image names
Output multiple image names, if we have more than one.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-08-21 11:27:45 -04:00
Nalin Dahyabhai
178c1e9ccb kpod.bats: correct syntax errors
Correct some syntax errors in kpod.bats, ensure that it always checks
the exit status of "kpod rmi" commands, correct the order of options
when calling "kpod inspect", and test for string equality correctly.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-08-21 11:27:45 -04:00
Nalin Dahyabhai
ef8df00e6a kpod: shut down the storage library before exiting
Before exiting, have kpod shut down the storage library if it can.  This
should keep us from leaving mountpoints for the root (for non-vfs cases)
and run directory (with newer containers/storage) busy when testing kpod.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-08-21 11:27:44 -04:00
Mrunal Patel
3a2518ce33 Merge pull request #782 from rhatdan/readme
Update web site documentation for latest kpod
2017-08-20 09:32:45 -07:00
Daniel J Walsh
33201aff56 Update web site documentation for latest kpod
Add missing commands to transfer page and add
links for demos to README.md page.

Fixup bash completions for new commands.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-08-20 06:56:27 -04:00
Daniel J Walsh
c0f3e02bae Merge pull request #765 from baude/format
Format
2017-08-19 04:10:40 -04:00
baude
78c6151519 Modify kpod diff --json to --format json
We want all kpod subcommands to use the formats code to output
formats like json.  Altering kpod diff --json to kpod diff --format json
like the kpod images command.

Signed-off-by: baude <bbaude@redhat.com>
2017-08-18 21:05:58 -05:00
Mrunal Patel
c9d27ad111 Merge pull request #779 from nalind/kpod-debug-flag
kpod: make --debug work
2017-08-18 16:23:32 -07:00
Mrunal Patel
4e9be043a8 Merge pull request #757 from mheon/libpod
Add skeleton of new libpod API
2017-08-18 15:32:50 -07:00
Mrunal Patel
959aab4fd5 Merge pull request #766 from mrunalp/ctr_status_fixes
Container status fixes
2017-08-18 07:39:56 -07:00
Mrunal Patel
701e7ff63f container_status: Get latest container status if exit code is -1
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-08-17 21:13:39 -07:00
Mrunal Patel
37edc50c1d oci: Check if process exists before trying to kill it
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-08-17 19:42:50 -07:00
Mrunal Patel
908b3fcbbc Add container/sandbox id to response debugs
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-08-17 19:42:43 -07:00
Nalin Dahyabhai
05985ff2f7 kpod: make --debug work
The --debug flag is a global CLI flag, so parse it like one.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-08-17 15:27:04 -04:00
Mrunal Patel
cab0860257 sandbox_remove: Don't stop containers if sandbox is stopped already
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-08-17 11:28:18 -07:00
Mrunal Patel
f82fe5691a Merge pull request #706 from 14rcole/kpod-stats
Kpod stats
2017-08-17 11:24:38 -07:00
Mrunal Patel
a5591d34b7 Merge pull request #772 from 14rcole/kpod-rename
implement kpod rename
2017-08-17 10:04:16 -07:00
Mrunal Patel
8d58f227cd sandbox_stop: Store stopped status
This allows us to respond to kubelet quickly if the
pod was already stopped successfully earlier.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-17 09:01:07 -07:00
Mrunal Patel
ce17c5214d sandbox: Reduce number of calls to UpdateStatus
Also, we distinguish between container and a pod infra
container in the exit monitor as pod infra containers
aren't stored in the main container index.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-17 09:01:07 -07:00
Mrunal Patel
ea4b6fa55d container: Reduce number of calls to UpdateStatus
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-17 09:01:07 -07:00
Mrunal Patel
3f1b42ee9e Return container mounts in status from stored list
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-17 09:01:07 -07:00
Mrunal Patel
fa317b41fd Add volumes to container object at container create time
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-17 09:01:07 -07:00
Mrunal Patel
5ab6ec3046 oci: Add volumes field to Container
We add a ContainerVolume struct and store a list of volumes
in the Container object for quick retrieval.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-17 09:01:07 -07:00
Mrunal Patel
bfcebcdb00 Store imageName and imageRef for containers
We calculate these values at container creation time and store
them in the container object as they are requested during container
status. This avoids re-calculation and speeds up container status.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-17 09:01:07 -07:00
Mrunal Patel
1cf5f8ee3b container: Don't call OCI runtime status
We get notified of container exits by inotify so we already
have updated status of the container in memory state.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-17 09:01:07 -07:00
Matthew Heon
d6eb943075 Move some image functions around
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-08-17 11:47:10 -04:00
Ryan Cole
ceeed6c32e add kpod stats function
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-17 11:34:10 -04:00
Ryan Cole
dda5511a2b Add libcontainer dependencies to vendor.conf
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-17 11:33:51 -04:00
Ryan Cole
65eec38754 Vendor in files for runc/libcontainer
vndr was previously removing .go files in runc/libcontainer since they weren't used anywhere
in cri-o, but kpod stats will use them

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-17 11:33:51 -04:00
Mrunal Patel
efc29e3dd2 Merge pull request #774 from rhatdan/rbind
CRI-O default bind mounts to "rbind, rprivate" to match docker
2017-08-17 08:30:25 -07:00
Matthew Heon
6be525b9f0 Modify container exec and attach, add image import/export
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-08-17 10:43:24 -04:00
Matthew Heon
bdddb3d36b Add preliminary libpod image API
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-08-17 10:43:24 -04:00
Matthew Heon
9d56fd8443 Add skeleton of new libpod API
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-08-17 10:43:24 -04:00
Mrunal Patel
8c496a101a Merge pull request #773 from 14rcole/kpod-format-table
Kpod format
2017-08-17 07:41:09 -07:00
Ryan Cole
1eb21f8e15 implement kpod rename
rename a container

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-17 09:00:41 -04:00
Ryan Cole
ba07bfb932 Make kpod images use text/template by default
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-17 08:32:38 -04:00
Ryan Cole
08c3d241a4 Add format functions
Add functions to go templates such as truncating a field.  Also add
the table keyword, which, if placed at the beginning of a format string,
adds headers to the output

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-16 15:45:13 -04:00
Mrunal Patel
6ca462a3b6 Merge pull request #718 from 14rcole/kpod-logs
Kpod logs
2017-08-16 11:47:34 -07:00
Mrunal Patel
96735dac2f Merge pull request #775 from TomSweeneyRedHat/dev/tsweeney/docfix1
Number of minor touch ups to Code of Conduct
2017-08-16 11:14:22 -07:00
TomSweeneyRedHat
85f4f09e52 Number of minor touch ups to Code of Conduct
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-08-16 11:34:58 -04:00
Daniel J Walsh
50ad19148d CRI-O default bind mounts to "rbind, rprivate" to match docker
Containers running in kubernetes currently do not specify options
for mount propagation and whether to bind or rbind the mount point.
Since docker defaults to bind and rbind, we should match their
behavious, since this is what admins expect

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-08-16 11:16:39 -04:00
Ryan Cole
07572e85f5 Add kpod logs command
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-16 08:55:23 -04:00
Mrunal Patel
85b4aedacb Merge pull request #770 from umohnani8/kpod_load
Fix 'kpod load' nil issue raised by QE
2017-08-15 19:04:15 -07:00
umohnani8
9f349528dc Fix 'kpod load' nil issue raised by QE
When an image is saved using the digest, the repotag saved is null causing load to break
Using the hex form of the image digest to save the image when the repotag is null
This saves the image in containers-storage without a name or tag as "<none>"

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-08-15 14:23:11 -04:00
Mrunal Patel
a69631c1bd Merge pull request #769 from rhatdan/debug
More cleanups of main man page kpod-1.md and README.md
2017-08-15 10:42:56 -07:00
Mrunal Patel
24476e9afb Merge pull request #761 from mbssaiakhil/patch-3
Fix Typo in cri-o Tutorial
2017-08-15 09:52:24 -07:00
Mrunal Patel
84395bc969 Merge pull request #760 from mbssaiakhil/patch-2
Fix Typo in Events Code of Conduct
2017-08-15 09:52:07 -07:00
Mrunal Patel
c067fbbbe2 Merge pull request #759 from mbssaiakhil/patch-1
Fix Typo in cri-o README
2017-08-15 08:17:07 -07:00
Daniel J Walsh
87b13fd432 More cleanups of main man page kpod-1.md and README.md
Also added new commands to transfer.md

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-08-15 11:08:22 -04:00
Mrunal Patel
43df5b89af Merge pull request #767 from asifdxtreme/patch2
Fix Typo to improve GoReport
2017-08-15 07:29:17 -07:00
Mrunal Patel
6980365d0d Merge pull request #768 from asifdxtreme/patch-3
Fix Typo in Readme
2017-08-15 07:29:00 -07:00
Malepati Bala Siva Sai Akhil
9d52efef23 Update Community Code of Conduct
Update Community Code of Conduct from kubernetes/kubernetes-template-project

Signed-off-by: Malepati Bala Siva Sai Akhil <malepatib.akhil@huawei.com>
2017-08-15 19:55:16 +05:30
Malepati Bala Siva Sai Akhil
59d5f32933 Fix Typo in Events Code of Conduct
Signed-off-by: Malepati Bala Siva Sai Akhil <malepatib.akhil@huawei.com>
2017-08-15 17:25:45 +05:30
Malepati Bala Siva Sai Akhil
01dac86b1c Fix Typo in cri-o Tutorial
Signed-off-by: Malepati Bala Siva Sai Akhil <malepatib.akhil@huawei.com>
2017-08-15 10:00:20 +05:30
asifdxtreme
39722ab5e6 Fix Typo in Readme
Signed-off-by: asifdxtreme <mohammad.asif.siddiqui1@huawei.com>
2017-08-15 10:48:39 +08:00
Malepati Bala Siva Sai Akhil
4e64eedbc5 Fix Typo in cri-o README
Signed-off-by: Malepati Bala Siva Sai Akhil <malepatib.akhil@huawei.com>
2017-08-15 08:15:04 +05:30
asifdxtreme
1442ba988a Fix Typo to improve GoReport
Signed-off-by: asifdxtreme <mohammad.asif.siddiqui1@huawei.com>
2017-08-15 10:15:01 +08:00
Mrunal Patel
36fd0a7208 Merge pull request #744 from rhatdan/debug
Add --debug flag to kpod to turn up logging level to debug
2017-08-14 16:21:22 -07:00
Antonio Murdaca
a8f0b115ad Merge pull request #746 from vbatts/ops-transfer
tranfer: document ops and dev transfer
2017-08-14 16:02:39 +02:00
Antonio Murdaca
ea600408fb Merge pull request #762 from rhatdan/kpod-cp
Add man page for kpod-cp.1
2017-08-14 16:01:01 +02:00
Antonio Murdaca
95165063bd Merge pull request #758 from mrunalp/inotify_exit_watch
Inotify exit watch
2017-08-14 16:00:35 +02:00
Daniel J Walsh
cb01a0a09e Add man page for kpod-cp.1
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-08-14 13:30:37 +00:00
Mrunal Patel
30ded83096 Add inotify watcher for container exits
This allows the container list API to return updated status
for exited container without having to call container status first.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-08-13 08:01:48 -07:00
Mrunal Patel
4311020c36 Merge pull request #653 from baude/images_json
cmd/kpod/images.go: Add JSON output option
2017-08-13 07:19:04 -07:00
Mrunal Patel
8f735a581d container: Don't call runtime state on every container on list
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-08-12 18:37:06 -07:00
baude
01b71393e3 cmd/kpod/images.go: Add structured format ouput
For kpod images, we need to output in JSON format so that consumers
(programatic) have structured input to work with.

kpod images --format json

Signed-off-by: baude <bbaude@redhat.com>
2017-08-12 19:09:49 -05:00
Mrunal Patel
2bdcd460bb Merge pull request #722 from 14rcole/kpod-diff
Add kpod diff command
2017-08-12 08:17:19 -07:00
Daniel J Walsh
464d6852de Add --debug flag to kpod to turn up logging level to debug
Also set default level of logging to errors,  we should not see
info messages in the kpod command line.

While adding this patch, I found missing options in kpod command line
and bash completions, so I added them in.

Also fixed some sorting issues in the way commands are displayer in help or in
bash completions.

Finally fixed the error message to be output on failure using logrus.Errorf, so
we don't get the stack any longer.

Also updated README.md with missing kpod commands.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-08-11 16:41:25 -04:00
Ryan Cole
949268f958 Add kpod diff command
kpod diff reports on differences between two layers, specified as
layer IDs, containers, or images.  In the case of containers or
images, kpod diff produces a diff for the top layer

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-11 16:08:41 -04:00
5c78a457f6
tranfer: document ops and dev transfer
Facilitating the "how do i do X?" knowledge transfer process.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-08-11 13:55:03 -04:00
Mrunal Patel
fb2ee59225 Merge pull request #737 from umohnani8/kpod_export
Add 'kpod export' command
2017-08-11 10:54:34 -07:00
Mrunal Patel
5a3c168892 Merge pull request #750 from sak0/dev
tutorial: need runc 1.0.0-rc4
2017-08-11 07:06:37 -07:00
Antonio Murdaca
c6f408fe37 Merge pull request #751 from mrunalp/metrics_ep
Add a /metrics endpoint
2017-08-10 20:22:07 +02:00
Mrunal Patel
43bc359fc0 Add metrics endpoint support to server
We add two flags --enable-metrics and --metrics-port
to enable metrics endpoint and allow specifying the
port which defaults to 9090.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-10 13:44:42 -04:00
Mrunal Patel
0e1452a4ec Add a /metrics endpoint for the server
This is for prometheus integration

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-10 13:44:42 -04:00
CuiHaozhi
3320b64fc0 tutorial: need runc 1.0.0-rc4
Signed-off-by: CuiHaozhi <cuihz@wise2c.com>
2017-08-10 11:53:35 -04:00
Mrunal Patel
4310e6d86f Merge pull request #741 from 14rcole/kpod-inspect-update
have server update list of containers on creation
2017-08-10 05:23:39 -07:00
Mrunal Patel
8e394e0589 Merge pull request #694 from rhatdan/mount
Add kpod-mount and kpod-umount to mount and umount container images
2017-08-08 13:55:01 -07:00
umohnani8
be8ba17534 Add 'kpod export' command
kpod export exports the container's filesystem to a tar archive

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-08-08 16:46:01 -04:00
Dan Walsh
0cc45cf26a Add kpod-mount and kpod-umount to mount and umount container images
This command will allow users to manipulate and examine the container
images from outside of the container.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-08-08 15:46:50 -04:00
Ryan Cole
bfbb99e05c have server update list of containers on creation
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-08 10:23:32 -04:00
Antonio Murdaca
efce63bdf2 Merge pull request #735 from rhatdan/vendor
Move to new github.com/sirupsen/logrus.
2017-08-08 14:19:56 +02:00
Mrunal Patel
46a9bb3838 Merge pull request #740 from rhatdan/OWNERS
I would like to add @nalind to the OWNERS of cri-o
2017-08-07 13:25:14 -07:00
Daniel J Walsh
50ddadb08c I would like to add @nalind to the OWNERS of cri-o
He is a key contributor to the CRI-O project, he has contributed a lot to cri-o
and the projects/libraries

He is an expert in containers/storage and really solid on containers/image
key components of the cri-o project.  We need to get his advise and appoval
on lots of pull requests interacting with the storage and image layers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-08-07 16:16:07 -04:00
Daniel J Walsh
63a218a458 Move to new github.com/sirupsen/logrus.
Need to mv to latest released and supported version of logrus
switch github.com/Sirupsen/logrus github.com/sirupsen/logrus

Also vendor in latest containers/storage and containers/image

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-08-07 11:50:04 -04:00
Mrunal Patel
816b15e07e Merge pull request #738 from rhatdan/1.6
Remove testing with 1.6.
2017-08-07 08:48:05 -07:00
Mrunal Patel
3b888a54d3 Merge pull request #720 from 14rcole/containerserver-integration
Move functions in libkpod to ContainerServer
2017-08-07 08:09:53 -07:00
Daniel J Walsh
7576620d2f Remove testing with 1.6.
Some features cri-o is now using are not supported by golang 1.6.
All Distros that use CRI-O are now using golang 1.7 or better,
so no reason to test with this older version.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-08-07 10:56:33 -04:00
Mrunal Patel
5402f95d69 Merge pull request #736 from fntlnz/console-socket-tempdir
conmon: Using `g_get_tmp_dir` to build the console socket name
2017-08-07 07:28:46 -07:00
Lorenzo Fontana
e9e40c9df2
Using g_get_tmp_dir to build the console socket name
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2017-08-06 17:26:14 +02:00
Mrunal Patel
dc3b6f4d78 Merge pull request #734 from mikkeloscar/buildtags-var
build: Allow overwrite of BUILDTAGS variable
2017-08-05 17:18:31 -07:00
Mikkel Oscar Lyderik Larsen
a747fa0c00
build: Allow overwrite of BUILDTAGS variable
Signed-off-by: Mikkel Oscar Lyderik Larsen <m@moscar.net>
2017-08-05 14:19:06 +02:00
Mrunal Patel
ef6e1e93f1 Merge pull request #729 from runcom/fix-build-2
oci: fix build condition
2017-08-04 19:32:27 -07:00
Mrunal Patel
ce8bd648de Merge pull request #730 from 14rcole/kpod-image-filter
fix bug with creation time in ParseFilter()
2017-08-04 19:24:37 -07:00
Mrunal Patel
03fdd4b188 Merge pull request #733 from 14rcole/kpod-copy-creds
Allow password for docker registry to be inputted silently
2017-08-04 12:22:19 -07:00
Ryan Cole
c6dc7d3e22 Fix bug resulting in kpod images --quiet only printing one image
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-04 11:50:38 -04:00
Ryan Cole
0a62304adf fix bug with creation time in ParseFilter()
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-04 11:46:43 -04:00
Ryan Cole
0d8f015675 Allow password for docker registry to be inputted silently
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-04 09:35:36 -04:00
Antonio Murdaca
44e3b8de67 Merge pull request #731 from mrunalp/add_rhatdan
Add rhatdan as an OWNER
2017-08-04 14:00:47 +02:00
Antonio Murdaca
18a1a93e48 Merge pull request #724 from nalind/wrapped-errors
Use errors.Cause() when looking at storage errors
2017-08-04 12:00:25 +02:00
Mrunal Patel
d45d8fd3f4 Add rhatdan as an OWNER
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-08-03 19:33:02 -07:00
Nalin Dahyabhai
0b7348b35c Use errors.Cause() when looking at storage errors
The storage library uses github.com/pkg/errors to wrap errors that it
returns from many of its functions, so when passing them to
os.IsNotExist() or comparing them to specific errors defined in the
storage library, unwrap them using errors.Cause().

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-08-03 15:40:54 -04:00
Antonio Murdaca
c24daefd3e
oci: fix build condition
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-03 20:20:38 +02:00
Ryan Cole
b1eb754ef5 Move functions in libkpod to ContainerServer
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-03 13:05:44 -04:00
Mrunal Patel
d4f023918c Merge pull request #726 from nalind/glib2-ostree
Build a fixed version of ostree in Travis
2017-08-03 09:49:38 -07:00
Nalin Dahyabhai
d16625a603 Stick to a specific version of ostree in Travis
When we build ostree for Travis, stick to version 2017.9 for now.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-08-03 10:56:28 -04:00
Mrunal Patel
66d96e77e3 Merge pull request #674 from runcom/additional-registries
*: implement additional pull registries
2017-08-02 17:42:58 -07:00
Antonio Murdaca
da176cd379 Merge pull request #717 from 14rcole/oci-getcontainer
Allow oci memory store to match containers by id prefix or by name
2017-08-02 16:55:36 +02:00
Antonio Murdaca
a35727c80b
*: implement additional pull registries
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-08-02 16:38:11 +02:00
Antonio Murdaca
7351786411 Merge pull request #713 from 14rcole/containerserver-update
Make container server update it's list of containers upon creation
2017-08-02 16:29:53 +02:00
Mrunal Patel
65f8fc850a Merge pull request #721 from rhatdan/atomic
Remove atomic transport description.
2017-08-01 10:13:17 -07:00
Ryan Cole
b56da85fc1 Make container server update it's list of containers upon creation
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-08-01 11:44:57 -04:00
Daniel J Walsh
910064bf74 Remove atomic transport description.
Miloslav informs me that the docker transport talking to an OpenShift
registry will handle signatures properly, so no need for the atomic transport
any longer.  We want to stop documenting it.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-08-01 11:41:52 -04:00
Mrunal Patel
d574177c2a Merge pull request #677 from mheon/state_lock_to_file
Add option to use file-based locking for CRI-O state
2017-08-01 07:32:50 -07:00
Ryan Cole
9ada0eb4e5 Allow containerserver to match containers by id prefix or name
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-31 19:49:39 -04:00
Matthew Heon
9529f565b2 Add option to use file-based locking for libkpod state
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-07-31 15:58:29 -04:00
Mrunal Patel
fa6e2d81f9 Merge pull request #711 from mheon/rename_kpod_files
Rename libkpod files to follow Go conventions
2017-07-31 12:48:13 -07:00
Matthew Heon
4205b222a2 Rename libkpod files to follow Go conventions
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-07-31 10:11:40 -04:00
Mrunal Patel
3103524dea Merge pull request #707 from TomSweeneyRedHat/dev/tsweeney/docfix
Make the kpod manpages a bit more uniform
2017-07-30 07:53:22 -07:00
Mrunal Patel
0ae7443ee1 Merge pull request #668 from umohnani8/kpod_load
Add kpod load
2017-07-30 07:52:55 -07:00
TomSweeneyRedHat
b0fac5596c Make the kpod manpages a bit more uniform
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-07-29 13:26:21 -04:00
umohnani8
412b98be26 Add 'kpod load' command
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-07-28 22:30:48 -04:00
Mrunal Patel
79c5160e5a Merge pull request #700 from nalind/kpod-updates
kpod: display image dates from inspection data, and don't display non-OCI settings in "inspect"
2017-07-28 19:08:39 -07:00
Nalin Dahyabhai
5e97d2a1e2 libkpod: remove non-OCI information from inspect
Remove the non-OCI version of the configuration structure, and the
parent image ID, from the ImageData that libkpod returns.

At runtime, cri-o is only ever going to use the OCI configuration
(possibly converted from another format by the image library) when
setting up a container, so it can be confusing to display settings in
"kpod inspect" that might be discarded when we try to run a container.

Remove the non-OCI version of the configuration structure, and the
hard-coded Type field, from the ContainerData that libkpod returns.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-28 16:58:12 -04:00
Nalin Dahyabhai
40117e8bfe Use inspected creation dates
We already parse every image if there's a label filter so that we can
check against the filter, so when we do that, go ahead and read the
OCI-format configuration and inspection data as well, and use an image's
creation date as recorded in inspection data everywhere.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-28 16:58:12 -04:00
Mrunal Patel
1deb9795c3 Merge pull request #705 from 14rcole/kpod-save-config
Switch kpod save to use config
2017-07-28 13:51:31 -07:00
Ryan Cole
2cb57e0cb5 Switch kpod save to use config
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-28 15:51:11 -04:00
Mrunal Patel
d2a82a28c1 Merge pull request #678 from umohnani8/kpod_save
Add 'kpod save' command
2017-07-28 10:49:49 -07:00
Mrunal Patel
5530764809 Merge pull request #702 from rhatdan/man
remove kpod-push.1.md from wrong directory.
2017-07-28 08:37:43 -07:00
Mrunal Patel
13c874753c Merge pull request #693 from 14rcole/libkpod-config
add basic config struct to libkpod
2017-07-28 06:24:45 -07:00
Daniel J Walsh
eace36ee64 kpod-push.1.md in wrong directory.
Their is a kpod-push.1.md man page in docs directory.
This is a bogus location.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-07-28 10:53:44 +00:00
Ryan Cole
a8b6f2ad8a Update kpod commands to use getConfig()
Make getStore() take a config struct from which it pulls the store
options, then update the kpod commands so that they call getConfig()
and pass the config into getStore()

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-27 15:58:55 -04:00
umohnani8
ff5eda509a Add 'kpod save' command
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-07-27 13:35:30 -04:00
Mrunal Patel
9dbd60a0df Merge pull request #698 from nalind/kpod-updates
kpod: avoid digging into unpublished formats
2017-07-27 10:20:46 -07:00
Ryan Cole
0c8f106ee8 add basic config struct to libkpod
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-27 11:12:50 -04:00
Mrunal Patel
c0bfa01c66 Merge pull request #699 from rhatdan/vendor
vendor in Update containers/image to add support for kpod save
2017-07-27 06:55:45 -07:00
Dan Walsh
acd3fd03c5 vendor in Update containers/image to add support for kpod save
This update allows the creation of docker-archive files when the
destination does not exists or is empty.  kpod save needs this functionality.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2017-07-27 06:47:39 -04:00
Mrunal Patel
f8a822e900 Merge pull request #697 from nalind/image-free
Don't double-free an UnparsedSource
2017-07-26 17:35:39 -07:00
Mrunal Patel
0c115d8ecc Merge pull request #696 from mrunalp/profile_port
Make the profile port configurable
2017-07-26 15:44:48 -07:00
Nalin Dahyabhai
cb0bb94c68 Avoid parsing image metadata
Avoid parsing metadata that the image library keeps in order to find an
image's top layer and creation date; instead, use the values which the
storage library now makes available, which will be correct once we merge
PR #654 or something like it.

Instead of assuming the last blob which was added for the image was the
manifest, read it directly and compute its digest ourselves.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-26 16:33:02 -04:00
Nalin Dahyabhai
82c90747c2 Don't double-free an UnparsedSource
github.com/containers/image.FromUnparsedImage() "takes ownership" of the
UnparsedImage that we pass to it, so we shouldn't also Close() the
UnparsedImage ourselves after we've wrapped it up in an Image object.

Since creating an Image is the only thing we do with the UnparsedImage
after creating it from a SourceImage, just use the FromSource() function
to handle both steps at once.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-26 15:52:51 -04:00
Mrunal Patel
93f1ec3b1f Merge pull request #691 from mheon/remove_server_state
Move remaining server state to libkpod
2017-07-26 11:25:34 -07:00
Mrunal Patel
1f40531dca Make the profile port configurable
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-07-26 10:57:55 -07:00
Nalin Dahyabhai
7e9ac9700b Avoid duplicate image configuration parsing logic
Don't bother trying to find and parse the image's configuration blob
after we've already done it; just reuse the value.  This frees us from
making the assumption that the last blob which was committed to local
storage was the image's configuration blob.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-26 12:43:22 -04:00
Nalin Dahyabhai
8957156c41 Parse out image names as repotags and repodigests
Parse the set of image names as tagged references, canonical references,
or repository names to which we add the default tag, and return them in
libkpod.ImageData reports.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-26 12:43:22 -04:00
Mrunal Patel
120af8ef01 Merge pull request #692 from nalind/api-usage
Fix a couple of bugs in our use of containers/storage and containers/image
2017-07-26 09:35:11 -07:00
Nalin Dahyabhai
3747048aa4 Don't leak containers/image Image references
In-memory image objects created using an ImageReference's NewImage()
method need to be Close()d.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-25 13:30:54 -04:00
Nalin Dahyabhai
2e50006f1c Avoid using lower-level storage APIs
Switch from using the lower-level storage APIs (accessing LayerStore,
ImageStore, and ContainerStore types directly) in favor of the
higher-level ones that take care of synchronization and locking for us.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-25 13:29:49 -04:00
Matthew Heon
158893bd1a Move Pod ID and Name indexes into libkpod
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-07-25 11:46:22 -04:00
Matthew Heon
ece055327a Move Sandbox state into libkpod
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-07-25 11:46:15 -04:00
Antonio Murdaca
065960386f Merge pull request #676 from 14rcole/libkpod-image
move kpod logic into libkpod/image
2017-07-25 17:39:56 +02:00
Ryan Cole
18f94f38ba Remove GetImage() and make rmi use more robust FindImage()
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-25 09:02:45 -04:00
Mrunal Patel
8fd089c570 Merge pull request #685 from 14rcole/libkpod-serverfunctions
Libkpod serverfunctions
2017-07-24 16:29:31 -07:00
Mrunal Patel
4cce851851 Merge pull request #688 from giuseppe/conmon-do-not-leave-zombies
conmon: use waitpid to wait for terminated processes
2017-07-24 14:50:17 -07:00
Ryan Cole
c1706475c0 move functions supporting rmi command to libkpod/image
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-24 16:17:26 -04:00
Ryan Cole
0f44ff1d3b move functions supporting images command to libkpod/image
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-24 14:35:36 -04:00
Ryan Cole
df7536e3c0 move PushImage and PullImage to libkpod/image
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-24 14:35:36 -04:00
Ryan Cole
14864f820e move code supporting push, pull, and inspect to libkpod and libkpod/image
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-24 14:35:36 -04:00
Ryan Cole
2c1fd1ad3f move container-related functions out of kpod and into libkpod
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-24 14:34:55 -04:00
Ryan Cole
a68a981d0b move image-related functions out of cmd/kpod/common.go and into libkpod/image
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-24 14:34:55 -04:00
Ryan Cole
95e17b4a73 move driver and image metadata to libkpod
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-24 14:34:55 -04:00
Ryan Cole
314d55f284 move shutdown function into libkpod and have server call in to it
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-24 14:32:02 -04:00
Mrunal Patel
a95bbe9608 Merge pull request #687 from nalind/vendor
Bump vendored containers/image, containers/storage, and add ostreedev/ostree-go
2017-07-24 11:07:08 -07:00
Nalin Dahyabhai
eebbd6a098 Add notes to README.md about needing ostree-dev
Add notes to README.md about needing to install ostree-devel, or
libostree-dev, or building ostree from source.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-24 13:03:09 -04:00
Nalin Dahyabhai
1e1d6a512f Build with ostree
Build using a locally-built copy of ostree in testing setups.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-24 13:03:07 -04:00
Dan Walsh
d76645680f Bump image, storage, and image-spec
Bump containers/image (pulling in its new dependency on ostree-go),
containers/storage, and updated image-spec.

This pulls in the OCI v1.0 specifications and code that allows us to
support 1.0 images.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-24 13:01:54 -04:00
Mrunal Patel
5138691c3b Merge pull request #684 from giuseppe/fix-makefile-tests-rule
Makefile: do not rebuild tests every time "make" runs
2017-07-24 09:44:32 -07:00
Ryan Cole
4fe17ee16d Update libkpod New()
update libkpod's New() function to use a config struct, and update
server.New() to call into libkpod.New()

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-24 10:35:39 -04:00
Ryan Cole
49ed4ab710 move reserve/release container name into libkpod
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-24 10:35:31 -04:00
Ryan Cole
d625e0e468 move containerState to/from disk to libkpod
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-24 10:35:20 -04:00
Giuseppe Scrivano
595b0557f3 conmon: use waitpid to wait for terminated processes
During my testing in OpenShift I've noticed that conmon leaves some
zombies processes.  The reason is that we are using
PR_SET_CHILD_SUBREAPER in conmon and runC forks a new process (runc
init) each time we start a container.  Using g_child_watch_add only on
the main runc process and on the container process is not enough as we
do not cleanup any other zombie process.

Since glib doesn't allow to catch SIGCHLD and to better integrate in the
existing code, catch it with signal(2) then raise a SIGUSR1 that glib
handles.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2017-07-24 14:50:50 +02:00
Giuseppe Scrivano
55310f9a95 conmon: do not fail if waitpid is interrupted
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2017-07-23 18:55:16 +02:00
Mrunal Patel
1aa0d5da86 Merge pull request #686 from sak0/dev
crioctl ctr stop: enable timeout input
2017-07-22 13:22:13 -07:00
Giuseppe Scrivano
a30f84906c Makefile: do not rebuild tests every time "make" runs
bin2img/checkseccomp/copyimg are file targets and should not be .PHONY.
This prevents to build them if not necessary.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2017-07-22 11:37:24 +02:00
Mrunal Patel
c66c633b77 Merge pull request #682 from nalind/build-flags
Build all of our binaries with the same build tags
2017-07-21 19:23:16 -07:00
Nalin Dahyabhai
375ffaee03 Build all of our binaries with the same build tags
Build all of our binaries with the same build tags and the same LDFLAGS.
This means we add $(LDFLAGS) to bin2img, copyimg, and cri-o,
$(BUILDTAGS) to kpod, and both to crioctl and checkseccomp.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-21 10:28:10 -04:00
Mrunal Patel
7b69d43198 Merge pull request #675 from 14rcole/sandbox-package
Move sandbox into its own package
2017-07-21 07:18:00 -07:00
Mrunal Patel
0e17bf4659 Merge pull request #648 from 14rcole/kpod-inspect
Implement `kpod inspect`
2017-07-21 07:12:08 -07:00
Mrunal Patel
b28b297d8e Merge pull request #680 from nalind/vfs-over-aufs
Force use of the "vfs" driver when testing on AUFS
2017-07-21 07:06:29 -07:00
Mrunal Patel
3a66d70632 Merge pull request #681 from nalind/apparmor-ci
Fix integration tests on systems with apparmor
2017-07-21 07:04:35 -07:00
CuiHaozhi
13fd708f04 crioctl ctr stop: enable timeout input
Signed-off-by: CuiHaozhi <cuihz@wise2c.com>
2017-07-21 09:48:22 -04:00
Ryan Cole
d50dba979e Move sandbox into its own package
If sandbox is in the same package as server, there will be a circular dependency when
kpod create is implemented

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-21 08:15:55 -04:00
Ryan Cole
0d4305a261 Implement kpod inspect
kpod inspect allows the user to view low-level information about
containers and images

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-21 08:11:27 -04:00
Nalin Dahyabhai
d1099a6cc5 Fix integration tests on systems with apparmor
When the integration test image is run on a system with apparmor
enabled, it needs binaries from the 'apparmor' package, so ensure that
it's always there.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-20 17:32:18 -04:00
Nalin Dahyabhai
4ebcd650e0 Force use of the "vfs" driver when testing on AUFS
Basically none of the clever storage drivers will work when we're on top
of AUFS, so if we find ourselves in that situation when running tests,
default to storage options of "--storage-driver vfs".

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-20 17:29:38 -04:00
Mrunal Patel
3b295967f1 Merge pull request #636 from 14rcole/kpod-push
Add `kpod push` command
2017-07-20 12:44:21 -07:00
Ryan Cole
680f7a6106 Add kpod push command
Push an image to a specified location, such as to an atomic registry
or a local directory

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-20 11:12:40 -04:00
Antonio Murdaca
ab1fef9e1f Merge pull request #667 from 14rcole/containerserver-state
move container state to libkpod
2017-07-20 16:42:31 +02:00
Antonio Murdaca
f8f9488e02 Merge pull request #673 from mrunalp/runtime_spec_v1
Update to OCI runtime spec v1.0.0
2017-07-20 14:33:01 +02:00
Ryan Cole
bd540ac94c Separate container state from sandbox state in server
Move container state data to libkpod, separate from the sandbox
data in server.  However, the move was structured such that sandbox
data could easily be moved over into libkpod in the future

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-20 08:18:55 -04:00
Mrunal Patel
4128bbd7dc Bump up runtime-spec dependency to v1.0.0
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-07-19 21:38:05 -07:00
Mrunal Patel
0eb5cd527f Merge pull request #672 from 14rcole/find-godeps-fix
Fix bug in find-godeps
2017-07-19 16:15:52 -07:00
Mrunal Patel
a7c1745aa2 Merge pull request #643 from umohnani8/kpod_history
Add 'kpod history' command
2017-07-19 16:15:28 -07:00
Ryan Cole
1c820fb06f Fix bug in find-godeps
go list {{.Imports}} outputs imports as an array, and the leading
and trailing square brackets can get caught in the name of a package.
Add a pipe in the dependency command to remove the brackets

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-19 16:49:22 -04:00
Mrunal Patel
115fea46cf Merge pull request #670 from sak0/dev
kpod images --digests output align
2017-07-19 12:42:57 -07:00
Mrunal Patel
093660ea68 Merge pull request #669 from 14rcole/sandbox-public
Refactor server sandbox
2017-07-19 12:42:13 -07:00
umohnani8
ad490708a4 Add 'kpod history' command
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-07-19 15:11:25 -04:00
Mrunal Patel
b4973e1006 Merge pull request #655 from rhatdan/cri-o
We need to support the name cri-o and crio for rpm and systemd
2017-07-19 10:18:44 -07:00
Ryan Cole
3ddf2efae2 Refactor server sandbox
Make sandbox struct and it methods public, and add accessor methods
for the struct fields

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-19 08:53:45 -04:00
Daniel J Walsh
23c66c7bdf We need to support the name cri-o and crio for rpm and systemd
Adding these aliases will make it easier for users who forget to
use crio or cri-o.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-07-19 07:29:36 -04:00
Antonio Murdaca
a82cc428a9 Merge pull request #664 from 14rcole/libkpod-containerserver
Decouple kubernetes-dependent and non-dependent parts of server
2017-07-19 13:29:26 +02:00
CuiHaozhi
8c3950ad6d kpod images --digests output align
Signed-off-by: CuiHaozhi <cuihz@wise2c.com>
2017-07-18 23:07:29 -04:00
Ryan Cole
64ad902480 Decouple kubernetes-dependent an non-dependent parts of server
Move non-kubernetes-dependent portions of server struct to libkpod.
So far, only the struct fields have been moved and not their dependent
functions

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-18 14:23:50 -04:00
Mrunal Patel
2b18d58d60 Merge pull request #666 from tklauser/seccomp-x-sys-unix
Use Prctl() and associated constants from x/sys/unix
2017-07-18 09:58:40 -07:00
Antonio Murdaca
4d6ff0b414 Merge pull request #665 from 14rcole/imagespec-removal
Remove ImageSpec dependency from server
2017-07-18 16:54:11 +02:00
Tobias Klauser
92a51af7ba seccomp: use Prctl() from x/sys/unix
Use unix.Prctl() instead of manually reimplementing it using
unix.RawSyscall. Also use unix.SECCOMP_MODE_FILTER instead of locally
defining it.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-07-18 15:34:23 +02:00
Tobias Klauser
642f2bb70e vendor: update golang.org/x/sys
Update golang.org/x/sys to get newly added functions and constants which
will be used in successive commits.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-07-18 15:31:00 +02:00
Antonio Murdaca
e659280298 Merge pull request #652 from vbatts/kpod_info
kpod: info subcommand
2017-07-18 09:58:49 +02:00
Ryan Cole
f3efb850b7 Remove ImageSpec dependency from server
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-17 16:21:56 -04:00
ab36ad50be
kpod: info subcommand
Design: The output of the `info` subcommand ought to be directly
consumable in a format like JSON or yaml.
The structure being a map of sorts.

Each subsection of information being an individual cluster under the
top-level, like platform info, debug, storage, etc.

Even if there are errors under the top level key, the value will be a
map with the key of "error" and the value as the message of the
`err.Error()`. In this way, the command always returns usable output.

Ideally there will be a means for anything that can register info to do
so independently from it being in the single info.go, so this approach
is having a typed signature for the function that gives info, but i'm
sure it could be better.

Current iteration of this outputs the following as a limited user:

```yaml
host:
  MemFree: 711307264
  MemTotal: 2096222208
  SwapFree: 2147479552
  SwapTotal: 2147479552
  arch: amd64
  cpus: 1
  os: linux
store:
  error: 'mkdir /var/run/containers/storage: permission denied'

```

and as root (`sudo kpod info -D`):

```yaml
debug:
  compiler: gc
  go version: go1.7.6
  goroutines: 3
host:
  MemFree: 717795328
  MemTotal: 2096222208
  SwapFree: 2147479552
  SwapTotal: 2147479552
  arch: amd64
  cpus: 1
  os: linux
store:
  ContainerStore:
    number: 1
  GraphDriverName: overlay2
  GraphRoot: /var/lib/containers/storage
  ImageStore:
    number: 1
```

And with the `--json --debug` flag:

```json
{
  "debug": {
    "compiler": "gc",
    "go version": "go1.7.6",
    "goroutines": 3
  },
  "host": {
    "MemFree": 709402624,
    "MemTotal": 2096222208,
    "SwapFree": 2147479552,
    "SwapTotal": 2147479552,
    "arch": "amd64",
    "cpus": 1,
    "os": "linux"
  },
  "store": {
    "ContainerStore": {
      "number": 1
    },
    "GraphDriverName": "overlay2",
    "GraphRoot": "/var/lib/containers/storage",
    "ImageStore": {
      "number": 1
    }
  }
}
```

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-07-17 14:23:53 -04:00
Mrunal Patel
3f70873aab Merge pull request #662 from rhatdan/master
Make the README.md more useful in links to man page documentation
2017-07-17 11:03:34 -07:00
Mrunal Patel
2fcc6d574b Merge pull request #663 from runcom/fix-arch-goos
oci: fix type mismatch on some platform/arch
2017-07-17 09:55:22 -07:00
Daniel J Walsh
d43e67ad00 Make the README.md more useful in links to man page documentation
This patch will allow people who go to the github page to easily read
man pages.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-07-17 16:52:14 +00:00
Antonio Murdaca
47ea873253
oci: fix type mismatch on some platform/arch
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-07-17 15:31:19 +02:00
Mrunal Patel
db310e9641 Merge pull request #661 from rhatdan/launch
Remove kpod launch example code
2017-07-15 06:30:30 -07:00
Daniel J Walsh
0bd5f6cebc Remove kpod launch example code
We now have actual kpod code, so no reason to have a not implemented feature.
Especially when we don't intend to create kpod launch.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-07-15 06:54:41 -04:00
Antonio Murdaca
73c5285260 Merge pull request #658 from mheon/lock_to_interface
Replace sync.Mutex with sync.Locker to allow different locks
2017-07-15 10:48:12 +02:00
Antonio Murdaca
f16113a627 Merge pull request #660 from mrunalp/volumes_bind
Add ImagesVolumesBind option
2017-07-15 10:47:10 +02:00
Mrunal Patel
fa5a3a04e0 test: Add a test for image volumes bind mount option
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-07-14 16:57:38 -07:00
Mrunal Patel
d02828e8a6 Support ImageVolumesBind when container is created
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-07-14 16:51:52 -07:00
Mrunal Patel
7443263bd6 Add config for ImageVolumesBind option
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-07-14 15:31:50 -07:00
Matthew Heon
a3c95bf903 Change opLock mutex for containers to sync.Locker
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-07-14 17:09:08 -04:00
Matthew Heon
4086f2bc37 Replace sync.Mutex with sync.Locker to allow different locks
Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-07-14 16:27:12 -04:00
Mrunal Patel
96ebf829c9 Merge pull request #656 from 14rcole/vendor-image
Update vendor for containers/image
2017-07-14 07:19:14 -07:00
Ryan Cole
f15c13efac Update vendor for containers/image
Update the vendored commit for containers/image, because the previous
version did not include the function ListNames() in transports

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-14 09:39:13 -04:00
Antonio Murdaca
fa25b381b1 Merge pull request #649 from umohnani8/main
Remove repeated app.Flags in cmd/kpod/main.go
2017-07-12 20:28:51 +02:00
umohnani8
f9b9f92d3f Remove repeated app.Flags in cmd/kpod/main.go
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-07-12 11:59:45 -04:00
Antonio Murdaca
17584facf0 Merge pull request #641 from mrunalp/pids_limit
Pids limit
2017-07-12 12:39:54 +02:00
Antonio Murdaca
f7206aa86d Merge pull request #647 from mrunalp/rename_to_crio
Rename remnants of ocid to crio
2017-07-12 12:38:28 +02:00
Antonio Murdaca
dd53f5e6bb Merge pull request #635 from tklauser/syscall-to-x-sys-unix
all: Switch from package syscall to golang.org/x/sys/unix
2017-07-12 12:37:11 +02:00
Tobias Klauser
822172a892 all: Switch from package syscall to golang.org/x/sys/unix
The syscall package is locked down and the comment in [1] advises to
switch code to use the corresponding package from golang.org/x/sys. Do
so and replace usage of package syscall where possible (leave
syscall.SysProcAttr and syscall.Stat_t).

  [1] https://github.com/golang/go/blob/master/src/syscall/syscall.go#L21-L24

This will also allow to get updates and fixes just by re-vendoring
golang.org/x/sys/unix instead of having to update to a new go version.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-07-12 08:18:55 +02:00
Mrunal Patel
288415d31d test: Add test for pids limit
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-07-11 19:17:48 -07:00
Mrunal Patel
ed9d49f247 container: Add cgroup mount for introspection
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-07-11 19:17:48 -07:00
Mrunal Patel
c58bcc4ccf docs: Document pids limit for crio
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-07-11 19:17:41 -07:00
Mrunal Patel
c9edee9af2 Merge pull request #606 from 14rcole/kpod-image
Add 'kpod images' and 'kpod rmi' commands
2017-07-11 16:21:02 -07:00
Mrunal Patel
6b543be50b Rename remnants of ocid to crio
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-07-11 16:19:18 -07:00
Mrunal Patel
e49dd34657 Add support for container pids limit
We add a daemon level setting and will add a container
override once it is supported in CRI.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-07-11 14:59:52 -07:00
Ryan Cole
a040f20a76 Add 'kpod images' and 'kpod rmi' commands
'kpod images' lists all images on a system.  'kpod rmi' removes
one or more images from a system.  The images will not be removed
if they are associated with a running container, unless the -f
option is used

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-11 15:52:57 -04:00
Mrunal Patel
7fb772b7d1 Merge pull request #638 from umohnani8/kpod_pull
Add 'kpod pull' command
2017-07-11 12:23:01 -07:00
Mrunal Patel
d270de78c4 Merge pull request #645 from vbatts/kpod-version-failsafe
kpod: version should not fail
2017-07-11 07:30:15 -07:00
umohnani8
ac9b53266d Add 'kpod pull' command
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-07-11 09:05:17 -04:00
Mrunal Patel
e949508b17 Merge pull request #644 from umohnani8/man
Man pages were being created empty
2017-07-10 16:01:36 -07:00
Antonio Murdaca
6f75a27d96 Merge pull request #637 from mrunalp/image_volumes
Image volumes
2017-07-10 23:40:00 +02:00
umohnani8
26126085eb Man pages were being created empty
This patch causes the man pages to be created with the correct content.

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-07-10 17:20:42 -04:00
55d526e213
kpod: version should not fail
even when the variables are not provided at compile, the `kpod version`
command ought not fail.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-07-10 17:02:13 -04:00
Mrunal Patel
c85be90e1b docs: Document image volumes option in man pages
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-07-10 13:46:14 -07:00
Mrunal Patel
de1cb64ee8 test: Add a test for image volume ignore
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-07-10 13:46:14 -07:00
Mrunal Patel
d40883d88c container: Use ImageVolumes setting at container creation
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-07-10 13:46:14 -07:00
Mrunal Patel
dc55fd2f14 config: Add ImageVolumes configuration setting
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-07-10 13:46:14 -07:00
Mrunal Patel
59646cc520 Merge pull request #646 from mrunalp/fix_lint
lint: Use a fixed commit for gometalinter
2017-07-10 13:36:12 -07:00
Mrunal Patel
762f508d9c lint: Use a fixed commit for gometalinter
Pulling latest code breaks our lint when unstable code is merged
into gometalinter.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-07-10 13:06:57 -07:00
Mrunal Patel
e1c0508fec Merge pull request #633 from 14rcole/kpod-tag
Add `kpod tag` command
2017-07-06 12:16:13 -07:00
Ryan Cole
b84f064976 Add kpod tag command
Add one or more tags to an image

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
2017-07-06 10:10:51 -04:00
Antonio Murdaca
ea7045dfa8 Merge pull request #640 from mrunalp/test_with_cgroupfs
test: Use cgroupfs for tests
2017-07-06 16:06:42 +02:00
Mrunal Patel
0d0f651828 test: Use cgroupfs for tests
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-07-05 17:29:32 -07:00
Mrunal Patel
844c78ad81 Merge pull request #639 from apilloud/rlimit
server: containers inherit rlimits from server
2017-07-05 12:03:15 -07:00
Andrew Pilloud
1a01ca7251 server: inherit rlimits from server
Signed-off-by: Andrew Pilloud <andrewpilloud@igneoussystems.com>
2017-07-03 14:49:34 -07:00
Mrunal Patel
b9c1d58b36 Merge pull request #607 from umohnani8/master
Add version command to kpod
2017-06-30 13:38:20 -07:00
Mrunal Patel
39a5203a1d Merge pull request #634 from alexlarsson/conmon-no-numstdio-fds
conmon: Change how we detect container exit
2017-06-30 12:08:31 -07:00
Alexander Larsson
3cf86e25a8 fixup! conmon: Change how we detect container exit
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-29 23:20:12 +02:00
Alexander Larsson
c00f0dd848 conmon: Change how we detect container exit
Instead of waiting until stderr/out is closed and then waiting for
the container to exit we wait for the container to exit in the
gmainloop, in addition to everything else, exiting only when
the child dies.

We then drain any output in stderr/out after the child has exited.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-29 12:19:34 +02:00
umohnani8
9595d7900e Add kpod version
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-06-27 16:48:24 -04:00
Mrunal Patel
91977d3989 Merge pull request #632 from tklauser/rm-prctl
utils: remove unused Prctl wrapper
2017-06-27 07:22:01 -07:00
Tobias Klauser
5523e7d99d utils: remove unused Prctl wrapper
Remove the Prctl wrapper function which has been unused since commit
d2f6a4c0e2. If a prctl wrapper would be needed in the future,
golang.org/x/sys provides unix.Prctl which could be used instead.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-06-27 09:48:25 +02:00
Antonio Murdaca
f3f8b67b76 Merge pull request #626 from mrunalp/pod_infra_oom
sandbox: Adjust OOM score of infra container to a low value
2017-06-26 18:38:50 +02:00
Antonio Murdaca
d1850d9993 Merge pull request #629 from mrunalp/oci_id
oci: Use container ID as ID instead of container name
2017-06-25 13:14:26 +02:00
Mrunal Patel
510d7d97d4 Merge pull request #605 from apilloud/hostport
server: Add support for hostPorts
2017-06-24 10:28:28 -07:00
Mrunal Patel
67504a02d5 oci: Use container ID as ID instead of container name
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-24 08:31:41 -07:00
Mrunal Patel
328e50fb50 Merge pull request #630 from runcom/fix-insecure-reg-flag
cmd/crio: fix reading insecure-registry flags
2017-06-24 08:23:25 -07:00
Antonio Murdaca
78e2fd3d5e
cmd/crio: fix reading insecure-registry flags
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-24 13:16:45 +02:00
Antonio Murdaca
efb71ae74e Merge pull request #627 from mrunalp/crio_oom_score
contrib: Set the OOM Score Adjust of cri-o service to be low
2017-06-24 10:44:08 +02:00
Antonio Murdaca
da7ecdc7f8 Merge pull request #628 from mrunalp/annotation_id
container: Add containerID to annotations for the container
2017-06-24 10:43:03 +02:00
Antonio Murdaca
f88e5e677d Merge pull request #623 from sboeuf/fix_bats
test: Make sure to have a running container before calling into "exec"
2017-06-24 10:42:33 +02:00
Sebastien Boeuf
c66081eafa test: Make sure to have a running container before calling into "exec"
The test "ctr execsync std{out,err}" from ctr.bats works with runc,
but the semantics behind is wrong.

We should not be able to execute a new process on a container which
has not been previously started. That's why this patch adds a call
to start the container.

Moreover, we don't want to be able to execute a new process on a
container that has already returned because its workload is done.
For that reason, we need to force the container workload to be a
"sleep 10" to ensure it is still running when the call to "exec"
is issued.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2017-06-23 14:08:33 -07:00
Mrunal Patel
975347b874 container: Add containerID to annotations for the container
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-23 09:31:13 -07:00
Mrunal Patel
cb4c566fac sandbox: Adjust OOM score of infra container to a low value
This matches the current kube behavior. This will probably
be provided over the CRI at which point we won't have to
define a constant in cri-o code.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-23 09:24:53 -07:00
Mrunal Patel
c7dd594604 contrib: Set the OOM Score Adjust of cri-o service to be low
We don't want cri-o to be OOM killed easily.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-23 09:04:27 -07:00
Antonio Murdaca
033f6885c1 Merge pull request #625 from tklauser/patch-1
tutorial: fix Kubernetes CRI interface link
2017-06-23 17:02:04 +02:00
Tobias Klauser
0a5cc41663 tutorial: fix Kubernetes CRI interface link
The Kubernetes Container Runtime Interface document was moved to https://github.com/kubernetes/community/blob/master/contributors/design-proposals/container-runtime-interface-v1.md. Adjust the URL in tutorial.md accordingly.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-06-23 09:06:03 +02:00
Mrunal Patel
4d46ae6e1e Merge pull request #624 from rhatdan/vendor1
Vendor in latest opencontainers/runtime-tools
2017-06-22 17:00:45 -07:00
Andrew Pilloud
e4e982d78a test: hostport network test
Signed-off-by: Andrew Pilloud <andrewpilloud@igneoussystems.com>
2017-06-22 15:46:15 -07:00
Dan Walsh
a9a1b04510 Vendor in latest opencontainers/runtime-tools
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2017-06-22 13:32:30 -04:00
Mrunal Patel
7cb47aeb21 Merge pull request #622 from alexlarsson/conmon-cleanup
Conmon cleanup
2017-06-22 10:05:35 -07:00
Mrunal Patel
59820df8e1 Merge pull request #619 from mrunalp/tty_logging_check
test: Tighten the grep for logging with tty
2017-06-22 10:02:54 -07:00
Andrew Pilloud
afc731d3a6 testdata: Remove hostport from sandbox_config
Signed-off-by: Andrew Pilloud <andrewpilloud@igneoussystems.com>
2017-06-22 08:51:50 -07:00
Andrew Pilloud
17359e34a6 server: init iptables without kube
Signed-off-by: Andrew Pilloud <andrewpilloud@igneoussystems.com>
2017-06-22 08:51:50 -07:00
Andrew Pilloud
a0e15abf5e vendor: add hostport and deps
Signed-off-by: Andrew Pilloud <andrewpilloud@igneoussystems.com>
2017-06-22 08:51:50 -07:00
Andrew Pilloud
28cd8bde49 server: Hookup kubelet hostport
Signed-off-by: Andrew Pilloud <andrewpilloud@igneoussystems.com>
2017-06-22 08:51:50 -07:00
Mrunal Patel
91ea67a8ff Merge pull request #618 from runcom/standard-names
server: standardize on naming
2017-06-22 07:16:39 -07:00
Alexander Larsson
c39868ad55 conmon: Add fds to mainloop where they are created
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-22 16:09:27 +02:00
Alexander Larsson
7b91005b36 conmon: Rename global fd variables to longer names
Since these are global, its nice if they are a bit more descriptive.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-22 16:09:27 +02:00
Alexander Larsson
4cb4de6cda conmon: Move OOM setup to helper function
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-22 16:09:27 +02:00
Alexander Larsson
34b75c20c2 conmon: Move terminal control fifo setup to a helper function
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-22 16:09:27 +02:00
Alexander Larsson
640ebeafb3 conmon: Break out attach socket setup to helper function
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-22 16:09:27 +02:00
Alexander Larsson
cc3a1615fb conmon: Break out connection socket setup to a separate function
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-22 16:09:27 +02:00
Alexander Larsson
b269969216 conmon: Don't use fixed size string buffers
We build paths using g_build_filename and g_strdup_printf() instead
which means we don't have any arbitrary pathname lenght issue, and
the code becomes cleaner.

We also convert asprintf to g_strdup_printf so that we can use
the glib OOM checker instead of open coding it everywhere.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-22 16:09:27 +02:00
Alexander Larsson
a7c61e4f9f conmon: Remove unused variables
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-22 16:09:27 +02:00
Alexander Larsson
215ef485df conmon: Add add_argv() helper
This makes adding the arguments to runtime_argv somewhat nicer.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-22 16:09:27 +02:00
Alexander Larsson
6aa1075ab6 conmon: Add (and use) get_pipe_fd_from_env helper
This avoids duplicating this code in two places.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-22 16:09:27 +02:00
Alexander Larsson
4838d6eb80 conmon: Rename all commandline option variables opt_*
This makes it easier to figure out where they come from

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-22 16:09:27 +02:00
Mrunal Patel
791d646695 Merge pull request #620 from alexlarsson/conmon-cleanup-exitsync
conmon: Clean up execsync
2017-06-22 07:07:37 -07:00
Antonio Murdaca
6035cff9e4
server: standardize on naming
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-22 11:55:03 +02:00
Alexander Larsson
81cb788004 conmon: Clean up execsync
This moves the timeout handling from the go code to conmon, whic
removes some of the complexity from criod, and additionally it will
makes it possible to do the double-fork in the exec case too.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-21 21:03:17 +02:00
Mrunal Patel
db337699f2 test: Tighten the grep for logging with tty
This tests that our ONLCR takes effect as we match \r\n
in the logs

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-21 10:10:16 -07:00
Antonio Murdaca
774c47d00c Merge pull request #615 from mrunalp/test_creation_failure
test: Ensure we get error messages back on creation failure
2017-06-21 11:34:23 +02:00
Antonio Murdaca
5dcbdc05e5 Merge pull request #613 from mrunalp/bump_1_alpha_0
version: Bump up version to 1.0.0-alpha.0
2017-06-21 00:36:24 +02:00
Mrunal Patel
3b3a2929e1 test: Ensure we get error messages back on creation failure
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-06-20 15:07:34 -07:00
Mrunal Patel
b82df188c6 version: Bump up version to 1.0.0-alpha.0
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-20 09:48:12 -07:00
Mrunal Patel
88037b143b Merge pull request #583 from alexlarsson/conmon-reap-zombies
conmon: Don't leave zombies and fix cgroup race
2017-06-20 07:53:52 -07:00
Alexander Larsson
d57ad7af3d RunUnderSystemdScope: Wait until scope is started before we return
We need to do this, because otherwise we will continue and exit the
pid before systemd has a chance to look at it.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-20 13:56:03 +02:00
Alexander Larsson
72686c78b4 fixup! conmon: Don't leave zombies and fix cgroup race
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-20 12:18:07 +02:00
Mrunal Patel
0413088ffb Merge pull request #612 from runcom/fixies-profiling
Fixies profiling + conflict run pod sandbox
2017-06-18 22:07:47 -07:00
Antonio Murdaca
94a457d46a
sandbox_run: need to stop sandbox before removing it on conflict
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-18 11:42:07 +02:00
Antonio Murdaca
20e11e3b90
cmd: crio: enable remote profiler
This patch also hides the profile under the debug flag as there's
runtime cost to enable the profiler.
This removes the old way of profiling (CPU) as that's not really
needed.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-18 11:42:04 +02:00
Antonio Murdaca
b01a7719cb Merge pull request #609 from mrunalp/minor_fixes
Add missing error checks and simplify bool check
2017-06-17 13:48:15 +02:00
Antonio Murdaca
5fc6a0098c Merge pull request #611 from mrunalp/fix_irc_channel
travis: Fix the IRC channel
2017-06-17 10:53:07 +02:00
Mrunal Patel
8fb98a7a73 travis: Fixup the IRC channel
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-16 16:27:03 -07:00
Mrunal Patel
bd40bbc30b Add missing error checks and simplify bool check
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-16 15:49:16 -07:00
Mrunal Patel
784d03809e Merge pull request #530 from runcom/fix-mounts-leak
server: adhere to CRI for sandbox stop/remove
2017-06-16 15:10:41 -07:00
Mrunal Patel
d2aa49a87b Merge pull request #603 from runcom/test-calico
test: add a test for /etc/resolv.conf in rw/ro mode
2017-06-16 12:16:55 -07:00
Antonio Murdaca
8b4e3036ea
test: add a test for /etc/resolv.conf in rw/ro mode
This patch isn't adding a test for /etc/hosts as that requires host
network and we don't want to play with host's /etc/hosts when running
make localintegration on our laptops. That may change in the future
moving to some sort of in-container testing.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-16 11:01:12 +02:00
Antonio Murdaca
2014f0e14f Merge pull request #568 from mrunalp/fix_terminal_settings
conmon: Set ONLCR for console
2017-06-16 10:17:15 +02:00
Mrunal Patel
2212d34899 Merge pull request #598 from sameo/topic/cni
sandbox_remove: Do not error out when CNI tear down fails
2017-06-15 14:23:17 -07:00
Antonio Murdaca
9f68cb4507
server: adhere to CRI for sandbox stop/remove
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-15 23:08:30 +02:00
Mrunal Patel
5fb4c99884 Merge pull request #604 from runcom/kube-v1.6.5
vendor: update kube to v1.6.5
2017-06-15 12:07:16 -07:00
Mrunal Patel
2b8e3a0d0f Merge pull request #602 from runcom/busy-loop
oci: remove busy loop
2017-06-15 10:29:33 -07:00
Mrunal Patel
bfd1b83f51 conmon: Modify console terminal settings to match kube settings
We enable ONLCR on the console to match kube's terminal settings.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-15 07:54:12 -07:00
Antonio Murdaca
e36a2a4c83
vendor: update kube to v1.6.5
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-15 15:20:25 +02:00
Alexander Larsson
af4fbcd942 conmon: Don't leave zombies and fix cgroup race
Currently, when creating containers we never call Wait on the
conmon exec.Command, which means that the child hangs around
forever as a zombie after it dies.

However, instead of doing this waitpid() in the parent we instead
do a double-fork in conmon, to daemonize it. That makes a lot of
sense, as conmon really is not tied to the launcher, but needs
to outlive it if e.g. the cri-o daemon restarts.

However, this makes even more obvious a race condition which we
already have. When crio-d puts the conmon pid in a cgroup there
is a race where conmon could already have spawned a child, and
it would then not be part of the cgroup. In order to fix this
we add another synchronization pipe to conmon, which we block
on before we create any children. The parent then makes sure the
pid is in the cgroup before letting it continue.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-15 14:20:40 +02:00
Antonio Murdaca
b9f3435bf6 Merge pull request #555 from sameo/topic/workload-trust
oci: Support mixing trusted and untrusted workloads
2017-06-15 13:01:34 +02:00
Antonio Murdaca
9e6359b6f7
oci: remove busy loop
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-15 12:22:32 +02:00
Samuel Ortiz
4462480e54 sandbox: Check for trusted annotations
If we get a kubelet annotation about the sandbox trust level, we use it
to toggle our sandbox trust flag.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-06-15 10:04:41 +02:00
Samuel Ortiz
0e51bbb778 oci: Support mixing trusted and untrusted workloads
Container runtimes provide different levels of isolation, from kernel
namespaces to hardware virtualization. When starting a specific
container, one may want to decide which level of isolation to use
depending on how much we trust the container workload. Fully verified
and signed containers may not need the hardware isolation layer but e.g.
CI jobs pulling packages from many untrusted sources should probably not
run only on a kernel namespace isolation layer.

Here we allow CRI-O users to define a container runtime for trusted
containers and another one for untrusted containers, and also to define
a general, default trust level. This anticipates future kubelet
implementations that would be able to tag containers as trusted or
untrusted. When missing a kubelet hint, containers are trusted by
default.

A container becomes untrusted if we get a hint in that direction from
kubelet or if the default trust level is set to "untrusted" and the
container is not privileged. In both cases CRI-O will try to use the
untrusted container runtime. For any other cases, it will switch to the
trusted one.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-06-15 10:04:36 +02:00
Mrunal Patel
7b9032bac7 Merge pull request #579 from alexlarsson/non-terminal-attach
Implement non-terminal attach
2017-06-14 21:45:44 -07:00
Mrunal Patel
29f7cd44d8 Merge pull request #599 from runcom/fix-calico
Fix calico
2017-06-14 16:25:42 -07:00
Alexander Larsson
7bb957bf75 Implement non-terminal attach
We use a SOCK_SEQPACKET socket for the attach unix domain socket, which
means the kernel will ensure that the reading side only ever get the
data from one write operation. We use this for frameing, where the
first byte is the pipe that the next bytes are for. We have to make sure
that all reads from the socket are using at least the same size of buffer
as the write side, because otherwise the extra data in the message
will be dropped.

This also adds a stdin pipe for the container, similar to the ones we
use for stdout/err, because we need a way for an attached client
to write to stdin, even if not using a tty.

This fixes https://github.com/kubernetes-incubator/cri-o/issues/569

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-14 22:59:50 +02:00
Antonio Murdaca
00444753e7 Merge pull request #596 from mrunalp/ctr_create_debug
oci: Add debugs to print error message on create failure
2017-06-14 18:17:41 +02:00
Mrunal Patel
62c9caeb83 oci: Add debugs for container create failures
This makes it easier to debug container creation failures
by looking at cri-o logs.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-14 07:33:07 -07:00
Mrunal Patel
6a79d25e8c lint: Increase lint timeout to 600 seconds
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-14 07:32:37 -07:00
Antonio Murdaca
0dfec710f2
container_create: net files must be ro when rootfs is ro
we were blindly applying RO mount options but net addons like calico
modify those files.
This patch sets RO only when container's rootfs is RO, same behavior as
docker.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-14 15:31:34 +02:00
Antonio Murdaca
d2e1d559b7
container_create: just mkdir on image's volumes
tmpfs'es can override whatever there's on the container rootfs. We just
mkdir the volume as we're confident kube manages volumes in container.
We don't need any tmpfs nor any complex volume handling for now.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-14 15:31:31 +02:00
Samuel Ortiz
53ee423192 sandbox_remove: Do not error out when CNI tear down fails
We don't want to have lingering pods because of CNI failures.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-06-14 14:58:10 +02:00
Antonio Murdaca
de0013a2de Merge pull request #591 from mrunalp/readme_runc_version
readme: Fix the required version of runc
2017-06-14 14:46:55 +02:00
Mrunal Patel
066ced207f readme: Fixed the required version of runc
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-06-13 14:29:51 -07:00
Antonio Murdaca
e3170caa2e Merge pull request #593 from sameo/topic/cni
tutorial: Fix CNI plugins URL
2017-06-13 16:59:07 +02:00
Mrunal Patel
bca3f6262a Merge pull request #590 from apilloud/ipv6only
server: add --bind-address flag
2017-06-13 07:42:02 -07:00
Samuel Ortiz
9074d57439 tutorial: Fix CNI plugins URL
And make it clear that we're building the plugins and not only the core
library.

Fixes #592

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-06-13 16:12:07 +02:00
Andrew Pilloud
c77b5fbea8 Add stream-address and stream-port flags to crio
Signed-off-by: Andrew Pilloud <andrewpilloud@igneoussystems.com>
2017-06-12 16:12:36 -07:00
Antonio Murdaca
67306aff8f Merge pull request #588 from mrunalp/update_roadmap
readme: Update the roadmap to reflect current status
2017-06-13 00:23:47 +02:00
Mrunal Patel
b347a50fa4 Merge pull request #589 from sameo/topic/cni
contrib/cni: Fix README link
2017-06-12 14:59:02 -07:00
Samuel Ortiz
0fb682641b contrib/cni: Fix README link
The CNI plugins are now living in a repo of their own.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-06-12 23:14:35 +02:00
Mrunal Patel
0f4aeef288 readme: Update the roadmap to reflect current status
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-12 10:58:51 -07:00
Mrunal Patel
2a6db15113 Merge pull request #584 from runcom/start-failed
adjust status on container start failure
2017-06-12 07:26:22 -07:00
Antonio Murdaca
b211061016
copy using bytes pools
Vendor and use docker/pkg/pools.
pools are used to lower the number of memory allocations and reuse buffers when
processing large streams operations..

The use of pools.Copy avoids io.Copy's internal buffer allocation.
This commit replaces io.Copy with pools.Copy to avoid the allocation of
buffers in io.Copy.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-12 12:53:23 +02:00
Antonio Murdaca
0b2f6b5354
adjust status on container start failure
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-12 12:48:50 +02:00
Mrunal Patel
86a35a1c12 Merge pull request #581 from runcom/readme-irc
README.md: add communication paragraph
2017-06-09 14:52:48 -07:00
Mrunal Patel
b8130b6852 Merge pull request #582 from runcom/fix-logrus
sandbox_status: Infof->Debugf response
2017-06-09 14:18:00 -07:00
Antonio Murdaca
3f56193a15 Merge pull request #577 from runcom/insecure-regisrties
*: support insecure registries
2017-06-09 20:31:43 +02:00
Antonio Murdaca
b5a10084dc
README.md: add communication paragraph
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-09 17:47:13 +02:00
Mrunal Patel
aab6b4e51c Merge pull request #580 from sameo/topic/ocicni
ocicni: Handle create and write events
2017-06-09 07:54:30 -07:00
Antonio Murdaca
cfec2c4cf4
sandbox_run: correct a defer
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-09 13:57:45 +02:00
Antonio Murdaca
e28540ca90
sandbox_status: Infof->Debugf response
This was cluttering the logs on my clusters. The log should be just in
debug mode as we do for every request/response flow.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-09 13:04:33 +02:00
Antonio Murdaca
952ae0db1c Merge pull request #571 from alexlarsson/conmon-glib-mainloop
conmon: Use glib mainloop instead of epoll
2017-06-09 12:03:56 +02:00
Samuel Ortiz
b480336dd7 ocicni: Handle create and write events
By only handling create events, we are breaking plugins that don't
create and write atomically, like weave for example.
The Weave plugin creates the file first and later write to it. We are
missing the second part and never see the final CNI config file.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-06-09 10:19:26 +02:00
Antonio Murdaca
8b53fabcbd
*: support insecure registries
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-09 01:04:29 +02:00
Mrunal Patel
8441dca284 Merge pull request #574 from runcom/smarter-pull
image_pull: check image already pulled
2017-06-08 15:38:08 -07:00
Antonio Murdaca
77fc45e7bc Merge pull request #575 from runcom/unit-after-network-online
contrib: systemd: change After to network-online.target
2017-06-08 22:17:00 +02:00
Mrunal Patel
7cd0ab671d Merge pull request #572 from runcom/fix-processArgs
container_create: fix OCI processArgs assemblement
2017-06-08 11:41:43 -07:00
Alexander Larsson
fcac68bf27 conmon: Handle runc exiting before passing terminal fd
We don't want to block on accepting the terminal fd, because then
we can't detect if runc died before calling out to pass the terminal
fd. To handle this we spin the glib mainloop listening to both the
terminal accept fd and a child pid watch.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-08 19:29:52 +02:00
Alexander Larsson
4494d82cfe conmon: Use glib mainloop instead of epoll
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-08 16:21:20 +02:00
Antonio Murdaca
3b545abf12
image_pull: check image already pulled
This is an optimization of our image pull code path. It's basically
how docker handles pulls as well. Let's be smart and check the image in
pull code path as well.
This also matches docker behavior which first checks whether we're
allowed to actually pull an image before looking into local storage.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-08 15:03:27 +02:00
Antonio Murdaca
65d4ac8fc2
container_create: fix OCI processArgs assemblement
This patch fixes the following command:

kubectl run -i --tty centos --image=centos -- sh

The command above use to fail with:

/usr/bin/sh: /usr/bin/sh: cannot execute binary file

That's because we were wrongly assembling the OCI processArgs.

Thanks @alexlarsson for spotting this.

This patch basically replicates what docker does when merging container
config and image config. It also replicates how docker sets processArgs
for the OCI runtime.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-08 11:48:11 +02:00
Antonio Murdaca
6a0aab40cb
contrib: systemd: change After to network-online.target
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-08 01:25:37 +02:00
Mrunal Patel
86b6856faf Merge pull request #573 from rhatdan/manpage
Add missing options from man page
2017-06-07 14:55:50 -07:00
Daniel J Walsh
6fec37d708 Add missing options from man page
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-06-07 21:08:21 +00:00
Antonio Murdaca
45eee4caa8 Merge pull request #570 from mrunalp/detach
Detach
2017-06-07 19:46:21 +02:00
Antonio Murdaca
cb4c6004fc Merge pull request #564 from runcom/vndr-master
vendor: remove dep and use vndr
2017-06-07 10:24:59 +02:00
Mrunal Patel
d0486e542f Support detaching in CRI attach
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-06 20:49:54 -07:00
Mrunal Patel
6e53568d15 conmon: Close client on zero read from attach client
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-06 20:49:54 -07:00
Mrunal Patel
0b6f68479b utils: Add function to allow copying with detach
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-06 20:49:52 -07:00
Antonio Murdaca
148e72d81e
vendor: remove dep and use vndr
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-07 00:04:21 +02:00
Antonio Murdaca
16f44674a4
Makefile: exclude ./vendor from git-validation
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-07 00:04:15 +02:00
Mrunal Patel
7c56d20988 Merge pull request #567 from vbatts/tutorial
tutorial: pull the redis image first
2017-06-06 14:59:27 -07:00
Antonio Murdaca
3f7e8e9884 Merge pull request #546 from mrunalp/cri/attach
Attach
2017-06-06 22:43:06 +02:00
e63bace453
tutorial: pull the redis image first
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-06 16:00:36 -04:00
Mrunal Patel
8f5f7aa5e2 Add code to handle CRI attach
A goroutine is started to forward terminal resize requests
from the resize channel. Also, data is copied back/forth
between stdin, stdout, stderr streams and the attach socket
for the container.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-06 07:36:52 -07:00
Mrunal Patel
1a6825758c conmon: Add control fifo for terminal resize handling
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-06 07:36:52 -07:00
Mrunal Patel
065f12490c conmon: Add unix domain socket for attach
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-06 07:36:52 -07:00
Mrunal Patel
5c383d13d2 conmon: Add info/warn to syslog as well
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-06-06 07:36:52 -07:00
Mrunal Patel
fee5291495 Merge pull request #563 from rhatdan/master
Need to be consistent in out nameing of OCI
2017-06-05 18:09:52 -07:00
Dan Walsh
4c48e13619 Need to be consistent in out nameing of Oci.
It should always be captitalized.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2017-06-05 15:11:03 -04:00
Mrunal Patel
7f2a769f96 Merge pull request #559 from runcom/fix-net-tests-node-e2e-rhel
contrib: test: fix failing networking tests in RHEL
2017-06-04 15:31:00 -07:00
Antonio Murdaca
4369537d32
contrib: test: fix failing networking tests in RHEL
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-04 19:30:30 +02:00
Antonio Murdaca
8fa574325e Merge pull request #556 from sameo/topic/conmon-fix
conmon: Fix Ubuntu build failure
2017-06-03 23:27:08 +02:00
Mrunal Patel
34357ec7a4 Merge pull request #557 from runcom/streamserver-bindaddress
server: do not use localhost for streaming service
2017-06-03 11:01:43 -07:00
Antonio Murdaca
315c385371
server: do not use localhost for streaming service
The bug is silly if you have a master/node cluster where node is on a
different machine than the master.
The current behavior is to give our addresses like "0.0.0.0:10101". If
you run "kubectl exec ..." from another host, that's not going to work
since on a different host 0.0.0.0 resolves to localhost and kubectl
exec fails with:

error: unable to upgrade connection: 404 page not found

This patch fixes the above by giving our correct addresses for reaching
from outside.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-03 18:26:33 +02:00
Samuel Ortiz
23ca7307e4 conmon: Fix Ubuntu build failure
conmon.c fails to build on Ubuntu:

cc -std=c99 -Os -Wall -Wextra -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -c -o conmon.o conmon.c
In file included from /usr/include/fcntl.h:289:0,
                 from conmon.c:4:
In function ‘open’,
    inlined from ‘main’ at conmon.c:519:10:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:4: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
    __open_missing_mode ();
    ^
<builtin>: recipe for target 'conmon.o' failed
make[1]: *** [conmon.o] Error 1

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-06-03 01:37:24 +02:00
Antonio Murdaca
a8848bc028 Merge pull request #550 from sameo/topic/annotations
pkg/annotations: Export CRI-O annotations namespace
2017-06-02 23:06:47 +02:00
Antonio Murdaca
14983d1402 Merge pull request #553 from mrunalp/add_missing_include
Add missing include for writev
2017-06-02 23:06:18 +02:00
Mrunal Patel
5d9dcc8431 Add missing include for writev
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-06-02 10:29:50 -07:00
Mrunal Patel
6ff71d0f84 Merge pull request #552 from alexlarsson/conmon-fixes
Various fixes for conmon
2017-06-02 10:10:16 -07:00
Alexander Larsson
2507ba6453 Remove json-glib in the remaining places
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-02 16:18:27 +02:00
Alexander Larsson
f4b3e90141 conmon: Make console socket mode 0700
It doesn't make sense for other users to connect to this, so
lets make sure of this.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-02 16:11:26 +02:00
Alexander Larsson
f1b0f542e1 conmon: Silence uninitialized read compiler warning
This is not actually read uninitialized, its just that the compiler
can't detect this, but we initilize it anyway to silence the compiler.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-02 16:11:21 +02:00
Alexander Larsson
fe6f1f4786 conmon: Add -Os flag
This is what the other C code uses, and its nice to have as adding
any optimization flags enables a bunch of more warnings.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-02 16:11:15 +02:00
Alexander Larsson
1a168cb196 conmon: Drop json-glib dependency
json-glib is a fine library for parsing json. However, all we need
to do is generate some trivial json output, so it is not needed.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-02 16:11:10 +02:00
Alexander Larsson
f3408cbb5c conmon: Make all file descriptors CLOEXEC
We want to avoid inheriting these into the child. Doing so is both
confusing for the child, and a potential security issue if the
container has access to FDs that are from the outside of the
container.

Some of these are created after we fork for the child, so they
are not technically necessary. However, its best to do this as
we may change the code in the future and forget about this.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-02 16:11:06 +02:00
Alexander Larsson
829ec7f351 conmon: Build argv instead of commandline to spawn runtime
This means we don't have to spawn via a shell, but it also
means we do the right thing for any input that would have
needed to be escaped. For instance if the container name had
a $ in i, or even worse, a back-quote!

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-02 16:11:01 +02:00
Alexander Larsson
d2f09ef483 conmon: Increase buffer size
The buffer is used to read from the stderr/stdout stream, which
can easily be larger than 256 bytes. With a larger buffer we will
do fewer, larger reads, which is more efficient. And 8k more stack
size use is not really a problem.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-02 16:10:56 +02:00
Alexander Larsson
fe80f857ca conmon: Fix cgroup subsystem parsing
The code as is doesn't handle merged controllers.
For instance, I have this in my /proc/self/cgrous:

4:cpu,cpuacct:/user.slice/user-0.slice/session-4.scope

The current code fails to match "cpuacct" wit this line, and
additionally it just does a prefix match so if you were looking
for say "cpu", it would match this:

2:cpuset:/

I also removed some ninfo spew that didn't seem very useful.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-02 16:10:36 +02:00
Alexander Larsson
d34c5829f8 conmon: Write log in larger chunks
Rather than writing the logs with one write per line, use writev()
to write multiple lines in one call. Additionally, this avoids
using dprintf() when writing to the log, which is nice because that
doesn't correctly handle partial writes or ENOINTR.

This also changes set_k8s_timestamp to add the pipe to the reused
buffer so that we don't have to append it on each line.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-02 16:10:30 +02:00
Alexander Larsson
ae933d0d03 conmon: Handle EINTR and partial writes when writing
Any write could be interupted by EINTR if we get some kind of signal,
which means we could be either reporting a EINTR error or a partial
write (if some data was written). Its also generally good to handle
partial writes correctly, as they can happen e.g. when writing to
full pipes.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2017-06-02 16:09:48 +02:00
Samuel Ortiz
f15859c79f pkg/annotations: Export CRI-O annotations namespace
Some runtimes like Clear Containers need to interpret the CRI-O
annotations, to distinguish the infra container from the regular one.
Here we export those annotations and use a more standard dotted
namespace for them.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-06-01 23:45:44 +02:00
Mrunal Patel
36255b8663 Merge pull request #549 from runcom/stability-fixes
Stability fixes
2017-06-01 10:10:14 -07:00
Antonio Murdaca
f3650533f0
create src dir for bind mounts
match docker behavior for bind mounts

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-01 17:37:20 +02:00
Antonio Murdaca
a28ed75e12
sandbox_run: fix name releasing on error
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-01 17:37:20 +02:00
Antonio Murdaca
6fd1c8957c
RemovePodSandbox must be idempotent
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-01 17:37:20 +02:00
Antonio Murdaca
88fb9094d0
oci: do not error out on runtime state failure
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-01 17:37:17 +02:00
Antonio Murdaca
a37dd46654
*: stability fixes
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-01 15:42:01 +02:00
Mrunal Patel
b5153e08c5 Merge pull request #547 from sameo/topic/privileged-paths
container: Do not restrict path access for privileged containers
2017-05-30 21:38:57 -07:00
Samuel Ortiz
e23d986cf2 container: Do not restrict path access for privileged containers
Privileged containers should see and reach all host paths.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-05-31 02:06:47 +02:00
Mrunal Patel
42d2fa6576 Merge pull request #545 from runcom/fix-hostspecific-spec
server: container_create: make the spec hostspecific
2017-05-30 11:49:22 -07:00
Antonio Murdaca
089cb88f17
server: container_create: make the spec hostspecific
node-e2e tests were failing in RHEL because, if running a privileged
container, we get all capability in the spec. The spec generator wasn't
filtering caps based on actual host caps, it was just adding _everything_.
This patch makes spec generator host specific.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-30 18:30:26 +02:00
Mrunal Patel
90e3e7a632 Merge pull request #529 from runcom/k8s-node-e2e-RHEL
enable RHEL k8s node-e2e tests
2017-05-30 07:42:09 -07:00
Antonio Murdaca
cf037ce947
contrib: test: fix and enable RHEL k8s node-e2e tests
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-30 11:52:59 +02:00
Mrunal Patel
fa8d5c035a Merge pull request #544 from runcom/fix-panics
[e2e fix] server: add nil checks to not panic
2017-05-29 12:20:22 -07:00
Antonio Murdaca
404194c1fd
server: add nil checks to not panic
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-29 13:16:27 +02:00
Mrunal Patel
5ed79fb5cd Merge pull request #543 from runcom/fix-ctr-status-reasons
[e2e fix] server: correctly fill ctr termination reason
2017-05-28 18:03:54 -07:00
Antonio Murdaca
ad3a3fcd5a
server: properly format error
`containerdID` is overridden in `s.ctrIDIndex.Get()`, if the ctr is not
found it's overridden by an empty string making the error return
totally unusable.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-28 20:43:01 +02:00
Mrunal Patel
988f29fae8 Merge pull request #542 from runcom/port-forward-panic
[e2e fix] server: fix PortForward panic
2017-05-28 11:40:17 -07:00
Antonio Murdaca
bc8570d1de
test: use nginx:alpine when testing pull-by-digest
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-28 20:33:55 +02:00
Antonio Murdaca
b9336c74a3
server: correctly fill ctr termination reason
This patch fixes all port forwarding e2e tests. Those tests were
specifically looking for a termination reason to say that a given
container has finished running. CRI-O wasn't actually returning any
reason field for an exited container.

-> https://github.com/kubernetes/kubernetes/blob/master/test/e2e/portforward.go#L116
   -> https://github.com/kubernetes/kubernetes/blob/master/test/utils/conditions.go#L97

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-28 20:14:45 +02:00
Antonio Murdaca
1e9ef65345
server: fix PortForward panic
During "Port forwarding" e2e tests, the following panic happened:

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x64981d]

goroutine 52788 [running]:
panic(0x1830ee0, 0xc4200100c0)
        /usr/lib/golang/src/runtime/panic.go:500 +0x1a1
github.com/kubernetes-incubator/cri-o/oci.(*Runtime).UpdateStatus(0xc4202afc00,
0x0, 0x0, 0x0)
        /home/amurdaca/go/src/github.com/kubernetes-incubator/cri-o/oci/oci.go:549
+0x7d
github.com/kubernetes-incubator/cri-o/server.streamService.PortForward(0xc42026e000,
0x0, 0x0, 0x0, 0x0, 0xc420d9af40, 0x40, 0xc400000050, 0x7fe660659a28,
0xc4201cd0e0, ...)
```

The issue is `streamService.PortForward` assumed the first argument to
be the sandbox's infra container ID, thus trying to get it from memory
store using `.state.containers.Get`. Since that ID is of the sandbox
itself, it fails to get the container object from memory and panics in
`UpdateStatus`.

Fix it by looking for the sandbox's infra container ID starting from a
sandbox ID.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-28 18:22:46 +02:00
Mrunal Patel
cf4e5ee903 Merge pull request #539 from runcom/stop-signal-cc
server: store and use image's stop signal to stop containers
2017-05-27 08:43:36 -07:00
Antonio Murdaca
b4f1cee2a2
server: store and use image's stop signal to stop containers
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-27 10:21:04 +02:00
Antonio Murdaca
7c43d34a1b
contrib: test: redirect stderr to stdout
I don't want to see stuff like this anymore
https://aos-ci.s3.amazonaws.com/kubernetes-incubator/cri-o/crio-integration-tests-prs/360/fullresults.txt

It's basically missing the actual go build error because stdout gets
eaten somewhere by ansible I guess.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-27 10:20:54 +02:00
Mrunal Patel
961edb2719 Merge pull request #538 from runcom/fixies-test
fixes for tests and cleanup
2017-05-26 09:37:23 -07:00
Antonio Murdaca
aa9abdfe40
test: pull just once in integration tests
w/o this patch we were always pulling redis:alpine by digest in each
test.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 16:01:31 +02:00
Antonio Murdaca
21d8c2544c
.gitignore: do not ignore *.rej files
also do some cleanup

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:46:32 +02:00
Mrunal Patel
5749da7f5d Merge pull request #537 from runcom/fix-execsync
execsync: rewrite to fix a bug in conmon
2017-05-25 17:25:38 -07:00
Antonio Murdaca
b4251aebd8
execsync: rewrite to fix a bug in conmon
conmon has many flags that are parsed when it's executed, one of them
is "-c". During PR #510 where we vendor latest kube master code,
upstream has changed a test to call a "ctr execsync" with a command of
"sh -c commmand ...".
Turns out:

a) conmon has a "-c" flag which refers to the container name/id
b) the exec command has a "-c" flags but it's for "sh"

That leads to conmon parsing the second "-c" flags from the exec
command causing an error. The executed command looks like:

conmon -c [..other flags..] CONTAINERID -e sh -c echo hello world

This patch rewrites the exec sync code to not pass down to conmon the
exec command via command line. Rather, we're now creating an OCI runtime
process spec in a temp file, pass _the path_ down to conmon, and have
runc exec the command using "runc exec --process
/path/to/process-spec.json CONTAINERID". This is far better in which we
don't need to bother anymore about conflicts with flags in conmon.

Added and fixed some tests also.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-25 22:36:33 +02:00
Antonio Murdaca
26e90190fc Merge pull request #535 from mrunalp/oom_handling
OOM handling
2017-05-25 22:33:44 +02:00
Mrunal Patel
d06b2ff20f test: Add a test for container OOM
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-25 11:30:58 -07:00
Mrunal Patel
f64032483e test: Ensure image for testing oom is present
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-25 11:30:58 -07:00
Mrunal Patel
ea9a90abce Set Container Status Reason when OOM Killed
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-25 11:30:58 -07:00
Mrunal Patel
52b27da680 conmon: Disable OOM handling if cgroups not setup
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-25 11:30:58 -07:00
Mrunal Patel
7700a62347 conmon: Create oom file for container on OOM notification
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-25 11:30:58 -07:00
Mrunal Patel
46f6248e42 conmon: Add OOM eventfd to epoll monitoring list
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-25 11:30:58 -07:00
Mrunal Patel
ddb54bf614 conmon: Setup cgroups for container pid OOM notification
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-25 11:30:58 -07:00
Mrunal Patel
04ddb57ed7 conmon: Add helper function to get pid cgroup subsystem path
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-25 11:30:58 -07:00
Mrunal Patel
8e60251b29 conmon: Add helper for closing C stdlib FILEs
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-25 11:30:58 -07:00
Mrunal Patel
6a24e49b57 Merge pull request #536 from runcom/fix-cni-ci
Fix CI because of CNI repo move
2017-05-25 11:08:59 -07:00
Antonio Murdaca
f51b0a10c6
Dockerfile: move to containernetworking/plugins
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-25 18:13:53 +02:00
Antonio Murdaca
0472c33344
contrib: test: CNI plugins moved repo
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-25 18:13:15 +02:00
Mrunal Patel
bd6e8a5a20 Merge pull request #534 from runcom/volumes-workaround
server: workaround images with Config.Volumes
2017-05-22 10:59:44 -07:00
Mrunal Patel
774e98514f Merge pull request #532 from runcom/e2e-fixes-0
e2e fixes - part 0
2017-05-22 10:59:23 -07:00
Antonio Murdaca
02f3828283
server: workaround images with Config.Volumes
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-22 18:01:06 +02:00
Antonio Murdaca
5f53416611
server: sandbox_remove: add comment on sandbox not found empty response
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-22 16:38:10 +02:00
Antonio Murdaca
d099e3a988
server: container_status: we should return digested references in imageRef
currently blocked on
https://github.com/kubernetes-incubator/cri-o/issues/531

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-22 16:37:46 +02:00
Antonio Murdaca
22d055869d
server: container_status: return image name if available
If we create a container using the image ID like
771cd5947d5ea4bf8e8f4900dd357dbb67e7b16486c270f8274087d182d457c6, then
a call to container_status will return that same ID for the "Image"
field in ContainerStatusResponse.

This patch matches dockershim behavior and return the first tagged name
if available from the image store.

This is also needed to fix a failure in k8s e2d tests.

Reference:
https://github.com/kubernetes/kubernetes/pull/39298/files#diff-c7dd39479fd733354254e70845075db5R369
Reference:
67a5bf8454/test/e2e/framework/util.go (L1941)

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-22 16:37:46 +02:00
Antonio Murdaca
a0916b1044
server: sandbox_stop: ignore not found sandboxes
This patch matches dockershim behavior

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-22 16:37:39 +02:00
Mrunal Patel
fb83c7e619 Merge pull request #505 from runcom/restore-2
Fix restore
2017-05-19 08:39:28 -07:00
Antonio Murdaca
a19d60654e Merge pull request #526 from runcom/test-cgroup-manager
Test systemd cgroup manager
2017-05-19 11:49:59 +02:00
Antonio Murdaca
3318dac64b
test: exercise systemd cgroup_parent
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-19 00:18:40 +02:00
Mrunal Patel
29007b0a47 Merge pull request #525 from runcom/kubetests
contrib: test: enable k8s Conformance tests for Fedora
2017-05-18 14:34:13 -07:00
Antonio Murdaca
9b74e546ca
test: fix restore test
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 21:19:53 +02:00
Antonio Murdaca
22b922727b
test: add bad state restore test
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 21:19:53 +02:00
Antonio Murdaca
de96e54230
server: move StopAllSandboxes in sandbox_stop.go
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 21:19:52 +02:00
Antonio Murdaca
3b2e5aa5c2
add a note on server shutdown...
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 21:19:52 +02:00
Antonio Murdaca
f00edc2b2d
server: do not remove but stop sandboxes on shutdown
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 21:19:52 +02:00
Antonio Murdaca
4a8debe6c5
oci: do not serialize empty fields on disk
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 21:19:51 +02:00
Antonio Murdaca
6622feb480
server: still update status on container not found in runc
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 21:19:51 +02:00
Antonio Murdaca
358dac96d4
server: ignore runc not exist errors
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 21:19:50 +02:00
Antonio Murdaca
a41ca975c1
server: restore containers state from disk on startup
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 21:19:50 +02:00
Antonio Murdaca
da0b8a6157
server: store containers state on disk
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 21:19:50 +02:00
Antonio Murdaca
2ddc062bbe
oci: ignore non existing containers on delete
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 21:19:45 +02:00
Antonio Murdaca
3946692107
contrib: test: enable k8s Conformance tests
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 19:58:35 +02:00
Antonio Murdaca
fbc5e49a60
oci: save container's finished time
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 18:49:55 +02:00
Antonio Murdaca
790c6d891a
server: store creation in containers
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 18:49:54 +02:00
Antonio Murdaca
1f4a4742cb
oci: add container directory to Container struct
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 18:49:54 +02:00
Antonio Murdaca
3bd4811b3b
server: restore sandbox created time from disk
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 18:49:54 +02:00
Antonio Murdaca
59e3f98b6d
server: return sandbox's own created time
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 18:49:54 +02:00
Antonio Murdaca
80a789bce3
server: store sandbox creation time
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 18:49:54 +02:00
Antonio Murdaca
aeaca81280
contrib: test: run tests with systemd cgroup manager
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 17:49:49 +02:00
Antonio Murdaca
dac6b7ceb5
test: fix typo
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 17:47:43 +02:00
Antonio Murdaca
4dcf33581c
test: add CGROUP_MANAGER env to switch to systemd
default is still cgroupfs

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-18 17:39:49 +02:00
Antonio Murdaca
645622300a Merge pull request #524 from mrunalp/convert_cgroup_format
Convert cgroup format to what runc expects
2017-05-18 11:40:22 +02:00
Mrunal Patel
3fefcaa1dd Convert pod cgroupPath to runc format for systemd cgroup
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-17 17:46:53 -07:00
Mrunal Patel
d3bc6ab693 Add function to convert kube pod cgroup format to runc format
This is a slightly modified version of the function in k8s.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-17 17:45:57 -07:00
Mrunal Patel
0e2af44d72 Merge pull request #523 from runcom/up-c-storage
vendor: upgrade containers/storage
2017-05-17 13:44:16 -07:00
Antonio Murdaca
ecd0006e80
vendor: upgrade containers/storage
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-17 22:18:07 +02:00
Mrunal Patel
5addc8caf0 Merge pull request #522 from runcom/enable-centos-ci
contrib: test: fix CentOS CI
2017-05-17 09:48:28 -07:00
Antonio Murdaca
87ca182f5c
contrib: test: run CentOS tests with overlay2
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-17 18:05:07 +02:00
Antonio Murdaca
26a080ad88
contrib: test: tune stuff for CentOS CI
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-17 18:03:31 +02:00
Antonio Murdaca
725c159bea
test: testdata: get rid of memory limits
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-17 17:30:11 +02:00
Antonio Murdaca
80ad55405f
contrib: test: use upstream Golang to build on CentOS
Cause the one shipped in CentOS is way too old at this point

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-17 13:29:59 +02:00
Antonio Murdaca
c5098bb4a1 Merge pull request #521 from johnbieren/master
Update integration playbook to fix xunit compatibility
2017-05-16 21:52:59 +02:00
Johnny Bieren
ca963c9959 Update playbook so simply changingg xunit to true will function properly
Signed-off-by: Johnny Bieren <jbieren@redhat.com>
2017-05-16 15:11:54 -04:00
Mrunal Patel
7732f30505 Merge pull request #520 from runcom/integrate-jenkins-playbook
contrib: test: add jenkins playbook
2017-05-16 10:06:27 -07:00
Antonio Murdaca
bceba08666
README.md: fix deps
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-16 18:29:07 +02:00
Antonio Murdaca
8c45e7b120
contrib: test: add jenkins playbook
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-16 18:29:01 +02:00
Antonio Murdaca
aa3ef626f2 Merge pull request #518 from runcom/whitespaces
Makefile: enable git-validation dangling whitespace
2017-05-16 15:43:41 +02:00
Antonio Murdaca
7c75cb080f
Makefile: enable git-validation dangling whitespace
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-16 15:23:35 +02:00
Antonio Murdaca
1ca660e3b7 Merge pull request #512 from runcom/stop-timeout
server: honor container stop timeout from CRI
2017-05-16 10:06:47 +02:00
Antonio Murdaca
1cc5a27f38 Merge pull request #517 from mrunalp/rename_fixes
Fix remnants of ocid -> crio rename
2017-05-16 10:06:15 +02:00
Mrunal Patel
5e4809bdfe Fix remnants of ocid -> crio rename
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-15 15:05:58 -07:00
Antonio Murdaca
98ac911527 Merge pull request #508 from mrunalp/create_error
Capture errors from runtime create failures
2017-05-15 23:34:45 +02:00
Antonio Murdaca
b3683ab184
server: honor container stop timeout from CRI
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-15 22:56:31 +02:00
Mrunal Patel
0a0533cdfc Capture errors from runtime create failures
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-15 13:35:18 -07:00
Mrunal Patel
20e9aeb16f Merge pull request #516 from mheon/gitignore_update
Update gitignore to replace ocic with crioctl
2017-05-15 13:30:03 -07:00
Matthew Heon
d60d3b78ad Fix unit test to use crio/crioctl
The rename to crio missed this test, update it so tests pass

Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-05-15 16:03:05 -04:00
Matthew Heon
5b184aad27 Update gitignore to replace ocic with crioctl
Matches the rename that just got merged

Signed-off-by: Matthew Heon <mheon@redhat.com>
2017-05-15 14:46:42 -04:00
Mrunal Patel
7ea255fcea Merge pull request #495 from rhatdan/rename
Rename ocid to crio
2017-05-15 11:27:28 -07:00
Mrunal Patel
7465244d7d Merge pull request #507 from runcom/fix-caps-drop
vendor: bump oci/runtime-tools to fix caps drop
2017-05-12 10:41:20 -07:00
Antonio Murdaca
712df31f9c
Makefile: clean and rebuild binaries before testing
if you run `make localintegration` from a branch, switch to another and
re-run the command again, `ocid` won't get built again causing tests to
run with binaries from the old branch you switched from.
This patch makes sure we cleanup binaries and rebuild before running
tests.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-12 18:55:18 +02:00
Antonio Murdaca
9b48e83027
test: add caps drop test
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-12 18:20:34 +02:00
Antonio Murdaca
2d997859de
vendor: bump oci/runtime-tools to fix caps drop
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-12 18:20:23 +02:00
Mrunal Patel
c533e5e34b Merge pull request #506 from runcom/add-ro-and-masked-paths
server: add RO and masked paths on container creation
2017-05-12 07:10:02 -07:00
Dan Walsh
4493b6f176 Rename ocid to crio.
The ocid project was renamed to CRI-O, months ago, it is time that we moved
all of the code to the new name.  We want to elminate the name ocid from use.
Move fully to crio.

Also cric is being renamed to crioctl for the time being.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
2017-05-12 09:56:06 -04:00
Antonio Murdaca
1d455a31a9
server: add RO and masked paths on container creation
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-12 12:47:40 +02:00
Antonio Murdaca
81cfba283a Merge pull request #502 from mrunalp/device_support
Device support
2017-05-11 10:22:53 +02:00
Mrunal Patel
d3c7a24896 bats: Add a test for adding device to a container
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-10 13:36:51 -07:00
Mrunal Patel
4a02418c82 Add a test config for device
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-10 13:36:33 -07:00
Mrunal Patel
23cf1a6fdb Add devices to OCI config
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-09 14:37:01 -07:00
Mrunal Patel
f7e5e24a05 Add helper for adding devices to OCI spec
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-09 14:36:55 -07:00
Mrunal Patel
5d1a9cb1c9 Merge pull request #501 from runcom/kubeName-annotation
server: store kubeName in annotations
2017-05-08 10:06:47 -07:00
Antonio Murdaca
b7ba9d058b
server: store kubeName in annotations
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-08 09:15:00 +02:00
Mrunal Patel
88b8a9efe1 Merge pull request #489 from dcbw/fix-pod-namespace-name-id
sandbox: pass correct pod Namespace/Name to network plugins and fix id/name ordering
2017-05-06 09:17:19 -07:00
Dan Williams
13f6e95685 sandbox: pass correct pod Namespace/Name to network plugins and fix id/name ordering
Two issues:
1) pod Namespace was always set to "", which prevents plugins from figuring out
what the actual pod is, and from getting more info about that pod from the
runtime via out-of-band mechanisms

2) the pod Name and ID arguments were switched, further preventing #1

Signed-off-by: Dan Williams <dcbw@redhat.com>
2017-05-05 23:55:37 -05:00
Antonio Murdaca
cf0afef675 Merge pull request #496 from mrunalp/fix_make_docs_offline
makefile: Look for go-md2man in system path first
2017-05-06 00:28:00 +02:00
Mrunal Patel
b71bcd65af makefile: Look for go-md2man in system path first
In build environments such as koji, there is no access to download
and install go packages so we should look for go-md2man in system
path first.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-05 15:01:37 -07:00
Mrunal Patel
2da250d652 Merge pull request #491 from runcom/fix-caps-set
server: fix set caps on container create
2017-05-05 11:32:35 -07:00
Antonio Murdaca
139b16bac2
server: fix set caps on container create
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-05 16:31:52 +02:00
Antonio Murdaca
715785950c
test: use redis:alpine
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-05 16:31:48 +02:00
Mrunal Patel
d3fe735fc0 Merge pull request #486 from runcom/systemd-fix
contrib: systemd: fix ocid path
2017-05-04 07:38:20 -07:00
Antonio Murdaca
a73f39acf2
contrib: systemd: fix ocid path
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-03 23:25:12 +02:00
Mrunal Patel
7cbfccfac8 Merge pull request #485 from giannisalinetti/master
Updated paths on tutorial.md to reflect the Makefile install configuration.
2017-05-02 16:35:03 -07:00
Gianni Salinetti
7a7403ae0e Updated paths on tutorial.md to reflect the Makefile install configuration
Signed-off-by: Gianni Salinetti <gbsalinetti@extraordy.com>
2017-05-02 23:03:31 +02:00
18354 changed files with 460446 additions and 4713320 deletions

7
.github/CODEOWNERS vendored Normal file
View file

@ -0,0 +1,7 @@
# GitHub code owners
# See https://help.github.com/articles/about-codeowners/
#
# KEEP THIS FILE SORTED. Order is important. Last match takes precedence.
* @mrunalp @runcom
pkg/storage/** @nalind @runcom @rhatdan

58
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,58 @@
<!--
If you are reporting a new issue, make sure that we do not have any duplicates
already open. You can ensure this by searching the issue list for this
repository. If there is a duplicate, please close your issue and add a comment
to the existing issue instead.
If you suspect your issue is a bug, please edit your issue description to
include the BUG REPORT INFORMATION shown below. If you fail to provide this
information within 7 days, we cannot debug your issue and will close it. We
will, however, reopen it if you later provide the information.
For more information about reporting issues, see
https://github.com/kubernetes-incubator/cri-o/blob/master/CONTRIBUTING.md#reporting-issues
---------------------------------------------------
GENERAL SUPPORT INFORMATION
---------------------------------------------------
The GitHub issue tracker is for bug reports and feature requests.
General support for **CRI-O** can be found at the following locations:
- IRC - #cri-o channel on irc.freenode.org
- Slack - kubernetes.slack.com #sig-node channel
- Post a question on StackOverflow, using the CRI-O tag
---------------------------------------------------
BUG REPORT INFORMATION
---------------------------------------------------
Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST
-->
**Description**
<!--
Briefly describe the problem you are having in a few paragraphs.
-->
**Steps to reproduce the issue:**
1.
2.
3.
**Describe the results you received:**
**Describe the results you expected:**
**Additional information you deem important (e.g. issue happens only occasionally):**
**Output of `crio --version`:**
```
(paste your output here)
```
**Additional environment details (AWS, VirtualBox, physical, etc.):**

23
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,23 @@
<!--
Please make sure you've read and understood our contributing guidelines;
https://github.com/kubernetes-incubator/cri-o/blob/master/CONTRIBUTING.md
** Make sure all your commits include a signature generated with `git commit -s` **
If this is a bug fix, make sure your description includes "fixes #xxxx", or
"closes #xxxx"
Please provide the following information:
-->
**- What I did**
**- How I did it**
**- How to verify it**
**- Description for the changelog**
<!--
Write a short (one line) summary that describes the changes in this
pull request for inclusion in the changelog:
-->

15
.gitignore vendored
View file

@ -1,19 +1,18 @@
/.artifacts/
/_output/
/conmon/conmon
/conmon/conmon.o
/docs/*.[158]
/docs/*.[158].gz
/kpod
/ocic
/ocid
/ocid.conf
/crio.conf
*.o
*.orig
/pause/pause
/pause/pause.o
*.rej
/bin/
/test/bin2img/bin2img
/test/checkseccomp/checkseccomp
/test/copyimg/copyimg
/test/testdata/redis-image
Vagrantfile
.vagrant/
.vscode/

10
.mailmap Normal file
View file

@ -0,0 +1,10 @@
Aleksa Sarai <asarai@suse.de> <asarai@suse.com>
Antonio Murdaca <runcom@redhat.com> <runcom@users.noreply.github.com>
CuiHaozhi <cuihaozhi@chinacloud.com.cn> <cuihz@wise2c.com>
Daniel J Walsh <dwalsh@redhat.com>
Haiyan Meng <hmeng@redhat.com> <haiyanalady@gmail.com>
Lorenzo Fontana <lo@linux.com> <fontanalorenz@gmail.com>
Mrunal Patel <mrunalp@gmail.com> <mpatel@redhat.com>
Mrunal Patel <mrunalp@gmail.com> <mrunal@me.com>
Pengfei Ni <feiskyer@gmail.com> <feiskyer@users.noreply.github.com>
Tobias Klauser <tklauser@distanz.ch> <tobias.klauser@gmail.com>

View file

@ -4,20 +4,41 @@ set -o errexit
set -o nounset
set -o pipefail
for d in $(find . -type d -not -iwholename '*.git*' -a -not -iname '.tool' -a -not -iwholename '*vendor*' -a -not -iwholename '*.artifacts*' -a -not -iwholename '*contrib*' -a -not -iwholename '*test*' -a -not -iwholename '*logo*' -a -not -iwholename '*conmon*' -a -not -iwholename '*completions*' -a -not -iwholename '*docs*' -a -not -iwholename '*pause*'); do
${GOPATH}/bin/gometalinter \
--exclude='error return value not checked.*(Close|Log|Print|RemoveAll).*\(errcheck\)$' \
--exclude='declaration of.*err.*shadows declaration.*\(vetshadow\)$' \
--exclude='.*_test\.go:.*error return value not checked.*\(errcheck\)$' \
--exclude='duplicate of.*_test.go.*\(dupl\)$' \
--exclude='cmd\/client\/.*\.go.*\(dupl\)$' \
--exclude='vendor\/.*' \
--exclude='server\/seccomp\/.*\.go.*$' \
--disable=aligncheck \
--disable=gotype \
--disable=gas \
--cyclo-over=80 \
--dupl-threshold=100 \
--tests \
--deadline=120s "${d}"
done
# Create the linter path for use later
LINTER=${GOPATH}/bin/gometalinter
# Make sure gometalinter is installed
if [ ! -f ${LINTER} ]; then
echo >&2 "gometalinter must be installed. Please run 'make install.tools' and try again"
exit 1
fi
PKGS=$(find . -type d -not -path . -a -not -iwholename '*.git*' -a -not -iname '.tool' -a -not -iwholename '*vendor*' -a -not -iname 'hack' -a -not -iwholename '*.artifacts*' -a -not -iwholename '*contrib*' -a -not -iwholename '*test*' -a -not -iwholename '*logo*' -a -not -iwholename '*conmon*' -a -not -iwholename '*completions*' -a -not -iwholename '*docs*' -a -not -iwholename '*pause*')
# Execute the linter
${LINTER} \
--concurrency=4\
--enable-gc\
--vendored-linters\
--deadline=600s --disable-all\
--enable=deadcode\
--enable=errcheck\
--enable=goconst\
--enable=gofmt\
--enable=golint\
--enable=ineffassign\
--enable=interfacer\
--enable=megacheck\
--enable=misspell\
--enable=structcheck\
--enable=varcheck\
--enable=vet\
--enable=vetshadow\
--exclude='error return value not checked.*\(errcheck\)$'\
--exclude='declaration of.*err.*shadows declaration.*\(vetshadow\)$'\
--exclude='.*_test\.go:.*error return value not checked.*\(errcheck\)$'\
--exclude='duplicate of.*_test.go.*\(dupl\)$'\
--exclude='cmd\/client\/.*\.go.*\(dupl\)$'\
--exclude='vendor\/.*'\
--exclude='server\/seccomp\/.*\.go.*$'\
${PKGS[@]}

View file

@ -1,9 +1,4 @@
language: go
go:
- 1.6.x
- 1.7.x
- 1.8.x
- tip
sudo: required
@ -13,20 +8,53 @@ services:
before_install:
- sudo apt-get -qq update
- sudo apt-get -qq install btrfs-tools libdevmapper-dev libgpgme11-dev libapparmor-dev libseccomp-dev
- sudo apt-get -qq install autoconf automake bison e2fslibs-dev libfuse-dev libtool liblzma-dev gettext
install:
- make install.tools
- OSTREE_VERSION=v2017.9
- git clone https://github.com/ostreedev/ostree ${TRAVIS_BUILD_DIR}/ostree
- pushd ${TRAVIS_BUILD_DIR}/ostree
- git checkout $OSTREE_VERSION
- ./autogen.sh --prefix=/usr/local
- make all
- sudo make install
- popd
before_script:
- export PATH=$HOME/gopath/bin:$PATH
- export LD_LIBRARY_PATH=/usr/local/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
script:
- make .gitvalidation
- make gofmt
- make lint
- make integration
- make docs
- make
jobs:
include:
- stage: Build and Verify
script:
- make .gitvalidation
- make gofmt
- make lint
- make testunit
- make docs
- make
go: 1.8.x
- stage: Build and Verify
script:
- make .gitvalidation
- make gofmt
- make lint
- make testunit
- make docs
- make
go: 1.9.x
- script:
- make .gitvalidation
- make testunit
- make docs
- make
go: tip
- stage: Integration Test
script:
- make integration
go: 1.8.x
notifications:
irc: "chat.freenode.net#ocid"
irc: "chat.freenode.net#cri-o"

142
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,142 @@
# Contributing to CRI-O
We'd love to have you join the community! Below summarizes the processes
that we follow.
## Topics
* [Reporting Issues](#reporting-issues)
* [Submitting Pull Requests](#submitting-pull-requests)
* [Communications](#communications)
* [Becoming a Maintainer](#becoming-a-maintainer)
## Reporting Issues
Before reporting an issue, check our backlog of
[open issues](https://github.com/kubernetes-incubator/cri-o/issues)
to see if someone else has already reported it. If so, feel free to add
your scenario, or additional information, to the discussion. Or simply
"subscribe" to it to be notified when it is updated.
If you find a new issue with the project we'd love to hear about it! The most
important aspect of a bug report is that it includes enough information for
us to reproduce it. So, please include as much detail as possible and try
to remove the extra stuff that doesn't really relate to the issue itself.
The easier it is for us to reproduce it, the faster it'll be fixed!
Please don't include any private/sensitive information in your issue!
## Submitting Pull Requests
No Pull Request (PR) is too small! Typos, additional comments in the code,
new testcases, bug fixes, new features, more documentation, ... it's all
welcome!
While bug fixes can first be identified via an "issue", that is not required.
It's ok to just open up a PR with the fix, but make sure you include the same
information you would have included in an issue - like how to reproduce it.
PRs for new features should include some background on what use cases the
new code is trying to address. When possible and when it makes sense, try to break-up
larger PRs into smaller ones - it's easier to review smaller
code changes. But only if those smaller ones make sense as stand-alone PRs.
Regardless of the type of PR, all PRs should include:
* well documented code changes
* additional testcases. Ideally, they should fail w/o your code change applied
* documentation changes
Squash your commits into logical pieces of work that might want to be reviewed
separate from the rest of the PRs. But, squashing down to just one commit is ok
too since in the end the entire PR will be reviewed anyway. When in doubt,
squash.
PRs that fix issues should include a reference like `Closes #XXXX` in the
commit message so that github will automatically close the referenced issue
when the PR is merged.
<!--
All PRs require at least two LGTMs (Looks Good To Me) from maintainers.
-->
### Sign your PRs
The sign-off is a line at the end of the explanation for the patch. Your
signature certifies that you wrote the patch or otherwise have the right to pass
it on as an open-source patch. The rules are simple: if you can certify
the below (from [developercertificate.org](http://developercertificate.org/)):
```
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
660 York Street, Suite 102,
San Francisco, CA 94110 USA
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
```
Then you just add a line to every git commit message:
Signed-off-by: Joe Smith <joe.smith@email.com>
Use your real name (sorry, no pseudonyms or anonymous contributions.)
If you set your `user.name` and `user.email` git configs, you can sign your
commit automatically with `git commit -s`.
## Communications
For general questions, or discussions, please use the
IRC group on `irc.freenode.net` called `cri-o`
that has been setup.
For discussions around issues/bugs and features, you can use the github
[issues](https://github.com/kubernetes-incubator/cri-o/issues)
and
[PRs](https://github.com/kubernetes-incubator/cri-o/pulls)
tracking system.
<!--
## Becoming a Maintainer
To become a maintainer you must first be nominated by an existing maintainer.
If a majority (>50%) of maintainers agree then the proposal is adopted and
you will be added to the list.
Removing a maintainer requires at least 75% of the remaining maintainers
approval, or if the person requests to be removed then it is automatic.
Normally, a maintainer will only be removed if they are considered to be
inactive for a long period of time or are viewed as disruptive to the community.
The current list of maintainers can be found in the
[MAINTAINERS](MAINTAINERS) file.
-->

View file

@ -1,20 +1,30 @@
FROM golang:1.7
FROM golang:1.8
# libseccomp in jessie is not _quite_ new enough -- need backports version
RUN echo 'deb http://httpredir.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/backports.list
RUN apt-get update && apt-get install -y \
apparmor \
autoconf \
automake \
bison \
build-essential \
curl \
e2fslibs-dev \
gawk \
gettext \
iptables \
pkg-config \
libaio-dev \
libcap-dev \
libfuse-dev \
libostree-dev \
libprotobuf-dev \
libprotobuf-c0-dev \
libseccomp2/jessie-backports \
libseccomp-dev/jessie-backports \
libtool \
libudev-dev \
protobuf-c-compiler \
protobuf-compiler \
python-minimal \
@ -24,7 +34,11 @@ RUN apt-get update && apt-get install -y \
libdevmapper1.02.1 \
libdevmapper-dev \
libgpgme11-dev \
liblzma-dev \
netcat \
socat \
--no-install-recommends \
bsdmainutils \
&& apt-get clean
# install bats
@ -43,7 +57,7 @@ RUN mkdir -p /usr/src/criu \
&& rm -rf /usr/src/criu
# Install runc
ENV RUNC_COMMIT v1.0.0-rc3
ENV RUNC_COMMIT c6e4a1ebeb1a72b529c6f1b6ee2b1ae5b868b14f
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \
@ -51,29 +65,54 @@ RUN set -x \
&& git fetch origin --tags \
&& git checkout -q "$RUNC_COMMIT" \
&& make static BUILDTAGS="seccomp selinux" \
&& cp runc /usr/local/bin/runc \
&& cp runc /usr/bin/runc \
&& rm -rf "$GOPATH"
# Install CNI plugins
ENV CNI_COMMIT d4bbce1865270cd2d2be558d6a23e63d314fe769
ENV CNI_COMMIT dcf7368eeab15e2affc6256f0bb1e84dd46a34de
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone https://github.com/containernetworking/cni.git "$GOPATH/src/github.com/containernetworking/cni" \
&& cd "$GOPATH/src/github.com/containernetworking/cni" \
&& git clone https://github.com/containernetworking/plugins.git "$GOPATH/src/github.com/containernetworking/plugins" \
&& cd "$GOPATH/src/github.com/containernetworking/plugins" \
&& git checkout -q "$CNI_COMMIT" \
&& ./build.sh \
&& mkdir -p /opt/cni/bin \
&& cp bin/* /opt/cni/bin/ \
&& rm -rf "$GOPATH"
# Install custom CNI bridge test plugin
# XXX: this plugin is meant to be a replacement for the old "test_plugin_args.bash"
# we need this in testing because sandbox_run now gather IP address and the mock
# plugin wasn't able to properly setup the net ns.
# The bridge is based on the same commit as the one above.
#ENV CNI_COMMIT 6bfe036c38c8e1410f1acaa4b2ee16f1851472e4
ENV CNI_TEST_BRANCH custom-bridge
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone https://github.com/runcom/plugins.git "$GOPATH/src/github.com/containernetworking/plugins" \
&& cd "$GOPATH/src/github.com/containernetworking/plugins" \
&& git checkout -q "$CNI_TEST_BRANCH" \
&& ./build.sh \
&& mkdir -p /opt/cni/bin \
&& cp bin/bridge /opt/cni/bin/bridge-custom \
&& rm -rf "$GOPATH"
# Install crictl
ENV CRICTL_COMMIT b42fc3f364dd48f649d55926c34492beeb9b2e99
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone https://github.com/kubernetes-incubator/cri-tools.git "$GOPATH/src/github.com/kubernetes-incubator/cri-tools" \
&& cd "$GOPATH/src/github.com/kubernetes-incubator/cri-tools" \
&& git checkout -q "$CRICTL_COMMIT" \
&& go install github.com/kubernetes-incubator/cri-tools/cmd/crictl \
&& cp "$GOPATH"/bin/crictl /usr/bin/ \
&& rm -rf "$GOPATH"
# Make sure we have some policy for pulling images
RUN mkdir -p /etc/containers
COPY test/policy.json /etc/containers/policy.json
COPY test/redhat_sigstore.yaml /etc/containers/registries.d/registry.access.redhat.com.yaml
WORKDIR /go/src/github.com/kubernetes-incubator/cri-o
ADD . /go/src/github.com/kubernetes-incubator/cri-o
RUN make copyimg \
&& mkdir -p .artifacts/redis-image \
&& ./test/copyimg/copyimg --import-from=docker://redis --export-to=dir:.artifacts/redis-image --signature-policy ./test/policy.json

154
Makefile
View file

@ -1,18 +1,28 @@
GO ?= go
EPOCH_TEST_COMMIT ?= 78aae688e2932f0cfc2a23e28ad30b58c6b8577f
EPOCH_TEST_COMMIT ?= 1cc5a27
PROJECT := github.com/kubernetes-incubator/cri-o
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g")
OCID_IMAGE := ocid_dev$(if $(GIT_BRANCH_CLEAN),:$(GIT_BRANCH_CLEAN))
OCID_INSTANCE := ocid_dev
CRIO_IMAGE := crio_dev$(if $(GIT_BRANCH_CLEAN),:$(GIT_BRANCH_CLEAN))
CRIO_INSTANCE := crio_dev
PREFIX ?= ${DESTDIR}/usr/local
BINDIR ?= ${PREFIX}/bin
LIBEXECDIR ?= ${PREFIX}/libexec
MANDIR ?= ${PREFIX}/share/man
ETCDIR ?= ${DESTDIR}/etc
ETCDIR_OCID ?= ${ETCDIR}/ocid
BUILDTAGS := selinux seccomp $(shell hack/btrfs_tag.sh) $(shell hack/libdm_tag.sh)
ETCDIR_CRIO ?= ${ETCDIR}/crio
BUILDTAGS ?= seccomp $(shell hack/btrfs_tag.sh) $(shell hack/libdm_installed.sh) $(shell hack/libdm_no_deferred_remove_tag.sh) $(shell hack/btrfs_installed_tag.sh) $(shell hack/ostree_tag.sh) $(shell hack/selinux_tag.sh)
CRICTL_CONFIG_DIR=${DESTDIR}/etc
BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions
OCIUMOUNTINSTALLDIR=$(PREFIX)/share/oci-umount/oci-umount.d
SELINUXOPT ?= $(shell test -x /usr/sbin/selinuxenabled && selinuxenabled && echo -Z)
PACKAGES ?= $(shell go list -tags "${BUILDTAGS}" ./... | grep -v github.com/kubernetes-incubator/cri-o/vendor)
COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true)
GIT_COMMIT := $(if $(shell git status --porcelain --untracked-files=no),"${COMMIT_NO}-dirty","${COMMIT_NO}")
BUILD_INFO := $(shell date +%s)
# If GOPATH not specified, use one in the local directory
ifeq ($(GOPATH),)
@ -24,8 +34,11 @@ GOPKGBASEDIR := $(shell dirname "$(GOPKGDIR)")
# Update VPATH so make finds .gopathok
VPATH := $(VPATH):$(GOPATH)
SHRINKFLAGS := -s -w
BASE_LDFLAGS := ${SHRINKFLAGS} -X main.gitCommit=${GIT_COMMIT} -X main.buildInfo=${BUILD_INFO}
LDFLAGS := -ldflags '${BASE_LDFLAGS}'
all: binaries ocid.conf docs
all: binaries crio.conf docs
default: help
@ -33,7 +46,7 @@ help:
@echo "Usage: make <target>"
@echo
@echo " * 'install' - Install binaries to system locations"
@echo " * 'binaries' - Build ocid, conmon and ocic"
@echo " * 'binaries' - Build crio, conmon and pause"
@echo " * 'integration' - Execute integration tests"
@echo " * 'clean' - Clean artifacts"
@echo " * 'lint' - Execute the source code linter"
@ -51,7 +64,8 @@ lint: .gopathok
@./.tool/lint
gofmt:
@./hack/verify-gofmt.sh
find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
git diff --exit-code
conmon:
$(MAKE) -C $@
@ -59,103 +73,97 @@ conmon:
pause:
$(MAKE) -C $@
bin2img: .gopathok $(wildcard test/bin2img/*.go)
go build -tags "$(BUILDTAGS)" -o test/bin2img/$@ $(PROJECT)/test/bin2img
test/bin2img/bin2img: .gopathok $(wildcard test/bin2img/*.go)
$(GO) build -i $(LDFLAGS) -tags "$(BUILDTAGS) containers_image_ostree_stub" -o $@ $(PROJECT)/test/bin2img
copyimg: .gopathok $(wildcard test/copyimg/*.go)
go build -tags "$(BUILDTAGS)" -o test/copyimg/$@ $(PROJECT)/test/copyimg
test/copyimg/copyimg: .gopathok $(wildcard test/copyimg/*.go)
$(GO) build -i $(LDFLAGS) -tags "$(BUILDTAGS) containers_image_ostree_stub" -o $@ $(PROJECT)/test/copyimg
checkseccomp: .gopathok $(wildcard test/checkseccomp/*.go)
go build -o test/checkseccomp/$@ $(PROJECT)/test/checkseccomp
test/checkseccomp/checkseccomp: .gopathok $(wildcard test/checkseccomp/*.go)
$(GO) build -i $(LDFLAGS) -tags "$(BUILDTAGS) containers_image_ostree_stub" -o $@ $(PROJECT)/test/checkseccomp
ocid: .gopathok $(shell hack/find-godeps.sh $(GOPKGDIR) cmd/ocid $(PROJECT))
$(GO) build -o $@ \
-tags "$(BUILDTAGS)" \
$(PROJECT)/cmd/ocid
crio: .gopathok $(shell hack/find-godeps.sh $(GOPKGDIR) cmd/crio $(PROJECT))
$(GO) build -i $(LDFLAGS) -tags "$(BUILDTAGS) containers_image_ostree_stub" -o bin/$@ $(PROJECT)/cmd/crio
ocic: .gopathok $(shell hack/find-godeps.sh $(GOPKGDIR) cmd/ocic $(PROJECT))
$(GO) build -o $@ $(PROJECT)/cmd/ocic
kpod: .gopathok $(shell hack/find-godeps.sh $(GOPKGDIR) cmd/kpod $(PROJECT))
$(GO) build -o $@ $(PROJECT)/cmd/kpod
ocid.conf: ocid
./ocid --config="" config --default > ocid.conf
crio.conf: crio
./bin/crio --config="" config --default > crio.conf
clean:
ifneq ($(GOPATH),)
rm -f "$(GOPATH)/.gopathok"
endif
rm -rf _output
rm -f docs/*.1 docs/*.5 docs/*.8
rm -f docs/*.5 docs/*.8
rm -fr test/testdata/redis-image
find . -name \*~ -delete
find . -name \#\* -delete
rm -f ocic ocid kpod
rm -f bin/crio
make -C conmon clean
make -C pause clean
rm -f test/bin2img/bin2img
rm -f test/copyimg/copyimg
rm -f test/checkseccomp/checkseccomp
ocidimage:
docker build -t ${OCID_IMAGE} .
crioimage:
docker build -t ${CRIO_IMAGE} .
dbuild: ocidimage
docker run --name=${OCID_INSTANCE} --privileged ${OCID_IMAGE} -v ${PWD}:/go/src/${PROJECT} --rm make binaries
dbuild: crioimage
docker run --name=${CRIO_INSTANCE} -e BUILDTAGS --privileged -v ${PWD}:/go/src/${PROJECT} --rm ${CRIO_IMAGE} make binaries
integration: ocidimage
docker run -e TESTFLAGS -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${OCID_IMAGE} make localintegration
integration: crioimage
docker run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${CRIO_IMAGE} make localintegration
localintegration: binaries
testunit:
$(GO) test -tags "$(BUILDTAGS)" -cover $(PACKAGES)
localintegration: clean binaries test-binaries
./test/test_runner.sh ${TESTFLAGS}
binaries: ocid ocic kpod conmon pause bin2img copyimg checkseccomp
binaries: crio conmon pause
test-binaries: test/bin2img/bin2img test/copyimg/copyimg test/checkseccomp/checkseccomp
MANPAGES_MD := $(wildcard docs/*.md)
MANPAGES := $(MANPAGES_MD:%.md=%)
docs/%.1: docs/%.1.md .gopathok
$(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@
docs/%.5: docs/%.5.md .gopathok
$(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@
(go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@) || ($(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@)
docs/%.8: docs/%.8.md .gopathok
$(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@
(go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@) || ($(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@)
docs: $(MANPAGES)
install: .gopathok
install -D -m 755 ocid $(BINDIR)/ocid
install -D -m 755 ocic $(BINDIR)/ocic
install -D -m 755 kpod $(BINDIR)/kpod
install -D -m 755 conmon/conmon $(LIBEXECDIR)/ocid/conmon
install -D -m 755 pause/pause $(LIBEXECDIR)/ocid/pause
install -d -m 755 $(MANDIR)/man1
install -d -m 755 $(MANDIR)/man5
install -d -m 755 $(MANDIR)/man8
install -m 644 $(filter %.1,$(MANPAGES)) -t $(MANDIR)/man1
install -m 644 $(filter %.5,$(MANPAGES)) -t $(MANDIR)/man5
install -m 644 $(filter %.8,$(MANPAGES)) -t $(MANDIR)/man8
install: .gopathok install.bin install.man
install.config:
install -D -m 644 ocid.conf $(ETCDIR_OCID)/ocid.conf
install -D -m 644 seccomp.json $(ETCDIR_OCID)/seccomp.json
install.bin:
install ${SELINUXOPT} -D -m 755 bin/crio $(BINDIR)/crio
install ${SELINUXOPT} -D -m 755 bin/conmon $(LIBEXECDIR)/crio/conmon
install ${SELINUXOPT} -D -m 755 bin/pause $(LIBEXECDIR)/crio/pause
install.man:
install ${SELINUXOPT} -d -m 755 $(MANDIR)/man5
install ${SELINUXOPT} -d -m 755 $(MANDIR)/man8
install ${SELINUXOPT} -m 644 $(filter %.5,$(MANPAGES)) -t $(MANDIR)/man5
install ${SELINUXOPT} -m 644 $(filter %.8,$(MANPAGES)) -t $(MANDIR)/man8
install.config: crio.conf
install ${SELINUXOPT} -D -m 644 crio.conf $(ETCDIR_CRIO)/crio.conf
install ${SELINUXOPT} -D -m 644 seccomp.json $(ETCDIR_CRIO)/seccomp.json
install ${SELINUXOPT} -D -m 644 crio-umount.conf $(OCIUMOUNTINSTALLDIR)/crio-umount.conf
install ${SELINUXOPT} -D -m 644 crictl.yaml $(CRICTL_CONFIG_DIR)
install.completions:
install -d -m 755 ${BASHINSTALLDIR}
install -m 644 -D completions/bash/kpod ${BASHINSTALLDIR}
install ${SELINUXOPT} -d -m 755 ${BASHINSTALLDIR}
install.systemd:
install -D -m 644 contrib/systemd/ocid.service $(PREFIX)/lib/systemd/system/ocid.service
install -D -m 644 contrib/systemd/ocid-shutdown.service $(PREFIX)/lib/systemd/system/ocid-shutdown.service
install ${SELINUXOPT} -D -m 644 contrib/systemd/crio.service $(PREFIX)/lib/systemd/system/crio.service
ln -sf crio.service $(PREFIX)/lib/systemd/system/cri-o.service
install ${SELINUXOPT} -D -m 644 contrib/systemd/crio-shutdown.service $(PREFIX)/lib/systemd/system/crio-shutdown.service
uninstall:
rm -f $(BINDIR)/ocid
rm -f $(BINDIR)/ocic
rm -f $(LIBEXECDIR)/ocid/conmon
rm -f $(LIBEXECDIR)/ocid/pause
rm -f $(BINDIR)/crio
rm -f $(LIBEXECDIR)/crio/conmon
rm -f $(LIBEXECDIR)/crio/pause
for i in $(filter %.1,$(MANPAGES)); do \
rm -f $(MANDIR)/man8/$$(basename $${i}); \
done
@ -170,9 +178,9 @@ uninstall:
# When this is running in travis, it will only check the travis commit range
.gitvalidation: .gopathok
ifeq ($(TRAVIS),true)
$(GOPATH)/bin/git-validation -q -run DCO,short-subject
GIT_CHECK_EXCLUDE="./vendor" $(GOPATH)/bin/git-validation -q -run DCO,short-subject,dangling-whitespace
else
$(GOPATH)/bin/git-validation -v -run DCO,short-subject -range $(EPOCH_TEST_COMMIT)..HEAD
GIT_CHECK_EXCLUDE="./vendor" $(GOPATH)/bin/git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..HEAD
endif
.PHONY: install.tools
@ -187,6 +195,9 @@ install.tools: .install.gitvalidation .install.gometalinter .install.md2man
.install.gometalinter: .gopathok
if [ ! -x "$(GOPATH)/bin/gometalinter" ]; then \
go get -u github.com/alecthomas/gometalinter; \
cd $(GOPATH)/src/github.com/alecthomas/gometalinter; \
git checkout 23261fa046586808612c61da7a81d75a658e0814; \
go install github.com/alecthomas/gometalinter; \
$(GOPATH)/bin/gometalinter --install; \
fi
@ -195,13 +206,18 @@ install.tools: .install.gitvalidation .install.gometalinter .install.md2man
go get -u github.com/cpuguy83/go-md2man; \
fi
.install.ostree: .gopathok
if ! pkg-config ostree-1 2> /dev/null ; then \
git clone https://github.com/ostreedev/ostree $(GOPATH)/src/github.com/ostreedev/ostree ; \
cd $(GOPATH)/src/github.com/ostreedev/ostree ; \
./autogen.sh --prefix=/usr/local; \
make all install; \
fi
.PHONY: \
bin2img \
binaries \
checkseccomp \
clean \
conmon \
copyimg \
default \
docs \
gofmt \

4
OWNERS
View file

@ -1,7 +1,9 @@
assignees:
approvers:
- mrunalp
- runcom
- cyphar
- mikebrow
- feiskyer
- sameo
- rhatdan
- nalind

123
README.md
View file

@ -1,18 +1,32 @@
![cri-o logo](https://cdn.rawgit.com/kubernetes-incubator/cri-o/master/logo/crio-logo.svg)
# cri-o - OCI-based implementation of Kubernetes Container Runtime Interface
![CRI-O logo](https://cdn.rawgit.com/kubernetes-incubator/cri-o/master/logo/crio-logo.svg)
# CRI-O - OCI-based implementation of Kubernetes Container Runtime Interface
[![Build Status](https://img.shields.io/travis/kubernetes-incubator/cri-o.svg?maxAge=2592000&style=flat-square)](https://travis-ci.org/kubernetes-incubator/cri-o)
[![Go Report Card](https://goreportcard.com/badge/github.com/kubernetes-incubator/cri-o?style=flat-square)](https://goreportcard.com/report/github.com/kubernetes-incubator/cri-o)
### Status: pre-alpha
### Status: Stable
## Compatibility matrix: CRI-O <-> Kubernetes clusters
| Version - Branch | Kubernetes branch/version | Maintenance status |
|----------------------------|-------------------------------|--------------------|
| CRI-O 1.0.x - release-1.0 | Kubernetes 1.7 branch, v1.7.x | = |
| CRI-O 1.8.x - release-1.8 | Kubernetes 1.8 branch, v1.8.x | = |
| CRI-O 1.9.x - release-1.9 | Kubernetes 1.9 branch, v1.9.x | = |
| CRI-O HEAD - master | Kubernetes master branch | ✓ |
Key:
* `✓` Changes in main Kubernetes repo about CRI are actively implemented in CRI-O
* `=` Maintenance is manual, only bugs will be patched.
## What is the scope of this project?
cri-o is meant to provide an integration path between OCI conformant runtimes and the kubelet.
Specifically, it implements the Kubelet Container Runtime Interface (CRI) using OCI conformant runtimes.
The scope of cri-o is tied to the scope of the CRI.
CRI-O is meant to provide an integration path between OCI conformant runtimes and the kubelet.
Specifically, it implements the Kubelet [Container Runtime Interface (CRI)](https://github.com/kubernetes/community/blob/master/contributors/devel/container-runtime-interface.md) using OCI conformant runtimes.
The scope of CRI-O is tied to the scope of the CRI.
At a high level, we expect the scope of cri-o to be restricted to the following functionalities:
At a high level, we expect the scope of CRI-O to be restricted to the following functionalities:
* Support multiple image formats including the existing Docker image format
* Support for multiple means to download images including trust & image verification
@ -24,7 +38,7 @@ At a high level, we expect the scope of cri-o to be restricted to the following
## What is not in scope for this project?
* Building, signing and pushing images to various image storages
* A CLI utility for interacting with cri-o. Any CLIs built as part of this project are only meant for testing this project and there will be no guarantees on the backwards compatibility with it.
* A CLI utility for interacting with CRI-O. Any CLIs built as part of this project are only meant for testing this project and there will be no guarantees on the backward compatibility with it.
This is an implementation of the Kubernetes Container Runtime Interface (CRI) that will allow Kubernetes to directly launch and manage Open Container Initiative (OCI) containers.
@ -36,13 +50,44 @@ The plan is to use OCI projects and best of breed libraries for different aspect
It is currently in active development in the Kubernetes community through the [design proposal](https://github.com/kubernetes/kubernetes/pull/26788). Questions and issues should be raised in the Kubernetes [sig-node Slack channel](https://kubernetes.slack.com/archives/sig-node).
## Commands
| Command | Description | Demo|
| ---------------------------------------------------- | --------------------------------------------------------------------------|-----|
| [crio(8)](/docs/crio.8.md) | OCI Kubernetes Container Runtime daemon ||
Note that kpod and its container management and debugging commands have moved to a separate repository, located [here](https://github.com/projectatomic/libpod).
## Configuration
| File | Description |
| ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| [crio.conf(5)](/docs/crio.conf.5.md) | CRI-O Configuation file |
## OCI Hooks Support
[CRI-O configures OCI Hooks to run when launching a container](./hooks.md)
## CRI-O Usage Transfer
[Useful information for ops and dev transfer as it relates to infrastructure that utilizes CRI-O](/transfer.md)
## 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 an IRC channel #CRI-O, on chat.freenode.net, that everyone is welcome to join and chat about development.
## Getting started
### Prerequisites
### Runtime dependencies
`runc` version 1.0.0.rc1 or greater is expected to be installed on the system. It is picked up as the default runtime by ocid.
- runc, Clear Containers runtime, or any other OCI compatible runtime
- socat
- iproute
- iptables
### Build Dependencies
Latest version of `runc` is expected to be installed on the system. It is picked up as the default runtime by CRI-O.
### Build and Run Dependencies
**Required**
@ -52,23 +97,30 @@ Fedora, CentOS, RHEL, and related distributions:
yum install -y \
btrfs-progs-devel \
device-mapper-devel \
git \
glib2-devel \
glibc-devel \
glibc-static \
go \
golang-github-cpuguy83-go-md2man \
gpgme-devel \
libassuan-devel \
libgpg-error-devel \
libseccomp-devel \
libselinux-devel \
ostree-devel \
pkgconfig \
runc
runc \
skopeo-containers
```
Debian, Ubuntu, and related distributions:
```bash
apt install -y \
apt-get install -y \
btrfs-tools \
git \
golang-go \
libassuan-dev \
libdevmapper-dev \
libglib2.0-dev \
@ -78,10 +130,18 @@ apt install -y \
libseccomp-dev \
libselinux1-dev \
pkg-config \
runc
go-md2man \
runc \
skopeo-containers
```
If using an older release or a long-term support release, be careful to double-check that the version of `runc` is new enough, or else build your own.
Debian, Ubuntu, and related distributions will also need a copy of the development libraries for `ostree`, either in the form of the `libostree-dev` package from the [flatpak](https://launchpad.net/~alexlarsson/+archive/ubuntu/flatpak) PPA, or built [from source](https://github.com/ostreedev/ostree) (more on that [here](https://ostree.readthedocs.io/en/latest/#building)).
If using an older release or a long-term support release, be careful to double-check that the version of `runc` is new enough (running `runc --version` should produce `spec: 1.0.0`), or else build your own.
**NOTE**
Be careful to double-check that the version of golang is new enough, version 1.8.x or higher is required. If needed, golang kits are avaliable at https://golang.org/dl/
**Optional**
@ -92,13 +152,13 @@ Fedora, CentOS, RHEL, and related distributions:
Debian, Ubuntu, and related distributions:
```bash
apt install -y \
apt-get install -y \
libapparmor-dev
```
### Get Source Code
As with other Go projects, cri-o must be cloned into a directory structure like:
As with other Go projects, CRI-O must be cloned into a directory structure like:
```
GOPATH
@ -132,7 +192,7 @@ make
sudo make install
```
Otherwise, if you do not want to build `cri-o` with seccomp support you can add `BUILDTAGS=""` when running make.
Otherwise, if you do not want to build `CRI-O` with seccomp support you can add `BUILDTAGS=""` when running make.
```bash
make BUILDTAGS=""
@ -141,7 +201,7 @@ sudo make install
#### Build Tags
`cri-o` supports optional build tags for compiling support of various features.
`CRI-O` supports optional build tags for compiling support of various features.
To add build tags to the make option the `BUILDTAGS` variable must be set.
```bash
@ -167,19 +227,26 @@ your system.
### Running with kubernetes
You can run a local version of kubernetes with cri-o using `local-up-cluster.sh`:
You can run a local version of kubernetes with CRI-O using `local-up-cluster.sh`:
1. Clone the [kubernetes repository](https://github.com/kubernetes/kubernetes)
1. Start the cri-o daemon (`ocid`)
1. From the kubernetes project directory, run: `CONTAINER_RUNTIME=remote CONTAINER_RUNTIME_ENDPOINT='/var/run/ocid.sock --runtime-request-timeout=15m' ./hack/local-up-cluster.sh`
1. Start the CRI-O daemon (`crio`)
1. From the kubernetes project directory, run:
```shell
CGROUP_DRIVER=systemd \
CONTAINER_RUNTIME=remote \
CONTAINER_RUNTIME_ENDPOINT='/var/run/crio/crio.sock --runtime-request-timeout=15m' \
./hack/local-up-cluster.sh
```
To run a full cluster, see [the instructions](kubernetes.md).
### Current Roadmap
1. Basic pod/container lifecycle, basic image pull (already works)
1. Support for tty handling and state management
1. Basic integration with kubelet once client side changes are ready
1. Support for log management, networking integration using CNI, pluggable image/storage management
1. Support for exec/attach
1. Target fully automated kubernetes testing without failures
1. Basic pod/container lifecycle, basic image pull (done)
1. Support for tty handling and state management (done)
1. Basic integration with kubelet once client side changes are ready (done)
1. Support for log management, networking integration using CNI, pluggable image/storage management (done)
1. Support for exec/attach (done)
1. Target fully automated kubernetes testing without failures [e2e status](https://github.com/kubernetes-incubator/cri-o/issues/533)
1. Track upstream k8s releases

103
client/client.go Normal file
View file

@ -0,0 +1,103 @@
package client
import (
"encoding/json"
"fmt"
"net"
"net/http"
"syscall"
"time"
"github.com/kubernetes-incubator/cri-o/types"
)
const (
maxUnixSocketPathSize = len(syscall.RawSockaddrUnix{}.Path)
)
// CrioClient is an interface to get information from crio daemon endpoint.
type CrioClient interface {
DaemonInfo() (types.CrioInfo, error)
ContainerInfo(string) (*types.ContainerInfo, error)
}
type crioClientImpl struct {
client *http.Client
crioSocketPath string
}
func configureUnixTransport(tr *http.Transport, proto, addr string) error {
if len(addr) > maxUnixSocketPathSize {
return fmt.Errorf("Unix socket path %q is too long", addr)
}
// No need for compression in local communications.
tr.DisableCompression = true
tr.Dial = func(_, _ string) (net.Conn, error) {
return net.DialTimeout(proto, addr, 32*time.Second)
}
return nil
}
// New returns a crio client
func New(crioSocketPath string) (CrioClient, error) {
tr := new(http.Transport)
configureUnixTransport(tr, "unix", crioSocketPath)
c := &http.Client{
Transport: tr,
}
return &crioClientImpl{
client: c,
crioSocketPath: crioSocketPath,
}, nil
}
func (c *crioClientImpl) getRequest(path string) (*http.Request, error) {
req, err := http.NewRequest("GET", path, nil)
if err != nil {
return nil, err
}
// For local communications over a unix socket, it doesn't matter what
// the host is. We just need a valid and meaningful host name.
req.Host = "crio"
req.URL.Host = c.crioSocketPath
req.URL.Scheme = "http"
return req, nil
}
// DaemonInfo return cri-o daemon info from the cri-o
// info endpoint.
func (c *crioClientImpl) DaemonInfo() (types.CrioInfo, error) {
info := types.CrioInfo{}
req, err := c.getRequest("/info")
if err != nil {
return info, err
}
resp, err := c.client.Do(req)
if err != nil {
return info, err
}
defer resp.Body.Close()
if err := json.NewDecoder(resp.Body).Decode(&info); err != nil {
return info, err
}
return info, nil
}
// ContainerInfo returns container info by querying
// the cri-o container endpoint.
func (c *crioClientImpl) ContainerInfo(id string) (*types.ContainerInfo, error) {
req, err := c.getRequest("/containers/" + id)
if err != nil {
return nil, err
}
resp, err := c.client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
cInfo := types.ContainerInfo{}
if err := json.NewDecoder(resp.Body).Decode(&cInfo); err != nil {
return nil, err
}
return &cInfo, nil
}

194
cmd/crio/config.go Normal file
View file

@ -0,0 +1,194 @@
package main
import (
"os"
"text/template"
"github.com/kubernetes-incubator/cri-o/server"
"github.com/urfave/cli"
)
var commentedConfigTemplate = template.Must(template.New("config").Parse(`
# The "crio" table contains all of the server options.
[crio]
# root is a path to the "root directory". CRIO stores all of its data,
# including container images, in this directory.
root = "{{ .Root }}"
# run is a path to the "run directory". CRIO stores all of its state
# in this directory.
runroot = "{{ .RunRoot }}"
# storage_driver select which storage driver is used to manage storage
# of images and containers.
storage_driver = "{{ .Storage }}"
# storage_option is used to pass an option to the storage driver.
storage_option = [
{{ range $opt := .StorageOptions }}{{ printf "\t%q,\n" $opt }}{{ end }}]
# The "crio.api" table contains settings for the kubelet/gRPC interface.
[crio.api]
# listen is the path to the AF_LOCAL socket on which crio will listen.
listen = "{{ .Listen }}"
# stream_address is the IP address on which the stream server will listen
stream_address = "{{ .StreamAddress }}"
# stream_port is the port on which the stream server will listen
stream_port = "{{ .StreamPort }}"
# file_locking is whether file-based locking will be used instead of
# in-memory locking
file_locking = {{ .FileLocking }}
# The "crio.runtime" table contains settings pertaining to the OCI
# runtime used and options for how to set up and manage the OCI runtime.
[crio.runtime]
# runtime is the OCI compatible runtime used for trusted container workloads.
# This is a mandatory setting as this runtime will be the default one
# and will also be used for untrusted container workloads if
# runtime_untrusted_workload is not set.
runtime = "{{ .Runtime }}"
# runtime_untrusted_workload is the OCI compatible runtime used for untrusted
# container workloads. This is an optional setting, except if
# default_container_trust is set to "untrusted".
runtime_untrusted_workload = "{{ .RuntimeUntrustedWorkload }}"
# default_workload_trust is the default level of trust crio puts in container
# workloads. It can either be "trusted" or "untrusted", and the default
# is "trusted".
# Containers can be run through different container runtimes, depending on
# the trust hints we receive from kubelet:
# - If kubelet tags a container workload as untrusted, crio will try first to
# run it through the untrusted container workload runtime. If it is not set,
# crio will use the trusted runtime.
# - If kubelet does not provide any information about the container workload trust
# level, the selected runtime will depend on the default_container_trust setting.
# If it is set to "untrusted", then all containers except for the host privileged
# ones, will be run by the runtime_untrusted_workload runtime. Host privileged
# containers are by definition trusted and will always use the trusted container
# runtime. If default_container_trust is set to "trusted", crio will use the trusted
# container runtime for all containers.
default_workload_trust = "{{ .DefaultWorkloadTrust }}"
# no_pivot instructs the runtime to not use pivot_root, but instead use MS_MOVE
no_pivot = {{ .NoPivot }}
# conmon is the path to conmon binary, used for managing the runtime.
conmon = "{{ .Conmon }}"
# conmon_env is the environment variable list for conmon process,
# used for passing necessary environment variable to conmon or runtime.
conmon_env = [
{{ range $env := .ConmonEnv }}{{ printf "\t%q,\n" $env }}{{ end }}]
# selinux indicates whether or not SELinux will be used for pod
# separation on the host. If you enable this flag, SELinux must be running
# on the host.
selinux = {{ .SELinux }}
# seccomp_profile is the seccomp json profile path which is used as the
# default for the runtime.
seccomp_profile = "{{ .SeccompProfile }}"
# apparmor_profile is the apparmor profile name which is used as the
# default for the runtime.
apparmor_profile = "{{ .ApparmorProfile }}"
# cgroup_manager is the cgroup management implementation to be used
# for the runtime.
cgroup_manager = "{{ .CgroupManager }}"
# hooks_dir_path is the oci hooks directory for automatically executed hooks
hooks_dir_path = "{{ .HooksDirPath }}"
# default_mounts is the mounts list to be mounted for the container when created
default_mounts = [
{{ range $mount := .DefaultMounts }}{{ printf "\t%q, \n" $mount }}{{ end }}]
# pids_limit is the number of processes allowed in a container
pids_limit = {{ .PidsLimit }}
# enable using a shared PID namespace for containers in a pod
enable_shared_pid_namespace = {{ .EnableSharedPIDNamespace }}
# log_size_max is the max limit for the container log size in bytes.
# Negative values indicate that no limit is imposed.
log_size_max = {{ .LogSizeMax }}
# The "crio.image" table contains settings pertaining to the
# management of OCI images.
[crio.image]
# default_transport is the prefix we try prepending to an image name if the
# image name as we receive it can't be parsed as a valid source reference
default_transport = "{{ .DefaultTransport }}"
# pause_image is the image which we use to instantiate infra containers.
pause_image = "{{ .PauseImage }}"
# pause_command is the command to run in a pause_image to have a container just
# sit there. If the image contains the necessary information, this value need
# not be specified.
pause_command = "{{ .PauseCommand }}"
# signature_policy is the name of the file which decides what sort of policy we
# use when deciding whether or not to trust an image that we've pulled.
# Outside of testing situations, it is strongly advised that this be left
# unspecified so that the default system-wide policy will be used.
signature_policy = "{{ .SignaturePolicyPath }}"
# image_volumes controls how image volumes are handled.
# The valid values are mkdir and ignore.
image_volumes = "{{ .ImageVolumes }}"
# insecure_registries is used to skip TLS verification when pulling images.
insecure_registries = [
{{ range $opt := .InsecureRegistries }}{{ printf "\t%q,\n" $opt }}{{ end }}]
# registries is used to specify a comma separated list of registries to be used
# when pulling an unqualified image (e.g. fedora:rawhide).
registries = [
{{ range $opt := .Registries }}{{ printf "\t%q,\n" $opt }}{{ end }}]
# The "crio.network" table contains settings pertaining to the
# management of CNI plugins.
[crio.network]
# network_dir is is where CNI network configuration
# files are stored.
network_dir = "{{ .NetworkDir }}"
# plugin_dir is is where CNI plugin binaries are stored.
plugin_dir = "{{ .PluginDir }}"
`))
// TODO: Currently ImageDir isn't really used, so we haven't added it to this
// template. Add it once the storage code has been merged.
var configCommand = cli.Command{
Name: "config",
Usage: "generate crio configuration files",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "default",
Usage: "output the default configuration",
},
},
Action: func(c *cli.Context) error {
// At this point, app.Before has already parsed the user's chosen
// config file. So no need to handle that here.
config := c.App.Metadata["config"].(*server.Config)
if c.Bool("default") {
config = server.DefaultConfig()
}
// Output the commented config.
return commentedConfigTemplate.ExecuteTemplate(os.Stdout, "config", config)
},
}

20
cmd/crio/daemon_linux.go Normal file
View file

@ -0,0 +1,20 @@
// +build linux
package main
import (
systemdDaemon "github.com/coreos/go-systemd/daemon"
"github.com/sirupsen/logrus"
)
func sdNotify() {
if _, err := systemdDaemon.SdNotify(true, "READY=1"); err != nil {
logrus.Warnf("Failed to sd_notify systemd: %v", err)
}
}
// notifySystem sends a message to the host when the server is ready to be used
func notifySystem() {
// Tell the init daemon we are accepting requests
go sdNotify()
}

540
cmd/crio/main.go Normal file
View file

@ -0,0 +1,540 @@
package main
import (
"context"
"fmt"
"net"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"path/filepath"
"sort"
"strings"
"time"
"github.com/containers/storage/pkg/reexec"
"github.com/kubernetes-incubator/cri-o/lib"
"github.com/kubernetes-incubator/cri-o/server"
"github.com/kubernetes-incubator/cri-o/version"
"github.com/opencontainers/selinux/go-selinux"
"github.com/sirupsen/logrus"
"github.com/soheilhy/cmux"
"github.com/urfave/cli"
"golang.org/x/sys/unix"
"google.golang.org/grpc"
"k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
)
// gitCommit is the commit that the binary is being built from.
// It will be populated by the Makefile.
var gitCommit = ""
func validateConfig(config *server.Config) error {
switch config.ImageVolumes {
case lib.ImageVolumesMkdir:
case lib.ImageVolumesIgnore:
case lib.ImageVolumesBind:
default:
return fmt.Errorf("Unrecognized image volume type specified")
}
// This needs to match the read buffer size in conmon
if config.LogSizeMax >= 0 && config.LogSizeMax < 8192 {
return fmt.Errorf("log size max should be negative or >= 8192")
}
return nil
}
func mergeConfig(config *server.Config, ctx *cli.Context) error {
// Don't parse the config if the user explicitly set it to "".
if path := ctx.GlobalString("config"); path != "" {
if err := config.UpdateFromFile(path); err != nil {
if ctx.GlobalIsSet("config") || !os.IsNotExist(err) {
return err
}
// We don't error out if --config wasn't explicitly set and the
// default doesn't exist. But we will log a warning about it, so
// the user doesn't miss it.
logrus.Warnf("default configuration file does not exist: %s", server.CrioConfigPath)
}
}
// Override options set with the CLI.
if ctx.GlobalIsSet("conmon") {
config.Conmon = ctx.GlobalString("conmon")
}
if ctx.GlobalIsSet("pause-command") {
config.PauseCommand = ctx.GlobalString("pause-command")
}
if ctx.GlobalIsSet("pause-image") {
config.PauseImage = ctx.GlobalString("pause-image")
}
if ctx.GlobalIsSet("signature-policy") {
config.SignaturePolicyPath = ctx.GlobalString("signature-policy")
}
if ctx.GlobalIsSet("root") {
config.Root = ctx.GlobalString("root")
}
if ctx.GlobalIsSet("runroot") {
config.RunRoot = ctx.GlobalString("runroot")
}
if ctx.GlobalIsSet("storage-driver") {
config.Storage = ctx.GlobalString("storage-driver")
}
if ctx.GlobalIsSet("storage-opt") {
config.StorageOptions = ctx.GlobalStringSlice("storage-opt")
}
if ctx.GlobalIsSet("file-locking") {
config.FileLocking = ctx.GlobalBool("file-locking")
}
if ctx.GlobalIsSet("insecure-registry") {
config.InsecureRegistries = ctx.GlobalStringSlice("insecure-registry")
}
if ctx.GlobalIsSet("registry") {
config.Registries = ctx.GlobalStringSlice("registry")
}
if ctx.GlobalIsSet("default-transport") {
config.DefaultTransport = ctx.GlobalString("default-transport")
}
if ctx.GlobalIsSet("listen") {
config.Listen = ctx.GlobalString("listen")
}
if ctx.GlobalIsSet("stream-address") {
config.StreamAddress = ctx.GlobalString("stream-address")
}
if ctx.GlobalIsSet("stream-port") {
config.StreamPort = ctx.GlobalString("stream-port")
}
if ctx.GlobalIsSet("runtime") {
config.Runtime = ctx.GlobalString("runtime")
}
if ctx.GlobalIsSet("selinux") {
config.SELinux = ctx.GlobalBool("selinux")
}
if ctx.GlobalIsSet("seccomp-profile") {
config.SeccompProfile = ctx.GlobalString("seccomp-profile")
}
if ctx.GlobalIsSet("apparmor-profile") {
config.ApparmorProfile = ctx.GlobalString("apparmor-profile")
}
if ctx.GlobalIsSet("cgroup-manager") {
config.CgroupManager = ctx.GlobalString("cgroup-manager")
}
if ctx.GlobalIsSet("hooks-dir-path") {
config.HooksDirPath = ctx.GlobalString("hooks-dir-path")
}
if ctx.GlobalIsSet("default-mounts") {
config.DefaultMounts = ctx.GlobalStringSlice("default-mounts")
}
if ctx.GlobalIsSet("pids-limit") {
config.PidsLimit = ctx.GlobalInt64("pids-limit")
}
if ctx.GlobalIsSet("enable-shared-pid-namespace") {
config.EnableSharedPIDNamespace = ctx.GlobalBool("enable-shared-pid-namespace")
}
if ctx.GlobalIsSet("log-size-max") {
config.LogSizeMax = ctx.GlobalInt64("log-size-max")
}
if ctx.GlobalIsSet("cni-config-dir") {
config.NetworkDir = ctx.GlobalString("cni-config-dir")
}
if ctx.GlobalIsSet("cni-plugin-dir") {
config.PluginDir = ctx.GlobalString("cni-plugin-dir")
}
if ctx.GlobalIsSet("image-volumes") {
config.ImageVolumes = lib.ImageVolumesType(ctx.GlobalString("image-volumes"))
}
return nil
}
func catchShutdown(gserver *grpc.Server, sserver *server.Server, hserver *http.Server, signalled *bool) {
sig := make(chan os.Signal, 10)
signal.Notify(sig, unix.SIGINT, unix.SIGTERM)
go func() {
for s := range sig {
switch s {
case unix.SIGINT:
logrus.Debugf("Caught SIGINT")
case unix.SIGTERM:
logrus.Debugf("Caught SIGTERM")
default:
continue
}
*signalled = true
gserver.GracefulStop()
hserver.Shutdown(context.Background())
sserver.StopStreamServer()
sserver.StopExitMonitor()
if err := sserver.Shutdown(); err != nil {
logrus.Warnf("error shutting down main service %v", err)
}
return
}
}()
}
func main() {
if reexec.Init() {
return
}
app := cli.NewApp()
var v []string
v = append(v, version.Version)
if gitCommit != "" {
v = append(v, fmt.Sprintf("commit: %s", gitCommit))
}
app.Name = "crio"
app.Usage = "crio server"
app.Version = strings.Join(v, "\n")
app.Metadata = map[string]interface{}{
"config": server.DefaultConfig(),
}
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "config",
Value: server.CrioConfigPath,
Usage: "path to configuration file",
},
cli.StringFlag{
Name: "conmon",
Usage: "path to the conmon executable",
},
cli.StringFlag{
Name: "listen",
Usage: "path to crio socket",
},
cli.StringFlag{
Name: "stream-address",
Usage: "bind address for streaming socket",
},
cli.StringFlag{
Name: "stream-port",
Usage: "bind port for streaming socket (default: \"10010\")",
},
cli.StringFlag{
Name: "log",
Value: "",
Usage: "set the log file path where internal debug information is written",
},
cli.StringFlag{
Name: "log-format",
Value: "text",
Usage: "set the format used by logs ('text' (default), or 'json')",
},
cli.StringFlag{
Name: "log-level",
Usage: "log messages above specified level: debug, info (default), warn, error, fatal or panic",
},
cli.StringFlag{
Name: "pause-command",
Usage: "name of the pause command in the pause image",
},
cli.StringFlag{
Name: "pause-image",
Usage: "name of the pause image",
},
cli.StringFlag{
Name: "signature-policy",
Usage: "path to signature policy file",
},
cli.StringFlag{
Name: "root",
Usage: "crio root dir",
},
cli.StringFlag{
Name: "runroot",
Usage: "crio state dir",
},
cli.StringFlag{
Name: "storage-driver",
Usage: "storage driver",
},
cli.StringSliceFlag{
Name: "storage-opt",
Usage: "storage driver option",
},
cli.BoolFlag{
Name: "file-locking",
Usage: "enable or disable file-based locking",
},
cli.StringSliceFlag{
Name: "insecure-registry",
Usage: "whether to disable TLS verification for the given registry",
},
cli.StringSliceFlag{
Name: "registry",
Usage: "registry to be prepended when pulling unqualified images, can be specified multiple times",
},
cli.StringFlag{
Name: "default-transport",
Usage: "default transport",
},
cli.StringFlag{
Name: "runtime",
Usage: "OCI runtime path",
},
cli.StringFlag{
Name: "seccomp-profile",
Usage: "default seccomp profile path",
},
cli.StringFlag{
Name: "apparmor-profile",
Usage: "default apparmor profile name (default: \"crio-default\")",
},
cli.BoolFlag{
Name: "selinux",
Usage: "enable selinux support",
},
cli.StringFlag{
Name: "cgroup-manager",
Usage: "cgroup manager (cgroupfs or systemd)",
},
cli.Int64Flag{
Name: "pids-limit",
Value: lib.DefaultPidsLimit,
Usage: "maximum number of processes allowed in a container",
},
cli.BoolFlag{
Name: "enable-shared-pid-namespace",
Usage: "enable using a shared PID namespace for containers in a pod",
},
cli.Int64Flag{
Name: "log-size-max",
Value: lib.DefaultLogSizeMax,
Usage: "maximum log size in bytes for a container",
},
cli.StringFlag{
Name: "cni-config-dir",
Usage: "CNI configuration files directory",
},
cli.StringFlag{
Name: "cni-plugin-dir",
Usage: "CNI plugin binaries directory",
},
cli.StringFlag{
Name: "image-volumes",
Value: string(lib.ImageVolumesMkdir),
Usage: "image volume handling ('mkdir', 'bind', or 'ignore')",
},
cli.StringFlag{
Name: "hooks-dir-path",
Usage: "set the OCI hooks directory path",
Value: lib.DefaultHooksDirPath,
Hidden: true,
},
cli.StringSliceFlag{
Name: "default-mounts",
Usage: "add one or more default mount paths in the form host:container",
Hidden: true,
},
cli.BoolFlag{
Name: "profile",
Usage: "enable pprof remote profiler on localhost:6060",
},
cli.IntFlag{
Name: "profile-port",
Value: 6060,
Usage: "port for the pprof profiler",
},
cli.BoolFlag{
Name: "enable-metrics",
Usage: "enable metrics endpoint for the servier on localhost:9090",
},
cli.IntFlag{
Name: "metrics-port",
Value: 9090,
Usage: "port for the metrics endpoint",
},
}
sort.Sort(cli.FlagsByName(app.Flags))
sort.Sort(cli.FlagsByName(configCommand.Flags))
app.Commands = []cli.Command{
configCommand,
}
app.Before = func(c *cli.Context) error {
// Load the configuration file.
config := c.App.Metadata["config"].(*server.Config)
if err := mergeConfig(config, c); err != nil {
return err
}
if err := validateConfig(config); err != nil {
return err
}
cf := &logrus.TextFormatter{
TimestampFormat: "2006-01-02 15:04:05.000000000Z07:00",
FullTimestamp: true,
}
logrus.SetFormatter(cf)
if loglevel := c.GlobalString("log-level"); loglevel != "" {
level, err := logrus.ParseLevel(loglevel)
if err != nil {
return err
}
logrus.SetLevel(level)
}
if path := c.GlobalString("log"); path != "" {
f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND|os.O_SYNC, 0666)
if err != nil {
return err
}
logrus.SetOutput(f)
}
switch c.GlobalString("log-format") {
case "text":
// retain logrus's default.
case "json":
logrus.SetFormatter(new(logrus.JSONFormatter))
default:
return fmt.Errorf("unknown log-format %q", c.GlobalString("log-format"))
}
return nil
}
app.Action = func(c *cli.Context) error {
if c.GlobalBool("profile") {
profilePort := c.GlobalInt("profile-port")
profileEndpoint := fmt.Sprintf("localhost:%v", profilePort)
go func() {
http.ListenAndServe(profileEndpoint, nil)
}()
}
args := c.Args()
if len(args) > 0 {
for _, command := range app.Commands {
if args[0] == command.Name {
break
}
}
return fmt.Errorf("command %q not supported", args[0])
}
config := c.App.Metadata["config"].(*server.Config)
if !config.SELinux {
selinux.SetDisabled()
}
if _, err := os.Stat(config.Runtime); os.IsNotExist(err) {
// path to runtime does not exist
return fmt.Errorf("invalid --runtime value %q", err)
}
if err := os.MkdirAll(filepath.Dir(config.Listen), 0755); err != nil {
return err
}
// Remove the socket if it already exists
if _, err := os.Stat(config.Listen); err == nil {
if err := os.Remove(config.Listen); err != nil {
logrus.Fatal(err)
}
}
lis, err := net.Listen("unix", config.Listen)
if err != nil {
logrus.Fatalf("failed to listen: %v", err)
}
s := grpc.NewServer()
service, err := server.New(config)
if err != nil {
logrus.Fatal(err)
}
if c.GlobalBool("enable-metrics") {
metricsPort := c.GlobalInt("metrics-port")
me, err := service.CreateMetricsEndpoint()
if err != nil {
logrus.Fatalf("Failed to create metrics endpoint: %v", err)
}
l, err := net.Listen("tcp", fmt.Sprintf(":%v", metricsPort))
if err != nil {
logrus.Fatalf("Failed to create listener for metrics: %v", err)
}
go func() {
if err := http.Serve(l, me); err != nil {
logrus.Fatalf("Failed to serve metrics endpoint: %v", err)
}
}()
}
runtime.RegisterRuntimeServiceServer(s, service)
runtime.RegisterImageServiceServer(s, service)
// after the daemon is done setting up we can notify systemd api
notifySystem()
go func() {
service.StartExitMonitor()
}()
m := cmux.New(lis)
grpcL := m.Match(cmux.HTTP2HeaderField("content-type", "application/grpc"))
httpL := m.Match(cmux.HTTP1Fast())
infoMux := service.GetInfoMux()
srv := &http.Server{
Handler: infoMux,
ReadTimeout: 5 * time.Second,
}
graceful := false
catchShutdown(s, service, srv, &graceful)
go s.Serve(grpcL)
go srv.Serve(httpL)
serverCloseCh := make(chan struct{})
go func() {
defer close(serverCloseCh)
if err := m.Serve(); err != nil {
if graceful && strings.Contains(strings.ToLower(err.Error()), "use of closed network connection") {
err = nil
} else {
logrus.Errorf("Failed to serve grpc request: %v", err)
}
}
}()
streamServerCloseCh := service.StreamingServerCloseChan()
serverExitMonitorCh := service.ExitMonitorCloseChan()
select {
case <-streamServerCloseCh:
case <-serverExitMonitorCh:
case <-serverCloseCh:
}
service.Shutdown()
<-streamServerCloseCh
logrus.Debug("closed stream server")
<-serverExitMonitorCh
logrus.Debug("closed exit monitor")
<-serverCloseCh
logrus.Debug("closed main server")
return nil
}
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}

View file

@ -1,16 +0,0 @@
# kpod - Simple debugging tool for pods and images
kpod is a simple client only tool to help with debugging issues when daemons such as CRI runtime and the kubelet are not responding or
failing. A shared API layer could be created to share code between the daemon and kpod. kpod does not require any daemon running. kpod
utilizes the same underlying components that ocid uses i.e. containers/image, container/storage, oci-runtime-tool/generate, runc or
any other OCI compatible runtime. kpod shares state with ocid and so has the capability to debug pods/images created by ocid.
## Use cases
1. List pods.
2. Launch simple pods (that require no daemon support).
3. Exec commands in a container in a pod.
4. Launch additional containers in a pod.
5. List images.
6. Remove images not in use.
7. Pull images.
8. Check image size.
9. Report pod disk resource usage.

View file

@ -1,16 +0,0 @@
package main
import (
"fmt"
"github.com/urfave/cli"
)
// TODO implement
var launchCommand = cli.Command{
Name: "launch",
Usage: "launch a pod",
Action: func(context *cli.Context) error {
return fmt.Errorf("this functionality is not yet implemented")
},
}

View file

@ -1,23 +0,0 @@
package main
import (
"os"
"github.com/Sirupsen/logrus"
"github.com/urfave/cli"
)
func main() {
app := cli.NewApp()
app.Name = "kpod"
app.Usage = "manage pods and images"
app.Version = "0.0.1"
app.Commands = []cli.Command{
launchCommand,
}
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}

View file

@ -1,605 +0,0 @@
package main
import (
"fmt"
"log"
"net/url"
"os"
"strings"
"time"
"github.com/urfave/cli"
"golang.org/x/net/context"
restclient "k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/client/unversioned/remotecommand"
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
remotecommandserver "k8s.io/kubernetes/pkg/kubelet/server/remotecommand"
)
var containerCommand = cli.Command{
Name: "container",
Aliases: []string{"ctr"},
Subcommands: []cli.Command{
createContainerCommand,
startContainerCommand,
stopContainerCommand,
removeContainerCommand,
containerStatusCommand,
listContainersCommand,
execSyncCommand,
execCommand,
},
}
type createOptions struct {
// configPath is path to the config for container
configPath string
// name sets the container name
name string
// podID of the container
podID string
// labels for the container
labels map[string]string
}
var createContainerCommand = cli.Command{
Name: "create",
Usage: "create a container",
Flags: []cli.Flag{
cli.StringFlag{
Name: "pod",
Usage: "the id of the pod sandbox to which the container belongs",
},
cli.StringFlag{
Name: "config",
Value: "config.json",
Usage: "the path of a container config file",
},
cli.StringFlag{
Name: "name",
Value: "",
Usage: "the name of the container",
},
cli.StringSliceFlag{
Name: "label",
Usage: "add key=value labels to the container",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
if !context.IsSet("pod") {
return fmt.Errorf("Please specify the id of the pod sandbox to which the container belongs via the --pod option")
}
opts := createOptions{
configPath: context.String("config"),
name: context.String("name"),
podID: context.String("pod"),
labels: make(map[string]string),
}
for _, l := range context.StringSlice("label") {
pair := strings.Split(l, "=")
if len(pair) != 2 {
return fmt.Errorf("incorrectly specified label: %v", l)
}
opts.labels[pair[0]] = pair[1]
}
// Test RuntimeServiceClient.CreateContainer
err = CreateContainer(client, opts)
if err != nil {
return fmt.Errorf("Creating container failed: %v", err)
}
return nil
},
}
var startContainerCommand = cli.Command{
Name: "start",
Usage: "start a container",
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Value: "",
Usage: "id of the container",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
err = StartContainer(client, context.String("id"))
if err != nil {
return fmt.Errorf("Starting the container failed: %v", err)
}
return nil
},
}
var stopContainerCommand = cli.Command{
Name: "stop",
Usage: "stop a container",
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Value: "",
Usage: "id of the container",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
err = StopContainer(client, context.String("id"))
if err != nil {
return fmt.Errorf("Stopping the container failed: %v", err)
}
return nil
},
}
var removeContainerCommand = cli.Command{
Name: "remove",
Usage: "remove a container",
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Value: "",
Usage: "id of the container",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
err = RemoveContainer(client, context.String("id"))
if err != nil {
return fmt.Errorf("Removing the container failed: %v", err)
}
return nil
},
}
var containerStatusCommand = cli.Command{
Name: "status",
Usage: "get the status of a container",
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Value: "",
Usage: "id of the container",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
err = ContainerStatus(client, context.String("id"))
if err != nil {
return fmt.Errorf("Getting the status of the container failed: %v", err)
}
return nil
},
}
var execSyncCommand = cli.Command{
Name: "execsync",
Usage: "exec a command synchronously in a container",
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Value: "",
Usage: "id of the container",
},
cli.Int64Flag{
Name: "timeout",
Value: 0,
Usage: "timeout for the command",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
err = ExecSync(client, context.String("id"), context.Args(), context.Int64("timeout"))
if err != nil {
return fmt.Errorf("execing command in container failed: %v", err)
}
return nil
},
}
var execCommand = cli.Command{
Name: "exec",
Usage: "prepare a streaming endpoint to execute a command in the container",
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Value: "",
Usage: "id of the container",
},
cli.BoolFlag{
Name: "tty",
Usage: "whether to use tty",
},
cli.BoolFlag{
Name: "stdin",
Usage: "whether to stream to stdin",
},
cli.BoolFlag{
Name: "url",
Usage: "do not exec command, just prepare streaming endpoint",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
err = Exec(client, context.String("id"), context.Bool("tty"), context.Bool("stdin"), context.Bool("url"), context.Args())
if err != nil {
return fmt.Errorf("execing command in container failed: %v", err)
}
return nil
},
}
type listOptions struct {
// id of the container
id string
// podID of the container
podID string
// state of the container
state string
// quiet is for listing just container IDs
quiet bool
// labels are selectors for the container
labels map[string]string
}
var listContainersCommand = cli.Command{
Name: "list",
Usage: "list containers",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "quiet",
Usage: "list only container IDs",
},
cli.StringFlag{
Name: "id",
Value: "",
Usage: "filter by container id",
},
cli.StringFlag{
Name: "pod",
Value: "",
Usage: "filter by container pod id",
},
cli.StringFlag{
Name: "state",
Value: "",
Usage: "filter by container state",
},
cli.StringSliceFlag{
Name: "label",
Usage: "filter by key=value label",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
opts := listOptions{
id: context.String("id"),
podID: context.String("pod"),
state: context.String("state"),
quiet: context.Bool("quiet"),
labels: make(map[string]string),
}
for _, l := range context.StringSlice("label") {
pair := strings.Split(l, "=")
if len(pair) != 2 {
return fmt.Errorf("incorrectly specified label: %v", l)
}
opts.labels[pair[0]] = pair[1]
}
err = ListContainers(client, opts)
if err != nil {
return fmt.Errorf("listing containers failed: %v", err)
}
return nil
},
}
// CreateContainer sends a CreateContainerRequest to the server, and parses
// the returned CreateContainerResponse.
func CreateContainer(client pb.RuntimeServiceClient, opts createOptions) error {
config, err := loadContainerConfig(opts.configPath)
if err != nil {
return err
}
// Override the name by the one specified through CLI
if opts.name != "" {
config.Metadata.Name = opts.name
}
for k, v := range opts.labels {
config.Labels[k] = v
}
r, err := client.CreateContainer(context.Background(), &pb.CreateContainerRequest{
PodSandboxId: opts.podID,
Config: config,
// TODO(runcom): this is missing PodSandboxConfig!!!
// we should/could find a way to retrieve it from the fs and set it here
})
if err != nil {
return err
}
fmt.Println(r.ContainerId)
return nil
}
// StartContainer sends a StartContainerRequest to the server, and parses
// the returned StartContainerResponse.
func StartContainer(client pb.RuntimeServiceClient, ID string) error {
if ID == "" {
return fmt.Errorf("ID cannot be empty")
}
_, err := client.StartContainer(context.Background(), &pb.StartContainerRequest{
ContainerId: ID,
})
if err != nil {
return err
}
fmt.Println(ID)
return nil
}
// StopContainer sends a StopContainerRequest to the server, and parses
// the returned StopContainerResponse.
func StopContainer(client pb.RuntimeServiceClient, ID string) error {
if ID == "" {
return fmt.Errorf("ID cannot be empty")
}
_, err := client.StopContainer(context.Background(), &pb.StopContainerRequest{
ContainerId: ID,
})
if err != nil {
return err
}
fmt.Println(ID)
return nil
}
// RemoveContainer sends a RemoveContainerRequest to the server, and parses
// the returned RemoveContainerResponse.
func RemoveContainer(client pb.RuntimeServiceClient, ID string) error {
if ID == "" {
return fmt.Errorf("ID cannot be empty")
}
_, err := client.RemoveContainer(context.Background(), &pb.RemoveContainerRequest{
ContainerId: ID,
})
if err != nil {
return err
}
fmt.Println(ID)
return nil
}
// ContainerStatus sends a ContainerStatusRequest to the server, and parses
// the returned ContainerStatusResponse.
func ContainerStatus(client pb.RuntimeServiceClient, ID string) error {
if ID == "" {
return fmt.Errorf("ID cannot be empty")
}
r, err := client.ContainerStatus(context.Background(), &pb.ContainerStatusRequest{
ContainerId: ID})
if err != nil {
return err
}
fmt.Printf("ID: %s\n", r.Status.Id)
if r.Status.Metadata != nil {
if r.Status.Metadata.Name != "" {
fmt.Printf("Name: %s\n", r.Status.Metadata.Name)
}
fmt.Printf("Attempt: %v\n", r.Status.Metadata.Attempt)
}
// TODO(mzylowski): print it prettier
fmt.Printf("Status: %s\n", r.Status.State)
ctm := time.Unix(0, r.Status.CreatedAt)
fmt.Printf("Created: %v\n", ctm)
stm := time.Unix(0, r.Status.StartedAt)
fmt.Printf("Started: %v\n", stm)
ftm := time.Unix(0, r.Status.FinishedAt)
fmt.Printf("Finished: %v\n", ftm)
fmt.Printf("Exit Code: %v\n", r.Status.ExitCode)
return nil
}
// ExecSync sends an ExecSyncRequest to the server, and parses
// the returned ExecSyncResponse.
func ExecSync(client pb.RuntimeServiceClient, ID string, cmd []string, timeout int64) error {
if ID == "" {
return fmt.Errorf("ID cannot be empty")
}
r, err := client.ExecSync(context.Background(), &pb.ExecSyncRequest{
ContainerId: ID,
Cmd: cmd,
Timeout: timeout,
})
if err != nil {
return err
}
fmt.Println("Stdout:")
fmt.Println(string(r.Stdout))
fmt.Println("Stderr:")
fmt.Println(string(r.Stderr))
fmt.Printf("Exit code: %v\n", r.ExitCode)
return nil
}
// Exec sends an ExecRequest to the server, and parses
// the returned ExecResponse.
func Exec(client pb.RuntimeServiceClient, ID string, tty bool, stdin bool, urlOnly bool, cmd []string) error {
if ID == "" {
return fmt.Errorf("ID cannot be empty")
}
r, err := client.Exec(context.Background(), &pb.ExecRequest{
ContainerId: ID,
Cmd: cmd,
Tty: tty,
Stdin: stdin,
})
if err != nil {
return err
}
if urlOnly {
fmt.Println("URL:")
fmt.Println(r.Url)
return nil
}
execURL, err := url.Parse(r.Url)
if err != nil {
return err
}
streamExec, err := remotecommand.NewExecutor(&restclient.Config{}, "GET", execURL)
if err != nil {
return err
}
options := remotecommand.StreamOptions{
SupportedProtocols: remotecommandserver.SupportedStreamingProtocols,
Stdout: os.Stdout,
Stderr: os.Stderr,
Tty: tty,
}
if stdin {
options.Stdin = os.Stdin
}
return streamExec.Stream(options)
}
// ListContainers sends a ListContainerRequest to the server, and parses
// the returned ListContainerResponse.
func ListContainers(client pb.RuntimeServiceClient, opts listOptions) error {
filter := &pb.ContainerFilter{}
if opts.id != "" {
filter.Id = opts.id
}
if opts.podID != "" {
filter.PodSandboxId = opts.podID
}
if opts.state != "" {
st := &pb.ContainerStateValue{}
st.State = pb.ContainerState_CONTAINER_UNKNOWN
switch opts.state {
case "created":
st.State = pb.ContainerState_CONTAINER_CREATED
filter.State = st
case "running":
st.State = pb.ContainerState_CONTAINER_RUNNING
filter.State = st
case "stopped":
st.State = pb.ContainerState_CONTAINER_EXITED
filter.State = st
default:
log.Fatalf("--state should be one of created, running or stopped")
}
}
if opts.labels != nil {
filter.LabelSelector = opts.labels
}
r, err := client.ListContainers(context.Background(), &pb.ListContainersRequest{
Filter: filter,
})
if err != nil {
return err
}
for _, c := range r.GetContainers() {
if opts.quiet {
fmt.Println(c.Id)
continue
}
fmt.Printf("ID: %s\n", c.Id)
fmt.Printf("Pod: %s\n", c.PodSandboxId)
if c.Metadata != nil {
if c.Metadata.Name != "" {
fmt.Printf("Name: %s\n", c.Metadata.Name)
}
fmt.Printf("Attempt: %v\n", c.Metadata.Attempt)
}
fmt.Printf("Status: %s\n", c.State)
if c.Image != nil {
fmt.Printf("Image: %s\n", c.Image.Image)
}
ctm := time.Unix(0, c.CreatedAt)
fmt.Printf("Created: %v\n", ctm)
if c.Labels != nil {
fmt.Println("Labels:")
for _, k := range getSortedKeys(c.Labels) {
fmt.Printf("\t%s -> %s\n", k, c.Labels[k])
}
}
if c.Annotations != nil {
fmt.Println("Annotations:")
for _, k := range getSortedKeys(c.Annotations) {
fmt.Printf("\t%s -> %s\n", k, c.Annotations[k])
}
}
fmt.Println()
}
return nil
}

View file

@ -1,173 +0,0 @@
package main
import (
"fmt"
"github.com/urfave/cli"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
)
var imageCommand = cli.Command{
Name: "image",
Subcommands: []cli.Command{
pullImageCommand,
listImageCommand,
imageStatusCommand,
removeImageCommand,
},
}
var pullImageCommand = cli.Command{
Name: "pull",
Usage: "pull an image",
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewImageServiceClient(conn)
_, err = PullImage(client, context.Args().Get(0))
if err != nil {
return fmt.Errorf("pulling image failed: %v", err)
}
return nil
},
}
var listImageCommand = cli.Command{
Name: "list",
Usage: "list images",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "quiet",
Usage: "list only image IDs",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewImageServiceClient(conn)
r, err := ListImages(client, context.Args().Get(0))
if err != nil {
return fmt.Errorf("listing images failed: %v", err)
}
quiet := context.Bool("quiet")
for _, image := range r.Images {
if quiet {
fmt.Printf("%s\n", image.Id)
continue
}
fmt.Printf("ID: %s\n", image.Id)
for _, tag := range image.RepoTags {
fmt.Printf("Tag: %s\n", tag)
}
for _, digest := range image.RepoDigests {
fmt.Printf("Digest: %s\n", digest)
}
if image.Size_ != 0 {
fmt.Printf("Size: %d\n", image.Size_)
}
}
return nil
},
}
var imageStatusCommand = cli.Command{
Name: "status",
Usage: "return the status of an image",
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Usage: "id of the image",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewImageServiceClient(conn)
r, err := ImageStatus(client, context.String("id"))
if err != nil {
return fmt.Errorf("image status request failed: %v", err)
}
image := r.Image
if image == nil {
return fmt.Errorf("no such image present")
}
fmt.Printf("ID: %s\n", image.Id)
for _, tag := range image.RepoTags {
fmt.Printf("Tag: %s\n", tag)
}
for _, digest := range image.RepoDigests {
fmt.Printf("Digest: %s\n", digest)
}
fmt.Printf("Size: %d\n", image.Size_)
return nil
},
}
var removeImageCommand = cli.Command{
Name: "remove",
Usage: "remove an image",
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Value: "",
Usage: "id of the image",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewImageServiceClient(conn)
_, err = RemoveImage(client, context.String("id"))
if err != nil {
return fmt.Errorf("removing the image failed: %v", err)
}
return nil
},
}
// PullImage sends a PullImageRequest to the server, and parses
// the returned PullImageResponse.
func PullImage(client pb.ImageServiceClient, image string) (*pb.PullImageResponse, error) {
return client.PullImage(context.Background(), &pb.PullImageRequest{Image: &pb.ImageSpec{Image: image}})
}
// ListImages sends a ListImagesRequest to the server, and parses
// the returned ListImagesResponse.
func ListImages(client pb.ImageServiceClient, image string) (*pb.ListImagesResponse, error) {
return client.ListImages(context.Background(), &pb.ListImagesRequest{Filter: &pb.ImageFilter{Image: &pb.ImageSpec{Image: image}}})
}
// ImageStatus sends an ImageStatusRequest to the server, and parses
// the returned ImageStatusResponse.
func ImageStatus(client pb.ImageServiceClient, image string) (*pb.ImageStatusResponse, error) {
return client.ImageStatus(context.Background(), &pb.ImageStatusRequest{Image: &pb.ImageSpec{Image: image}})
}
// RemoveImage sends a RemoveImageRequest to the server, and parses
// the returned RemoveImageResponse.
func RemoveImage(client pb.ImageServiceClient, image string) (*pb.RemoveImageResponse, error) {
if image == "" {
return nil, fmt.Errorf("ID cannot be empty")
}
return client.RemoveImage(context.Background(), &pb.RemoveImageRequest{Image: &pb.ImageSpec{Image: image}})
}

View file

@ -1,95 +0,0 @@
package main
import (
"encoding/json"
"fmt"
"net"
"os"
"time"
"github.com/Sirupsen/logrus"
"github.com/urfave/cli"
"google.golang.org/grpc"
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
)
func getClientConnection(context *cli.Context) (*grpc.ClientConn, error) {
conn, err := grpc.Dial(context.GlobalString("connect"), grpc.WithInsecure(), grpc.WithTimeout(context.GlobalDuration("timeout")),
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout("unix", addr, timeout)
}))
if err != nil {
return nil, fmt.Errorf("failed to connect: %v", err)
}
return conn, nil
}
func openFile(path string) (*os.File, error) {
f, err := os.Open(path)
if err != nil {
if os.IsNotExist(err) {
return nil, fmt.Errorf("config at %s not found", path)
}
return nil, err
}
return f, nil
}
func loadPodSandboxConfig(path string) (*pb.PodSandboxConfig, error) {
f, err := openFile(path)
if err != nil {
return nil, err
}
defer f.Close()
var config pb.PodSandboxConfig
if err := json.NewDecoder(f).Decode(&config); err != nil {
return nil, err
}
return &config, nil
}
func loadContainerConfig(path string) (*pb.ContainerConfig, error) {
f, err := openFile(path)
if err != nil {
return nil, err
}
defer f.Close()
var config pb.ContainerConfig
if err := json.NewDecoder(f).Decode(&config); err != nil {
return nil, err
}
return &config, nil
}
func main() {
app := cli.NewApp()
app.Name = "ocic"
app.Usage = "client for ocid"
app.Version = "0.3"
app.Commands = []cli.Command{
podSandboxCommand,
containerCommand,
runtimeVersionCommand,
imageCommand,
}
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "connect",
Value: "/var/run/ocid.sock",
Usage: "Socket to connect to",
},
cli.DurationFlag{
Name: "timeout",
Value: 10 * time.Second,
Usage: "Timeout of connecting to server",
},
}
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}

View file

@ -1,387 +0,0 @@
package main
import (
"fmt"
"log"
"sort"
"strings"
"time"
"github.com/urfave/cli"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
)
var podSandboxCommand = cli.Command{
Name: "pod",
Subcommands: []cli.Command{
runPodSandboxCommand,
stopPodSandboxCommand,
removePodSandboxCommand,
podSandboxStatusCommand,
listPodSandboxCommand,
},
}
var runPodSandboxCommand = cli.Command{
Name: "run",
Usage: "run a pod",
Flags: []cli.Flag{
cli.StringFlag{
Name: "config",
Value: "",
Usage: "the path of a pod sandbox config file",
},
cli.StringFlag{
Name: "name",
Value: "",
Usage: "the name of the pod sandbox",
},
cli.StringSliceFlag{
Name: "label",
Usage: "add key=value labels to the container",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
opts := createOptions{
configPath: context.String("config"),
name: context.String("name"),
labels: make(map[string]string),
}
for _, l := range context.StringSlice("label") {
pair := strings.Split(l, "=")
if len(pair) != 2 {
return fmt.Errorf("incorrectly specified label: %v", l)
}
opts.labels[pair[0]] = pair[1]
}
// Test RuntimeServiceClient.RunPodSandbox
err = RunPodSandbox(client, opts)
if err != nil {
return fmt.Errorf("Creating the pod sandbox failed: %v", err)
}
return nil
},
}
var stopPodSandboxCommand = cli.Command{
Name: "stop",
Usage: "stop a pod sandbox",
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Value: "",
Usage: "id of the pod sandbox",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
err = StopPodSandbox(client, context.String("id"))
if err != nil {
return fmt.Errorf("stopping the pod sandbox failed: %v", err)
}
return nil
},
}
var removePodSandboxCommand = cli.Command{
Name: "remove",
Usage: "remove a pod sandbox",
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Value: "",
Usage: "id of the pod sandbox",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
err = RemovePodSandbox(client, context.String("id"))
if err != nil {
return fmt.Errorf("removing the pod sandbox failed: %v", err)
}
return nil
},
}
var podSandboxStatusCommand = cli.Command{
Name: "status",
Usage: "return the status of a pod",
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Value: "",
Usage: "id of the pod",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
err = PodSandboxStatus(client, context.String("id"))
if err != nil {
return fmt.Errorf("getting the pod sandbox status failed: %v", err)
}
return nil
},
}
var listPodSandboxCommand = cli.Command{
Name: "list",
Usage: "list pod sandboxes",
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Value: "",
Usage: "filter by pod sandbox id",
},
cli.StringFlag{
Name: "state",
Value: "",
Usage: "filter by pod sandbox state",
},
cli.StringSliceFlag{
Name: "label",
Usage: "filter by key=value label",
},
cli.BoolFlag{
Name: "quiet",
Usage: "list only pod IDs",
},
},
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
opts := listOptions{
id: context.String("id"),
state: context.String("state"),
quiet: context.Bool("quiet"),
labels: make(map[string]string),
}
for _, l := range context.StringSlice("label") {
pair := strings.Split(l, "=")
if len(pair) != 2 {
return fmt.Errorf("incorrectly specified label: %v", l)
}
opts.labels[pair[0]] = pair[1]
}
err = ListPodSandboxes(client, opts)
if err != nil {
return fmt.Errorf("listing pod sandboxes failed: %v", err)
}
return nil
},
}
// RunPodSandbox sends a RunPodSandboxRequest to the server, and parses
// the returned RunPodSandboxResponse.
func RunPodSandbox(client pb.RuntimeServiceClient, opts createOptions) error {
config, err := loadPodSandboxConfig(opts.configPath)
if err != nil {
return err
}
// Override the name by the one specified through CLI
if opts.name != "" {
config.Metadata.Name = opts.name
}
for k, v := range opts.labels {
config.Labels[k] = v
}
r, err := client.RunPodSandbox(context.Background(), &pb.RunPodSandboxRequest{Config: config})
if err != nil {
return err
}
fmt.Println(r.PodSandboxId)
return nil
}
// StopPodSandbox sends a StopPodSandboxRequest to the server, and parses
// the returned StopPodSandboxResponse.
func StopPodSandbox(client pb.RuntimeServiceClient, ID string) error {
if ID == "" {
return fmt.Errorf("ID cannot be empty")
}
_, err := client.StopPodSandbox(context.Background(), &pb.StopPodSandboxRequest{PodSandboxId: ID})
if err != nil {
return err
}
fmt.Println(ID)
return nil
}
// RemovePodSandbox sends a RemovePodSandboxRequest to the server, and parses
// the returned RemovePodSandboxResponse.
func RemovePodSandbox(client pb.RuntimeServiceClient, ID string) error {
if ID == "" {
return fmt.Errorf("ID cannot be empty")
}
_, err := client.RemovePodSandbox(context.Background(), &pb.RemovePodSandboxRequest{PodSandboxId: ID})
if err != nil {
return err
}
fmt.Println(ID)
return nil
}
// PodSandboxStatus sends a PodSandboxStatusRequest to the server, and parses
// the returned PodSandboxStatusResponse.
func PodSandboxStatus(client pb.RuntimeServiceClient, ID string) error {
if ID == "" {
return fmt.Errorf("ID cannot be empty")
}
r, err := client.PodSandboxStatus(context.Background(), &pb.PodSandboxStatusRequest{PodSandboxId: ID})
if err != nil {
return err
}
fmt.Printf("ID: %s\n", r.Status.Id)
if r.Status.Metadata != nil {
if r.Status.Metadata.Name != "" {
fmt.Printf("Name: %s\n", r.Status.Metadata.Name)
}
if r.Status.Metadata.Uid != "" {
fmt.Printf("UID: %s\n", r.Status.Metadata.Uid)
}
if r.Status.Metadata.Namespace != "" {
fmt.Printf("Namespace: %s\n", r.Status.Metadata.Namespace)
}
fmt.Printf("Attempt: %v\n", r.Status.Metadata.Attempt)
}
fmt.Printf("Status: %s\n", r.Status.State)
ctm := time.Unix(0, r.Status.CreatedAt)
fmt.Printf("Created: %v\n", ctm)
fmt.Printf("Network namespace: %s\n", r.Status.Linux.Namespaces.Network)
if r.Status.Network != nil {
fmt.Printf("IP Address: %v\n", r.Status.Network.Ip)
}
if r.Status.Labels != nil {
fmt.Println("Labels:")
for _, k := range getSortedKeys(r.Status.Labels) {
fmt.Printf("\t%s -> %s\n", k, r.Status.Labels[k])
}
}
if r.Status.Annotations != nil {
fmt.Println("Annotations:")
for _, k := range getSortedKeys(r.Status.Annotations) {
fmt.Printf("\t%s -> %s\n", k, r.Status.Annotations[k])
}
}
return nil
}
// ListPodSandboxes sends a ListPodSandboxRequest to the server, and parses
// the returned ListPodSandboxResponse.
func ListPodSandboxes(client pb.RuntimeServiceClient, opts listOptions) error {
filter := &pb.PodSandboxFilter{}
if opts.id != "" {
filter.Id = opts.id
}
if opts.state != "" {
st := &pb.PodSandboxStateValue{}
st.State = pb.PodSandboxState_SANDBOX_NOTREADY
switch opts.state {
case "ready":
st.State = pb.PodSandboxState_SANDBOX_READY
filter.State = st
case "notready":
st.State = pb.PodSandboxState_SANDBOX_NOTREADY
filter.State = st
default:
log.Fatalf("--state should be ready or notready")
}
}
if opts.labels != nil {
filter.LabelSelector = opts.labels
}
r, err := client.ListPodSandbox(context.Background(), &pb.ListPodSandboxRequest{
Filter: filter,
})
if err != nil {
return err
}
for _, pod := range r.Items {
if opts.quiet {
fmt.Println(pod.Id)
continue
}
fmt.Printf("ID: %s\n", pod.Id)
if pod.Metadata != nil {
if pod.Metadata.Name != "" {
fmt.Printf("Name: %s\n", pod.Metadata.Name)
}
if pod.Metadata.Uid != "" {
fmt.Printf("UID: %s\n", pod.Metadata.Uid)
}
if pod.Metadata.Namespace != "" {
fmt.Printf("Namespace: %s\n", pod.Metadata.Namespace)
}
fmt.Printf("Attempt: %v\n", pod.Metadata.Attempt)
}
fmt.Printf("Status: %s\n", pod.State)
ctm := time.Unix(0, pod.CreatedAt)
fmt.Printf("Created: %v\n", ctm)
if pod.Labels != nil {
fmt.Println("Labels:")
for _, k := range getSortedKeys(pod.Labels) {
fmt.Printf("\t%s -> %s\n", k, pod.Labels[k])
}
}
if pod.Annotations != nil {
fmt.Println("Annotations:")
for _, k := range getSortedKeys(pod.Annotations) {
fmt.Printf("\t%s -> %s\n", k, pod.Annotations[k])
}
}
fmt.Println()
}
return nil
}
func getSortedKeys(m map[string]string) []string {
var keys []string
for k := range m {
keys = append(keys, k)
}
sort.Strings(keys)
return keys
}

View file

@ -1,41 +0,0 @@
package main
import (
"fmt"
"github.com/urfave/cli"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
)
var runtimeVersionCommand = cli.Command{
Name: "runtimeversion",
Usage: "get runtime version information",
Action: func(context *cli.Context) error {
// Set up a connection to the server.
conn, err := getClientConnection(context)
if err != nil {
return fmt.Errorf("failed to connect: %v", err)
}
defer conn.Close()
client := pb.NewRuntimeServiceClient(conn)
// Test RuntimeServiceClient.Version
version := "v1alpha1"
err = Version(client, version)
if err != nil {
return fmt.Errorf("Getting the runtime version failed: %v", err)
}
return nil
},
}
// Version sends a VersionRequest to the server, and parses the returned VersionResponse.
func Version(client pb.RuntimeServiceClient, version string) error {
r, err := client.Version(context.Background(), &pb.VersionRequest{Version: version})
if err != nil {
return err
}
fmt.Printf("VersionResponse: Version: %s, RuntimeName: %s, RuntimeVersion: %s, RuntimeApiVersion: %s\n", r.Version, r.RuntimeName, r.RuntimeVersion, r.RuntimeApiVersion)
return nil
}

View file

@ -1,133 +0,0 @@
package main
import (
"os"
"text/template"
"github.com/kubernetes-incubator/cri-o/server"
"github.com/urfave/cli"
)
var commentedConfigTemplate = template.Must(template.New("config").Parse(`
# The "ocid" table contains all of the server options.
[ocid]
# root is a path to the "root directory". OCID stores all of its data,
# including container images, in this directory.
root = "{{ .Root }}"
# run is a path to the "run directory". OCID stores all of its state
# in this directory.
runroot = "{{ .RunRoot }}"
# storage_driver select which storage driver is used to manage storage
# of images and containers.
storage_driver = "{{ .Storage }}"
# storage_option is used to pass an option to the storage driver.
storage_option = [
{{ range $opt := .StorageOptions }}{{ printf "\t%q,\n" $opt }}{{ end }}]
# The "ocid.api" table contains settings for the kubelet/gRPC
# interface (which is also used by ocic).
[ocid.api]
# listen is the path to the AF_LOCAL socket on which ocid will listen.
listen = "{{ .Listen }}"
# The "ocid.runtime" table contains settings pertaining to the OCI
# runtime used and options for how to set up and manage the OCI runtime.
[ocid.runtime]
# runtime is a path to the OCI runtime which ocid will be using.
runtime = "{{ .Runtime }}"
# runtime_host_privileged is a path to the OCI runtime which ocid
# will be using for host privileged operations.
# If this string is empty, ocid will not try to use the "runtime"
# for all operations.
runtime_host_privileged = "{{ .RuntimeHostPrivileged }}"
# conmon is the path to conmon binary, used for managing the runtime.
conmon = "{{ .Conmon }}"
# conmon_env is the environment variable list for conmon process,
# used for passing necessary environment variable to conmon or runtime.
conmon_env = [
{{ range $env := .ConmonEnv }}{{ printf "\t%q,\n" $env }}{{ end }}]
# selinux indicates whether or not SELinux will be used for pod
# separation on the host. If you enable this flag, SELinux must be running
# on the host.
selinux = {{ .SELinux }}
# seccomp_profile is the seccomp json profile path which is used as the
# default for the runtime.
seccomp_profile = "{{ .SeccompProfile }}"
# apparmor_profile is the apparmor profile name which is used as the
# default for the runtime.
apparmor_profile = "{{ .ApparmorProfile }}"
# cgroup_manager is the cgroup management implementation to be used
# for the runtime.
cgroup_manager = "{{ .CgroupManager }}"
# The "ocid.image" table contains settings pertaining to the
# management of OCI images.
[ocid.image]
# default_transport is the prefix we try prepending to an image name if the
# image name as we receive it can't be parsed as a valid source reference
default_transport = "{{ .DefaultTransport }}"
# pause_image is the image which we use to instantiate infra containers.
pause_image = "{{ .PauseImage }}"
# pause_command is the command to run in a pause_image to have a container just
# sit there. If the image contains the necessary information, this value need
# not be specified.
pause_command = "{{ .PauseCommand }}"
# signature_policy is the name of the file which decides what sort of policy we
# use when deciding whether or not to trust an image that we've pulled.
# Outside of testing situations, it is strongly advised that this be left
# unspecified so that the default system-wide policy will be used.
signature_policy = "{{ .SignaturePolicyPath }}"
# The "ocid.network" table contains settings pertaining to the
# management of CNI plugins.
[ocid.network]
# network_dir is is where CNI network configuration
# files are stored.
network_dir = "{{ .NetworkDir }}"
# plugin_dir is is where CNI plugin binaries are stored.
plugin_dir = "{{ .PluginDir }}"
`))
// TODO: Currently ImageDir isn't really used, so we haven't added it to this
// template. Add it once the storage code has been merged.
var configCommand = cli.Command{
Name: "config",
Usage: "generate ocid configuration files",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "default",
Usage: "output the default configuration",
},
},
Action: func(c *cli.Context) error {
// At this point, app.Before has already parsed the user's chosen
// config file. So no need to handle that here.
config := c.App.Metadata["config"].(*server.Config)
if c.Bool("default") {
config = server.DefaultConfig()
}
// Output the commented config.
return commentedConfigTemplate.ExecuteTemplate(os.Stdout, "config", config)
},
}

View file

@ -1,20 +0,0 @@
// +build linux
package main
import (
"github.com/Sirupsen/logrus"
systemdDaemon "github.com/coreos/go-systemd/daemon"
)
func sdNotify() {
if _, err := systemdDaemon.SdNotify(true, "READY=1"); err != nil {
logrus.Warnf("Failed to sd_notify systemd: %v", err)
}
}
// notifySystem sends a message to the host when the server is ready to be used
func notifySystem() {
// Tell the init daemon we are accepting requests
go sdNotify()
}

View file

@ -1,331 +0,0 @@
package main
import (
"fmt"
"net"
"os"
"os/signal"
"sort"
"strings"
"syscall"
"runtime/pprof"
"github.com/Sirupsen/logrus"
"github.com/containers/storage/pkg/reexec"
"github.com/kubernetes-incubator/cri-o/server"
"github.com/opencontainers/selinux/go-selinux"
"github.com/urfave/cli"
"google.golang.org/grpc"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
)
const ociConfigPath = "/etc/ocid/ocid.conf"
func mergeConfig(config *server.Config, ctx *cli.Context) error {
// Don't parse the config if the user explicitly set it to "".
if path := ctx.GlobalString("config"); path != "" {
if err := config.FromFile(path); err != nil {
if ctx.GlobalIsSet("config") || !os.IsNotExist(err) {
return err
}
// We don't error out if --config wasn't explicitly set and the
// default doesn't exist. But we will log a warning about it, so
// the user doesn't miss it.
logrus.Warnf("default configuration file does not exist: %s", ociConfigPath)
}
}
// Override options set with the CLI.
if ctx.GlobalIsSet("conmon") {
config.Conmon = ctx.GlobalString("conmon")
}
if ctx.GlobalIsSet("pause-command") {
config.PauseCommand = ctx.GlobalString("pause-command")
}
if ctx.GlobalIsSet("pause-image") {
config.PauseImage = ctx.GlobalString("pause-image")
}
if ctx.GlobalIsSet("signature-policy") {
config.SignaturePolicyPath = ctx.GlobalString("signature-policy")
}
if ctx.GlobalIsSet("root") {
config.Root = ctx.GlobalString("root")
}
if ctx.GlobalIsSet("runroot") {
config.RunRoot = ctx.GlobalString("runroot")
}
if ctx.GlobalIsSet("storage-driver") {
config.Storage = ctx.GlobalString("storage-driver")
}
if ctx.GlobalIsSet("storage-opt") {
config.StorageOptions = ctx.GlobalStringSlice("storage-opt")
}
if ctx.GlobalIsSet("default-transport") {
config.DefaultTransport = ctx.GlobalString("default-transport")
}
if ctx.GlobalIsSet("listen") {
config.Listen = ctx.GlobalString("listen")
}
if ctx.GlobalIsSet("runtime") {
config.Runtime = ctx.GlobalString("runtime")
}
if ctx.GlobalIsSet("selinux") {
config.SELinux = ctx.GlobalBool("selinux")
}
if ctx.GlobalIsSet("seccomp-profile") {
config.SeccompProfile = ctx.GlobalString("seccomp-profile")
}
if ctx.GlobalIsSet("apparmor-profile") {
config.ApparmorProfile = ctx.GlobalString("apparmor-profile")
}
if ctx.GlobalIsSet("cgroup-manager") {
config.CgroupManager = ctx.GlobalString("cgroup-manager")
}
if ctx.GlobalIsSet("cni-config-dir") {
config.NetworkDir = ctx.GlobalString("cni-config-dir")
}
if ctx.GlobalIsSet("cni-plugin-dir") {
config.PluginDir = ctx.GlobalString("cni-plugin-dir")
}
return nil
}
func catchShutdown(gserver *grpc.Server, sserver *server.Server, signalled *bool) {
sig := make(chan os.Signal, 10)
signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
go func() {
for s := range sig {
switch s {
case syscall.SIGINT:
logrus.Debugf("Caught SIGINT")
case syscall.SIGTERM:
logrus.Debugf("Caught SIGTERM")
default:
continue
}
*signalled = true
gserver.GracefulStop()
return
}
}()
}
func main() {
if reexec.Init() {
return
}
app := cli.NewApp()
app.Name = "ocid"
app.Usage = "ocid server"
app.Version = "0.3"
app.Metadata = map[string]interface{}{
"config": server.DefaultConfig(),
}
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "config",
Value: ociConfigPath,
Usage: "path to configuration file",
},
cli.StringFlag{
Name: "conmon",
Usage: "path to the conmon executable",
},
cli.BoolFlag{
Name: "debug",
Usage: "enable debug output for logging",
},
cli.StringFlag{
Name: "listen",
Usage: "path to ocid socket",
},
cli.StringFlag{
Name: "log",
Value: "",
Usage: "set the log file path where internal debug information is written",
},
cli.StringFlag{
Name: "log-format",
Value: "text",
Usage: "set the format used by logs ('text' (default), or 'json')",
},
cli.StringFlag{
Name: "pause-command",
Usage: "name of the pause command in the pause image",
},
cli.StringFlag{
Name: "pause-image",
Usage: "name of the pause image",
},
cli.StringFlag{
Name: "signature-policy",
Usage: "path to signature policy file",
},
cli.StringFlag{
Name: "root",
Usage: "ocid root dir",
},
cli.StringFlag{
Name: "runroot",
Usage: "ocid state dir",
},
cli.StringFlag{
Name: "storage-driver",
Usage: "storage driver",
},
cli.StringSliceFlag{
Name: "storage-opt",
Usage: "storage driver option",
},
cli.StringFlag{
Name: "default-transport",
Usage: "default transport",
},
cli.StringFlag{
Name: "runtime",
Usage: "OCI runtime path",
},
cli.StringFlag{
Name: "seccomp-profile",
Usage: "default seccomp profile path",
},
cli.StringFlag{
Name: "apparmor-profile",
Usage: "default apparmor profile name (default: \"ocid-default\")",
},
cli.BoolFlag{
Name: "selinux",
Usage: "enable selinux support",
},
cli.StringFlag{
Name: "cgroup-manager",
Usage: "cgroup manager (cgroupfs or systemd)",
},
cli.StringFlag{
Name: "cni-config-dir",
Usage: "CNI configuration files directory",
},
cli.StringFlag{
Name: "cni-plugin-dir",
Usage: "CNI plugin binaries directory",
},
cli.StringFlag{
Name: "cpu-profile",
Usage: "set the CPU profile file path",
},
}
sort.Sort(cli.FlagsByName(app.Flags))
sort.Sort(cli.FlagsByName(configCommand.Flags))
app.Commands = []cli.Command{
configCommand,
}
app.Before = func(c *cli.Context) error {
// Load the configuration file.
config := c.App.Metadata["config"].(*server.Config)
if err := mergeConfig(config, c); err != nil {
return err
}
cf := &logrus.TextFormatter{
TimestampFormat: "2006-01-02 15:04:05.000000000Z07:00",
FullTimestamp: true,
}
logrus.SetFormatter(cf)
if c.GlobalBool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
if path := c.GlobalString("log"); path != "" {
f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND|os.O_SYNC, 0666)
if err != nil {
return err
}
logrus.SetOutput(f)
}
switch c.GlobalString("log-format") {
case "text":
// retain logrus's default.
case "json":
logrus.SetFormatter(new(logrus.JSONFormatter))
default:
return fmt.Errorf("unknown log-format %q", c.GlobalString("log-format"))
}
return nil
}
app.Action = func(c *cli.Context) error {
if cp := c.GlobalString("cpu-profile"); cp != "" {
f, err := os.Create(cp)
if err != nil {
return fmt.Errorf("invalid --cpu-profile value %q", err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
config := c.App.Metadata["config"].(*server.Config)
if !config.SELinux {
selinux.SetDisabled()
}
if _, err := os.Stat(config.Runtime); os.IsNotExist(err) {
// path to runtime does not exist
return fmt.Errorf("invalid --runtime value %q", err)
}
// Remove the socket if it already exists
if _, err := os.Stat(config.Listen); err == nil {
if err := os.Remove(config.Listen); err != nil {
logrus.Fatal(err)
}
}
lis, err := net.Listen("unix", config.Listen)
if err != nil {
logrus.Fatalf("failed to listen: %v", err)
}
s := grpc.NewServer()
service, err := server.New(config)
if err != nil {
logrus.Fatal(err)
}
graceful := false
catchShutdown(s, service, &graceful)
runtime.RegisterRuntimeServiceServer(s, service)
runtime.RegisterImageServiceServer(s, service)
// after the daemon is done setting up we can notify systemd api
notifySystem()
err = s.Serve(lis)
if graceful && strings.Contains(strings.ToLower(err.Error()), "use of closed network connection") {
err = nil
}
if err2 := service.Shutdown(); err2 != nil {
logrus.Infof("error shutting down layer storage: %v", err2)
}
if err != nil {
logrus.Fatal(err)
}
return nil
}
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}

View file

@ -1,55 +1,3 @@
## Kubernetes Community Code of Conduct
# Kubernetes Community Code of Conduct
### Contributor Code of Conduct
As contributors and maintainers of this project, and in the interest of fostering
an open and welcoming community, we pledge to respect all people who contribute
through reporting issues, posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free experience for
everyone, regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance, body size, race, ethnicity, age,
religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic addresses,
without explicit permission
* Other unethical or unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are not
aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers
commit themselves to fairly and consistently applying these principles to every aspect
of managing this project. Project maintainers who do not follow or enforce the Code of
Conduct may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting one or more maintainers.
This Code of Conduct is adapted from the Contributor Covenant
(http://contributor-covenant.org), version 1.2.0, available at
http://contributor-covenant.org/version/1/2/0/
### Kubernetes Events Code of Conduct
Kubernetes events are working conferences intended for professional networking and collaboration in the
Kubernetes community. Attendees are expected to behave according to professional standards and in accordance
with their employer's policies on appropriate workplace behavior.
While at Kubernetes events or related social networking opportunities, attendees should not engage in
discriminatory or offensive speech or actions regarding gender, sexuality, race, or religion. Speakers should
be especially aware of these concerns.
The Kubernetes team does not condone any statements by speakers contrary to these standards. The Kubernetes
team reserves the right to deny entrance and/or eject from an event (without refund) any individual found to
be engaging in discriminatory or offensive speech or actions.
Please bring any concerns to to the immediate attention of Kubernetes event staff
Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md)

View file

@ -1,89 +0,0 @@
#! /bin/bash
: ${PROG:=$(basename ${BASH_SOURCE})}
_complete_() {
local options_with_args=$1
local boolean_options="$2 -h --help"
case "$prev" in
$options_with_args)
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
;;
esac
}
_kpod_launch() {
local options_with_args="
"
local boolean_options="
"
_complete_ "$options_with_args" "$boolean_options"
}
_kpod_kpod() {
local options_with_args="
"
local boolean_options="
--version -v
--help -h
"
commands="
launch
"
case "$prev" in
$main_options_with_args_glob )
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) )
;;
*)
COMPREPLY=( $( compgen -W "${commands[*]} help" -- "$cur" ) )
;;
esac
}
_cli_bash_autocomplete() {
local cur opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=()
local cur prev words cword
_get_comp_words_by_ref -n : cur prev words cword
local command=${PROG} cpos=0
local counter=1
counter=1
while [ $counter -lt $cword ]; do
case "!${words[$counter]}" in
*)
command=$(echo "${words[$counter]}" | sed 's/-/_/g')
cpos=$counter
(( cpos++ ))
break
;;
esac
(( counter++ ))
done
local completions_func=_kpod_${command}
declare -F $completions_func >/dev/null && $completions_func
eval "$previous_extglob_setting"
return 0
}
complete -F _cli_bash_autocomplete $PROG

View file

@ -2,11 +2,11 @@ src = $(wildcard *.c)
obj = $(src:.c=.o)
override LIBS += $(shell pkg-config --libs glib-2.0)
override CFLAGS += -std=c99 -Wall -Wextra $(shell pkg-config --cflags glib-2.0)
override CFLAGS += -std=c99 -Os -Wall -Wextra $(shell pkg-config --cflags glib-2.0)
conmon: $(obj)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
$(CC) -o ../bin/$@ $^ $(CFLAGS) $(LIBS)
.PHONY: clean
clean:
rm -f $(obj) conmon
rm -f $(obj) ../bin/conmon

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
{
"cniVersion": "0.2.0",
"name": "crio-bridge",
"type": "bridge",
"bridge": "cni0",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "host-local",
"subnet": "10.88.0.0/16",
"routes": [
{ "dst": "0.0.0.0/0" }
]
}
}

View file

@ -1,15 +0,0 @@
{
"cniVersion": "0.2.0",
"name": "ocid-bridge",
"type": "bridge",
"bridge": "cni0",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "host-local",
"subnet": "10.88.0.0/16",
"routes": [
{ "dst": "0.0.0.0/0" }
]
}
}

View file

@ -2,15 +2,15 @@
There are a wide variety of different [CNI][cni] network configurations. This
directory just contains some example configurations that can be used as the
basis for your own configurations (distibutions should package these files in
basis for your own configurations (distributions should package these files in
example directories).
To use these configurations, place them in `/etc/cni/net.d` (or the directory
specified by `ocid.network.network_dir` in your `ocid.conf`).
specified by `crio.network.network_dir` in your `crio.conf`).
In addition, you need to install the [CNI plugins][cni] necessary into
`/opt/cni/bin` (or the directory specified by `ocid.network.plugin_dir`). The
`/opt/cni/bin` (or the directory specified by `crio.network.plugin_dir`). The
two plugins necessary for the example CNI configurations are `loopback` and
`bridge`.
[cni]: https://github.com/containernetworking/cni
[cni]: https://github.com/containernetworking/plugins

View file

@ -1,14 +0,0 @@
.PHONY: dist
dist: ocid.spec
spectool -g ocid.spec
.PHONY: rpm
rpm: dist
rpmbuild --define "_sourcedir `pwd`" --define "_specdir `pwd`" \
--define "_rpmdir `pwd`" --define "_srcrpmdir `pwd`" -ba ocid.spec
all: rpm
clean:
rm -f *rpm *gz
rm -rf x86_64

View file

@ -1,71 +0,0 @@
%define debug_package %{nil}
%global provider github
%global provider_tld com
%global project kubernetes-incubator
%global repo cri-o
%global Name ocid
# https://github.com/kubernetes-incubator/cri-o
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}
%global commit 8ba639952a95f2e24cc98987689138b67545576c
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: %{Name}
Version: 0.0.1
Release: 1.git%{shortcommit}%{?dist}
Summary: Kubelet Container Runtime Interface (CRI) for OCI runtimes.
Group: Applications/Text
License: Apache 2.0
URL: https://%{provider_prefix}
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
BuildRequires: golang-github-cpuguy83-go-md2man
%description
The ocid package provides an implementation of the
Kubelet Container Runtime Interface (CRI) using OCI conformant runtimes.
ocid provides following functionalities:
Support multiple image formats including the existing Docker image format
Support for multiple means to download images including trust & image verification
Container image management (managing image layers, overlay filesystems, etc)
Container process lifecycle management
Monitoring and logging required to satisfy the CRI
Resource isolation as required by the CRI
%prep
%setup -q -n %{repo}-%{commit}
%build
make all
%install
%make_install
%make_install install.systemd
#define license tag if not already defined
%{!?_licensedir:%global license %doc}
%files
%{_bindir}/ocid
%{_bindir}/ocic
%{_mandir}/man5/ocid.conf.5*
%{_mandir}/man8/ocid.8*
%{_sysconfdir}/ocid.conf
%dir /%{_libexecdir}/ocid
/%{_libexecdir}/ocid/conmon
/%{_libexecdir}/ocid/pause
%{_unitdir}/ocid.service
%doc README.md
%license LICENSE
%preun
%systemd_preun %{Name}
%postun
%systemd_postun_with_restart %{Name}
%changelog
* Mon Oct 31 2016 Dan Walsh <dwalsh@redhat.com> - 0.0.1
- Initial RPM release

View file

@ -0,0 +1,29 @@
FROM centos
ENV VERSION=0 RELEASE=1 ARCH=x86_64
LABEL com.redhat.component="cri-o" \
name="$FGC/cri-o" \
version="$VERSION" \
release="$RELEASE.$DISTTAG" \
architecture="$ARCH" \
usage="atomic install --system --system-package=no crio && systemctl start crio" \
summary="The cri-o daemon as a system container." \
maintainer="Yu Qi Zhang <jzehrarnyg@gmail.com>" \
atomic.type="system"
RUN yum-config-manager --nogpgcheck --add-repo https://cbs.centos.org/repos/virt7-container-common-candidate/x86_64/os/ && \
yum install --disablerepo=extras --nogpgcheck --setopt=tsflags=nodocs -y iptables cri-o socat iproute runc && \
rpm -V iptables cri-o iproute runc && \
yum clean all && \
mkdir -p /exports/hostfs/etc/crio /exports/hostfs/opt/cni/bin/ /exports/hostfs/var/lib/containers/storage/ && \
cp /etc/crio/* /exports/hostfs/etc/crio && \
if test -e /usr/libexec/cni; then cp -Lr /usr/libexec/cni/* /exports/hostfs/opt/cni/bin/; fi
RUN sed -i '/storage_option =/s/.*/&\n"overlay.override_kernel_check=1",/' /exports/hostfs/etc/crio/crio.conf
COPY manifest.json tmpfiles.template config.json.template service.template /exports/
COPY set_mounts.sh /
COPY run.sh /usr/bin/
CMD ["/usr/bin/run.sh"]

View file

@ -0,0 +1,57 @@
# cri-o
This is the cri-o daemon as a system container.
## Building the image from source:
```
# git clone https://github.com/projectatomic/atomic-system-containers
# cd atomic-system-containers/cri-o
# docker build -t crio .
```
## Running the system container, with the atomic CLI:
Pull from registry into ostree:
```
# atomic pull --storage ostree $REGISTRY/crio
```
Or alternatively, pull from local docker:
```
# atomic pull --storage ostree docker:crio:latest
```
Install the container:
Currently we recommend using --system-package=no to avoid having rpmbuild create an rpm file
during installation. This flag will tell the atomic CLI to fall back to copying files to the
host instead.
```
# atomic install --system --system-package=no --name=crio ($REGISTRY)/crio
```
Start as a systemd service:
```
# systemctl start crio
```
Stopping the service
```
# systemctl stop crio
```
Removing the container
```
# atomic uninstall crio
```
## Binary version
You can find the image automatically built as: registry.centos.org/projectatomic/cri-o:latest

View file

@ -0,0 +1,41 @@
# This is for the purpose of building containers on the CentOS Community Container
# Pipeline. The containers are built, tested and delivered to registry.centos.org and
# lifecycled as well. A corresponding entry must exist in the container index itself,
# located at https://github.com/CentOS/container-index/tree/master/index.d
# You can know more at the following links:
# * https://github.com/CentOS/container-pipeline-service/blob/master/README.md
# * https://github.com/CentOS/container-index/blob/master/README.rst
# * https://wiki.centos.org/ContainerPipeline
# This will be part of the name of the container. It should match the job-id in index entry
job-id: cri-o
#the following are optional, can be left blank
#defaults, where applicable are filled in
#nulecule-file : nulecule
# This flag tells the container pipeline to skip user defined tests on their container
test-skip : True
# This is path of the script that initiates the user defined tests. It must be able to
# return an exit code.
test-script : null
# This is the path of custom build script.
build-script : null
# This is the path of the custom delivery script
delivery-script : null
# This flag tells the pipeline to deliver this container to docker hub.
docker-index : True
# This flag can be used to enable or disable the custom delivery
custom-delivery : False
# This flag can be used to enable or disable delivery of container to local registry
local-delivery : True
Upstreams :
- ref :
url :

View file

@ -0,0 +1,427 @@
{
"ociVersion": "1.0.0",
"platform": {
"arch": "amd64",
"os": "linux"
},
"process": {
"args": [
"/usr/bin/run.sh"
],
"capabilities": {
"ambient": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND"
],
"bounding": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND"
],
"effective": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND"
],
"inheritable": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND"
],
"permitted": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND"
]
},
"selinuxLabel": "system_u:system_r:container_runtime_t:s0",
"cwd": "/",
"env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/root/go/bin",
"TERM=xterm",
"LOG_LEVEL=$LOG_LEVEL",
"NAME=$NAME"
],
"noNewPrivileges": false,
"terminal": false,
"user": {
"gid": 0,
"uid": 0
}
},
"root": {
"path": "rootfs",
"readonly": true
},
"hooks": {},
"linux": {
"namespaces": [
{
"type": "mount"
}
],
"resources": {
"devices": [
{
"access": "rwm",
"allow": true
}
]
},
"rootfsPropagation": "private"
},
"mounts": [
{
"destination": "/tmp",
"options": [
"private",
"bind",
"rw",
"mode=755"
],
"source": "/tmp",
"type": "bind"
},
{
"destination": "/etc",
"options": [
"rbind",
"rprivate",
"rw",
"mode=755"
],
"source": "/etc",
"type": "bind"
},
{
"destination": "/lib/modules",
"options": [
"rbind",
"rprivate",
"rw",
"mode=755"
],
"source": "/lib/modules",
"type": "bind"
},
{
"destination": "/root",
"options": [
"rbind",
"rprivate",
"rw",
"mode=755"
],
"source": "/root",
"type": "bind"
},
{
"destination": "/home",
"options": [
"rbind",
"rprivate",
"rw",
"mode=755"
],
"source": "/home",
"type": "bind"
},
{
"destination": "/mnt",
"options": [
"rbind",
"rw",
"rprivate",
"mode=755"
],
"source": "/mnt",
"type": "bind"
},
{
"type": "bind",
"source": "${RUN_DIRECTORY}",
"destination": "/run",
"options": [
"rshared",
"rbind",
"rw",
"mode=755"
]
},
{
"type": "bind",
"source": "${RUN_DIRECTORY}/systemd",
"destination": "/run/systemd",
"options": [
"rslave",
"bind",
"rw",
"mode=755"
]
},
{
"destination": "/var/log",
"options": [
"rbind",
"rslave",
"rw"
],
"source": "/var/log",
"type": "bind"
},
{
"destination": "/var/lib",
"options": [
"rbind",
"rprivate",
"rw"
],
"source": "${STATE_DIRECTORY}",
"type": "bind"
},
{
"destination": "/var/lib/containers/storage",
"options": [
"rbind",
"rshared",
"rw"
],
"source": "${VAR_LIB_CONTAINERS_STORAGE}",
"type": "bind"
},
{
"destination": "/var/lib/origin",
"options": [
"rshared",
"bind",
"rw"
],
"source": "${VAR_LIB_ORIGIN}",
"type": "bind"
},
{
"destination": "/var/lib/kubelet",
"options": [
"rshared",
"bind",
"rw"
],
"source": "${VAR_LIB_KUBE}",
"type": "bind"
},
{
"destination": "/opt/cni",
"options": [
"rbind",
"rprivate",
"ro",
"mode=755"
],
"source": "${OPT_CNI}",
"type": "bind"
},
{
"destination": "/dev",
"options": [
"rprivate",
"rbind",
"rw",
"mode=755"
],
"source": "/dev",
"type": "bind"
},
{
"destination": "/sys",
"options": [
"rprivate",
"rbind",
"rw",
"mode=755"
],
"source": "/sys",
"type": "bind"
},
{
"destination": "/proc",
"options": [
"rbind",
"rw",
"mode=755"
],
"source": "/proc",
"type": "proc"
}
]
}

View file

@ -0,0 +1,10 @@
{
"version": "1.0",
"defaultValues": {
"LOG_LEVEL" : "info",
"OPT_CNI" : "/opt/cni",
"VAR_LIB_CONTAINERS_STORAGE" : "/var/lib/containers/storage",
"VAR_LIB_ORIGIN" : "/var/lib/origin",
"VAR_LIB_KUBE" : "/var/lib/kubelet"
}
}

View file

@ -0,0 +1,11 @@
#!/bin/sh
# Ensure that new process maintain this SELinux label
PID=$$
LABEL=`tr -d '\000' < /proc/$PID/attr/current`
printf %s $LABEL > /proc/self/attr/exec
test -e /etc/sysconfig/crio-storage && source /etc/sysconfig/crio-storage
test -e /etc/sysconfig/crio-network && source /etc/sysconfig/crio-network
exec /usr/bin/crio --log-level=$LOG_LEVEL

View file

@ -0,0 +1,20 @@
[Unit]
Description=crio daemon
After=network.target
[Service]
Type=notify
ExecStartPre=/bin/sh $DESTDIR/rootfs/set_mounts.sh
ExecStart=$EXEC_START
ExecStop=$EXEC_STOP
Restart=on-failure
WorkingDirectory=$DESTDIR
RuntimeDirectory=${NAME}
TasksMax=infinity
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,7 @@
#!/bin/sh
findmnt /var/lib/containers/storage > /dev/null || mount --rbind --make-shared /var/lib/containers/storage /var/lib/containers/storage
findmnt /var/lib/origin > /dev/null || mount --bind --make-shared /var/lib/origin /var/lib/origin
findmnt /var/lib/kubelet > /dev/null || mount --bind --make-shared /var/lib/kubelet /var/lib/kubelet
mount --make-shared /run
findmnt /run/systemd > /dev/null || mount --bind --make-rslave /run/systemd /run/systemd

View file

@ -0,0 +1,5 @@
d ${RUN_DIRECTORY}/crio - - - - -
d /etc/crio - - - - -
Z /etc/crio - - - - -
d ${STATE_DIRECTORY}/origin - - - - -
d ${STATE_DIRECTORY}/kubelet - - - - -

View file

@ -0,0 +1,30 @@
FROM registry.fedoraproject.org/fedora:27
ENV VERSION=0 RELEASE=1 ARCH=x86_64
LABEL com.redhat.component="cri-o" \
name="$FGC/cri-o" \
version="$VERSION" \
release="$RELEASE.$DISTTAG" \
architecture="$ARCH" \
usage="atomic install --system --system-package=no crio && systemctl start crio" \
summary="The cri-o daemon as a system container." \
maintainer="Yu Qi Zhang <jzehrarnyg@gmail.com>" \
atomic.type="system"
COPY README.md /
RUN dnf install --enablerepo=updates-testing --setopt=tsflags=nodocs -y iptables cri-o socat iproute runc && \
rpm -V iptables cri-o iproute runc && \
dnf clean all && \
mkdir -p /exports/hostfs/etc/crio /exports/hostfs/opt/cni/bin/ /exports/hostfs/var/lib/containers/storage/ && \
cp /etc/crio/* /exports/hostfs/etc/crio && \
if test -e /usr/libexec/cni; then cp -Lr /usr/libexec/cni/* /exports/hostfs/opt/cni/bin/; fi
RUN sed -i '/storage_option =/s/.*/&\n"overlay.override_kernel_check=1",/' /exports/hostfs/etc/crio/crio.conf
COPY manifest.json tmpfiles.template config.json.template service.template /exports/
COPY set_mounts.sh /
COPY run.sh /usr/bin/
CMD ["/usr/bin/run.sh"]

View file

@ -0,0 +1,53 @@
# cri-o
This is the cri-o daemon as a system container.
## Building the image from source:
```
# git clone https://github.com/projectatomic/atomic-system-containers
# cd atomic-system-containers/cri-o
# docker build -t crio .
```
## Running the system container, with the atomic CLI:
Pull from registry into ostree:
```
# atomic pull --storage ostree $REGISTRY/crio
```
Or alternatively, pull from local docker:
```
# atomic pull --storage ostree docker:crio:latest
```
Install the container:
Currently we recommend using --system-package=no to avoid having rpmbuild create an rpm file
during installation. This flag will tell the atomic CLI to fall back to copying files to the
host instead.
```
# atomic install --system --system-package=no --name=crio ($REGISTRY)/crio
```
Start as a systemd service:
```
# systemctl start crio
```
Stopping the service
```
# systemctl stop crio
```
Removing the container
```
# atomic uninstall crio
```

View file

@ -0,0 +1,432 @@
{
"ociVersion": "1.0.0",
"platform": {
"arch": "amd64",
"os": "linux"
},
"process": {
"args": [
"/usr/bin/run.sh"
],
"selinuxLabel": "system_u:system_r:container_runtime_t:s0",
"capabilities": {
"ambient": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND",
"CAP_AUDIT_READ"
],
"bounding": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND",
"CAP_AUDIT_READ"
],
"effective": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND",
"CAP_AUDIT_READ"
],
"inheritable": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND",
"CAP_AUDIT_READ"
],
"permitted": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND",
"CAP_AUDIT_READ"
]
},
"cwd": "/",
"env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/root/go/bin",
"TERM=xterm",
"LOG_LEVEL=$LOG_LEVEL",
"NAME=$NAME"
],
"noNewPrivileges": false,
"terminal": false,
"user": {
"gid": 0,
"uid": 0
}
},
"root": {
"path": "rootfs",
"readonly": true
},
"hooks": {},
"linux": {
"namespaces": [
{
"type": "mount"
}
],
"resources": {
"devices": [
{
"access": "rwm",
"allow": true
}
]
},
"rootfsPropagation": "private"
},
"mounts": [
{
"destination": "/tmp",
"options": [
"private",
"bind",
"rw",
"mode=755"
],
"source": "/tmp",
"type": "bind"
},
{
"destination": "/etc",
"options": [
"rbind",
"rprivate",
"rw",
"mode=755"
],
"source": "/etc",
"type": "bind"
},
{
"destination": "/lib/modules",
"options": [
"rbind",
"rprivate",
"rw",
"mode=755"
],
"source": "/lib/modules",
"type": "bind"
},
{
"destination": "/root",
"options": [
"rbind",
"rprivate",
"rw",
"mode=755"
],
"source": "/root",
"type": "bind"
},
{
"destination": "/home",
"options": [
"rbind",
"rprivate",
"rw",
"mode=755"
],
"source": "/home",
"type": "bind"
},
{
"destination": "/mnt",
"options": [
"rbind",
"rw",
"rprivate",
"mode=755"
],
"source": "/mnt",
"type": "bind"
},
{
"type": "bind",
"source": "${RUN_DIRECTORY}",
"destination": "/run",
"options": [
"rshared",
"rbind",
"rw",
"mode=755"
]
},
{
"type": "bind",
"source": "${RUN_DIRECTORY}/systemd",
"destination": "/run/systemd",
"options": [
"rslave",
"bind",
"rw",
"mode=755"
]
},
{
"destination": "/var/log",
"options": [
"rbind",
"rslave",
"rw"
],
"source": "/var/log",
"type": "bind"
},
{
"destination": "/var/lib",
"options": [
"rbind",
"rprivate",
"rw"
],
"source": "${STATE_DIRECTORY}",
"type": "bind"
},
{
"destination": "/var/lib/containers/storage",
"options": [
"rbind",
"rshared",
"rw"
],
"source": "${VAR_LIB_CONTAINERS_STORAGE}",
"type": "bind"
},
{
"destination": "/var/lib/origin",
"options": [
"rshared",
"bind",
"rw"
],
"source": "${VAR_LIB_ORIGIN}",
"type": "bind"
},
{
"destination": "/var/lib/kubelet",
"options": [
"rshared",
"bind",
"rw"
],
"source": "${VAR_LIB_KUBE}",
"type": "bind"
},
{
"destination": "/opt/cni",
"options": [
"rbind",
"rprivate",
"ro",
"mode=755"
],
"source": "${OPT_CNI}",
"type": "bind"
},
{
"destination": "/dev",
"options": [
"rprivate",
"rbind",
"rw",
"mode=755"
],
"source": "/dev",
"type": "bind"
},
{
"destination": "/sys",
"options": [
"rprivate",
"rbind",
"rw",
"mode=755"
],
"source": "/sys",
"type": "bind"
},
{
"destination": "/proc",
"options": [
"rbind",
"rw",
"mode=755"
],
"source": "/proc",
"type": "proc"
}
]
}

View file

@ -0,0 +1,10 @@
{
"version": "1.0",
"defaultValues": {
"LOG_LEVEL" : "info",
"OPT_CNI" : "/opt/cni",
"VAR_LIB_CONTAINERS_STORAGE" : "/var/lib/containers/storage",
"VAR_LIB_ORIGIN" : "/var/lib/origin",
"VAR_LIB_KUBE" : "/var/lib/kubelet"
}
}

View file

@ -0,0 +1,11 @@
#!/bin/sh
# Ensure that new process maintain this SELinux label
PID=$$
LABEL=`tr -d '\000' < /proc/$PID/attr/current`
printf %s $LABEL > /proc/self/attr/exec
test -e /etc/sysconfig/crio-storage && source /etc/sysconfig/crio-storage
test -e /etc/sysconfig/crio-network && source /etc/sysconfig/crio-network
exec /usr/bin/crio --log-level=$LOG_LEVEL

View file

@ -0,0 +1,20 @@
[Unit]
Description=crio daemon
After=network.target
[Service]
Type=notify
ExecStartPre=/bin/sh $DESTDIR/rootfs/set_mounts.sh
ExecStart=$EXEC_START
ExecStop=$EXEC_STOP
Restart=on-failure
WorkingDirectory=$DESTDIR
RuntimeDirectory=${NAME}
TasksMax=infinity
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,7 @@
#!/bin/sh
findmnt /var/lib/containers/storage > /dev/null || mount --rbind --make-shared /var/lib/containers/storage /var/lib/containers/storage
findmnt /var/lib/origin > /dev/null || mount --bind --make-shared /var/lib/origin /var/lib/origin
findmnt /var/lib/kubelet > /dev/null || mount --bind --make-shared /var/lib/kubelet /var/lib/kubelet
mount --make-shared /run
findmnt /run/systemd > /dev/null || mount --bind --make-rslave /run/systemd /run/systemd

View file

@ -0,0 +1,5 @@
d ${RUN_DIRECTORY}/crio - - - - -
d /etc/crio - - - - -
Z /etc/crio - - - - -
d ${STATE_DIRECTORY}/origin - - - - -
d ${STATE_DIRECTORY}/kubelet - - - - -

View file

@ -0,0 +1,41 @@
#oit## This file is managed by the OpenShift Image Tool
#oit## by the OpenShift Continuous Delivery team.
#oit##
#oit## Any yum repos listed in this file will effectively be ignored during CD builds.
#oit## Yum repos must be enabled in the oit configuration files.
#oit## Some aspects of this file may be managed programmatically. For example, the image name, labels (version,
#oit## release, and other), and the base FROM. Changes made directly in distgit may be lost during the next
#oit## reconciliation.
#oit##
FROM rhel7:7-released
RUN \
yum install --setopt=tsflags=nodocs -y socat iptables cri-o iproute runc skopeo-containers container-selinux && \
rpm -V socat iptables cri-o iproute runc skopeo-containers container-selinux && \
yum clean all && \
mkdir -p /exports/hostfs/etc/crio /exports/hostfs/opt/cni/bin/ /exports/hostfs/var/lib/containers/storage/ && \
cp /etc/crio/* /exports/hostfs/etc/crio && \
if test -e /usr/libexec/cni; then cp -Lr /usr/libexec/cni/* /exports/hostfs/opt/cni/bin/; fi
COPY manifest.json tmpfiles.template config.json.template service.template /exports/
COPY set_mounts.sh /
COPY run.sh /usr/bin/
CMD ["/usr/bin/run.sh"]
LABEL \
com.redhat.component="cri-o-docker" \
io.k8s.description="CRI-O is an implementation of the Kubernetes CRI. It is a lightweight, OCI-compliant runtime that is native to kubernetes. CRI-O supports OCI container images and can pull from any container registry." \
maintainer="Jhon Honce <jhonce@redhat.com>" \
name="openshift3/cri-o" \
License="GPLv2+" \
io.k8s.display-name="CRI-O" \
summary="OCI-based implementation of Kubernetes Container Runtime Interface" \
release="0.13.0.0" \
version="v3.8.0" \
architecture="x86_64" \
usage="atomic install --system --system-package=no crio && systemctl start crio" \
vendor="Red Hat" \
io.openshift.tags="cri-o system rhel7" \
atomic.type="system"

View file

@ -0,0 +1,422 @@
{
"ociVersion": "1.0.0",
"platform": {
"arch": "amd64",
"os": "linux"
},
"process": {
"args": [
"/usr/bin/run.sh"
],
"capabilities": {
"ambient": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND"
],
"bounding": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND"
],
"effective": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND"
],
"inheritable": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND"
],
"permitted": [
"CAP_CHOWN",
"CAP_FOWNER",
"CAP_FSETID",
"CAP_KILL",
"CAP_SETGID",
"CAP_SETUID",
"CAP_SETPCAP",
"CAP_LINUX_IMMUTABLE",
"CAP_NET_BIND_SERVICE",
"CAP_NET_BROADCAST",
"CAP_NET_ADMIN",
"CAP_NET_RAW",
"CAP_IPC_LOCK",
"CAP_IPC_OWNER",
"CAP_SYS_MODULE",
"CAP_SYS_RAWIO",
"CAP_SYS_CHROOT",
"CAP_SYS_PTRACE",
"CAP_SYS_PACCT",
"CAP_SYS_ADMIN",
"CAP_SYS_BOOT",
"CAP_SYS_NICE",
"CAP_SYS_RESOURCE",
"CAP_SYS_TIME",
"CAP_SYS_TTY_CONFIG",
"CAP_MKNOD",
"CAP_LEASE",
"CAP_AUDIT_WRITE",
"CAP_AUDIT_CONTROL",
"CAP_SETFCAP",
"CAP_DAC_OVERRIDE",
"CAP_MAC_OVERRIDE",
"CAP_DAC_READ_SEARCH",
"CAP_MAC_ADMIN",
"CAP_SYSLOG",
"CAP_WAKE_ALARM",
"CAP_BLOCK_SUSPEND"
]
},
"selinuxLabel": "system_u:system_r:container_runtime_t:s0",
"cwd": "/",
"env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/root/go/bin",
"TERM=xterm",
"LOG_LEVEL=$LOG_LEVEL",
"NAME=$NAME"
],
"noNewPrivileges": false,
"terminal": false,
"user": {
"gid": 0,
"uid": 0
}
},
"root": {
"path": "rootfs",
"readonly": true
},
"hooks": {},
"linux": {
"namespaces": [{
"type": "mount"
}],
"resources": {
"devices": [{
"access": "rwm",
"allow": true
}]
},
"rootfsPropagation": "private"
},
"mounts": [{
"destination": "/tmp",
"options": [
"private",
"bind",
"rw",
"mode=755"
],
"source": "/tmp",
"type": "bind"
},
{
"destination": "/etc",
"options": [
"rbind",
"rprivate",
"rw",
"mode=755"
],
"source": "/etc",
"type": "bind"
},
{
"destination": "/lib/modules",
"options": [
"rbind",
"rprivate",
"rw",
"mode=755"
],
"source": "/lib/modules",
"type": "bind"
},
{
"destination": "/root",
"options": [
"rbind",
"rprivate",
"rw",
"mode=755"
],
"source": "/root",
"type": "bind"
},
{
"destination": "/home",
"options": [
"rbind",
"rprivate",
"rw",
"mode=755"
],
"source": "/home",
"type": "bind"
},
{
"destination": "/mnt",
"options": [
"rbind",
"rw",
"rprivate",
"mode=755"
],
"source": "/mnt",
"type": "bind"
},
{
"type": "bind",
"source": "${RUN_DIRECTORY}",
"destination": "/run",
"options": [
"rshared",
"rbind",
"rw",
"mode=755"
]
},
{
"type": "bind",
"source": "${RUN_DIRECTORY}/systemd",
"destination": "/run/systemd",
"options": [
"rslave",
"bind",
"rw",
"mode=755"
]
},
{
"destination": "/var/log",
"options": [
"rbind",
"rslave",
"rw"
],
"source": "/var/log",
"type": "bind"
},
{
"destination": "/var/lib",
"options": [
"rbind",
"rprivate",
"rw"
],
"source": "${STATE_DIRECTORY}",
"type": "bind"
},
{
"destination": "/var/lib/containers/storage",
"options": [
"rbind",
"rshared",
"rw"
],
"source": "${VAR_LIB_CONTAINERS_STORAGE}",
"type": "bind"
},
{
"destination": "/var/lib/origin",
"options": [
"rshared",
"bind",
"rw"
],
"source": "${VAR_LIB_ORIGIN}",
"type": "bind"
},
{
"destination": "/var/lib/kubelet",
"options": [
"rshared",
"bind",
"rw"
],
"source": "${VAR_LIB_KUBE}",
"type": "bind"
},
{
"destination": "/opt/cni",
"options": [
"rbind",
"rprivate",
"ro",
"mode=755"
],
"source": "${OPT_CNI}",
"type": "bind"
},
{
"destination": "/dev",
"options": [
"rprivate",
"rbind",
"rw",
"mode=755"
],
"source": "/dev",
"type": "bind"
},
{
"destination": "/sys",
"options": [
"rprivate",
"rbind",
"rw",
"mode=755"
],
"source": "/sys",
"type": "bind"
},
{
"destination": "/proc",
"options": [
"rbind",
"rw",
"mode=755"
],
"source": "/proc",
"type": "proc"
}
]
}

View file

@ -0,0 +1,37 @@
% CRI-O (1) Container Image Pages
% Jhon Honce
% September 7, 2017
# NAME
cri-o - OCI-based implementation of Kubernetes Container Runtime Interface
# DESCRIPTION
CRI-O is an implementation of the Kubernetes CRI. It is a lightweight, OCI-compliant runtime that is native to kubernetes. CRI-O supports OCI container images and can pull from any container registry.
You can find more information on the CRI-O project at <https://github.com/kubernetes-incubator/cri-o/>
# USAGE
Pull from local docker and install system container:
```
# atomic pull --storage ostree docker:openshift3/cri-o:latest
# atomic install --system --system-package=no --name cri-o openshift3/cri-o
```
Start and enable as a systemd service:
```
# systemctl enable --now cri-o
```
Stopping the service
```
# systemctl stop cri-o
```
Removing the container
```
# atomic uninstall cri-o
```
# SEE ALSO
man systemd(1)

View file

@ -0,0 +1,10 @@
{
"version": "1.0",
"defaultValues": {
"LOG_LEVEL": "info",
"OPT_CNI": "/opt/cni",
"VAR_LIB_CONTAINERS_STORAGE": "/var/lib/containers/storage",
"VAR_LIB_ORIGIN": "/var/lib/origin",
"VAR_LIB_KUBE": "/var/lib/kubelet"
}
}

View file

@ -0,0 +1,11 @@
#!/bin/sh
# Ensure that new process maintain this SELinux label
PID=$$
LABEL=`tr -d '\000' < /proc/$PID/attr/current`
printf %s $LABEL > /proc/self/attr/exec
test -e /etc/sysconfig/crio-storage && source /etc/sysconfig/crio-storage
test -e /etc/sysconfig/crio-network && source /etc/sysconfig/crio-network
exec /usr/bin/crio --log-level=$LOG_LEVEL

View file

@ -0,0 +1,20 @@
[Unit]
Description=crio daemon
After=network.target
[Service]
Type=notify
ExecStartPre=/bin/sh $DESTDIR/rootfs/set_mounts.sh
ExecStart=$EXEC_START
ExecStop=$EXEC_STOP
Restart=on-failure
WorkingDirectory=$DESTDIR
RuntimeDirectory=${NAME}
TasksMax=infinity
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,7 @@
#!/bin/sh
findmnt /var/lib/containers/storage > /dev/null || mount --rbind --make-shared /var/lib/containers/storage /var/lib/containers/storage
findmnt /var/lib/origin > /dev/null || mount --bind --make-shared /var/lib/origin /var/lib/origin
findmnt /var/lib/kubelet > /dev/null || mount --bind --make-shared /var/lib/kubelet /var/lib/kubelet
mount --make-shared /run
findmnt /run/systemd > /dev/null || mount --bind --make-rslave /run/systemd /run/systemd

View file

@ -0,0 +1,5 @@
d ${RUN_DIRECTORY}/crio - - - - -
d /etc/crio - - - - -
Z /etc/crio - - - - -
d ${STATE_DIRECTORY}/origin - - - - -
d ${STATE_DIRECTORY}/kubelet - - - - -

View file

@ -0,0 +1,14 @@
[Unit]
Description=Shutdown CRIO containers before shutting down the system
Wants=crio.service
After=crio.service
Documentation=man:crio(8)
[Service]
Type=oneshot
ExecStart=/usr/bin/true
ExecStop=mkdir -p /var/lib/crio; touch /var/lib/crio/crio.shutdown
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,24 @@
[Unit]
Description=Open Container Initiative Daemon
Documentation=https://github.com/kubernetes-incubator/cri-o
After=network-online.target
[Service]
Type=notify
EnvironmentFile=-/etc/sysconfig/crio-storage
EnvironmentFile=-/etc/sysconfig/crio-network
Environment=GOTRACEBACK=crash
ExecStart=/usr/local/bin/crio \
$CRIO_STORAGE_OPTIONS \
$CRIO_NETWORK_OPTIONS
ExecReload=/bin/kill -s HUP $MAINPID
TasksMax=infinity
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
OOMScoreAdjust=-999
TimeoutStartSec=0
Restart=on-abnormal
[Install]
WantedBy=multi-user.target

View file

@ -1,14 +0,0 @@
[Unit]
Description=Shutdown OCID containers before shutting down the system
Wants=ocid.service
After=ocid.service
Documentation=man:ocid(8)
[Service]
Type=oneshot
ExecStart=/usr/bin/true
ExecStop=mkdir -p /var/lib/ocid; touch /var/lib/ocid/ocid.shutdown
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View file

@ -1,23 +0,0 @@
[Unit]
Description=Open Container Initiative Daemon
Documentation=https://github.com/kubernetes-incubator/cri-o
After=network.target
[Service]
Type=notify
EnvironmentFile=-/etc/sysconfig/ocid-storage
EnvironmentFile=-/etc/sysconfig/ocid-network
Environment=GOTRACEBACK=crash
ExecStart=/usr/bin/ocid \
$OCID_STORAGE_OPTIONS \
$OCID_NETWORK_OPTIONS \
ExecReload=/bin/kill -s HUP $MAINPID
TasksMax=8192
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
Restart=on-abnormal
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,21 @@
# Fedora and RHEL Integration and End-to-End Tests
This directory contains playbooks to set up for and run the integration and
end-to-end tests for CRI-O on RHEL and Fedora hosts. Two entrypoints exist:
- `main.yml`: sets up the machine and runs tests
- `results.yml`: gathers test output to `/tmp/artifacts`
When running `main.yml`, three tags are present:
- `setup`: run all tasks to set up the system for testing
- `e2e`: build CRI-O from source and run Kubernetes node E2Es
- `integration`: build CRI-O from source and run the local integration suite
The playbooks assume the following things about your system:
- on RHEL, the server and extras repos are configured and certs are present
- `ansible` is installed and the host is boot-strapped to allow `ansible` to run against it
- the `$GOPATH` is set and present for all shells (*e.g.* written in `/etc/environment`)
- CRI-O is checked out to the correct state at `${GOPATH}/src/github.com/kubernetes-incubator/cri-o`
- the user running the playbook has access to passwordless `sudo`

View file

@ -0,0 +1,359 @@
# config file for ansible -- http://ansible.com/
# ==============================================
# nearly all parameters can be overridden in ansible-playbook
# or with command line flags. ansible will read ANSIBLE_CONFIG,
# ansible.cfg in the current working directory, .ansible.cfg in
# the home directory or /etc/ansible/ansible.cfg, whichever it
# finds first
[defaults]
# some basic default values...
#inventory = inventory
#library = /usr/share/my_modules/
#remote_tmp = $HOME/.ansible/tmp
#local_tmp = .ansible/tmp
#forks = 5
forks = 10
#poll_interval = 15
#sudo_user = root
#ask_sudo_pass = True
ask_sudo_pass = False
#ask_pass = True
ask_pass = False
#transport = smart
#remote_port = 22
#module_lang = C
#module_set_locale = True
# plays will gather facts by default, which contain information about
# the remote system.
#
# smart - gather by default, but don't regather if already gathered
# implicit - gather by default, turn off with gather_facts: False
# explicit - do not gather by default, must say gather_facts: True
#gathering = implicit
gathering = smart
# by default retrieve all facts subsets
# all - gather all subsets
# network - gather min and network facts
# hardware - gather hardware facts (longest facts to retrieve)
# virtual - gather min and virtual facts
# facter - import facts from facter
# ohai - import facts from ohai
# You can combine them using comma (ex: network,virtual)
# You can negate them using ! (ex: !hardware,!facter,!ohai)
# A minimal set of facts is always gathered.
gather_subset = network
# additional paths to search for roles in, colon separated
# N/B: This depends on how ansible is called
#roles_path = $WORKSPACE/kommandir_workspace/roles
# uncomment this to disable SSH key host checking
#host_key_checking = False
host_key_checking = False
# change the default callback
#stdout_callback = skippy
# enable additional callbacks
#callback_whitelist = timer, mail
# Determine whether includes in tasks and handlers are "static" by
# default. As of 2.0, includes are dynamic by default. Setting these
# values to True will make includes behave more like they did in the
# 1.x versions.
task_includes_static = True
handler_includes_static = True
# change this for alternative sudo implementations
#sudo_exe = sudo
# What flags to pass to sudo
# WARNING: leaving out the defaults might create unexpected behaviours
#sudo_flags = -H -S -n
# SSH timeout
#timeout = 10
# default user to use for playbooks if user is not specified
# (/usr/bin/ansible will use current user as default)
#remote_user = root
remote_user = root
# logging is off by default unless this path is defined
# if so defined, consider logrotate
log_path = $ARTIFACTS/main.log
# default module name for /usr/bin/ansible
#module_name = command
# use this shell for commands executed under sudo
# you may need to change this to bin/bash in rare instances
# if sudo is constrained
# executable = /bin/sh
# if inventory variables overlap, does the higher precedence one win
# or are hash values merged together? The default is 'replace' but
# this can also be set to 'merge'.
hash_behaviour = replace
# by default, variables from roles will be visible in the global variable
# scope. To prevent this, the following option can be enabled, and only
# tasks and handlers within the role will see the variables there
private_role_vars = False
# list any Jinja2 extensions to enable here:
#jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n
# if set, always use this private key file for authentication, same as
# if passing --private-key to ansible or ansible-playbook
#private_key_file = /path/to/file
# If set, configures the path to the Vault password file as an alternative to
# specifying --vault-password-file on the command line.
#vault_password_file = /path/to/vault_password_file
# format of string {{ ansible_managed }} available within Jinja2
# templates indicates to users editing templates files will be replaced.
# replacing {file}, {host} and {uid} and strftime codes with proper values.
#ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
# This short version is better used in templates as it won't flag the file as changed every run.
#ansible_managed = Ansible managed: {file} on {host}
# by default, ansible-playbook will display "Skipping [host]" if it determines a task
# should not be run on a host. Set this to "False" if you don't want to see these "Skipping"
# messages. NOTE: the task header will still be shown regardless of whether or not the
# task is skipped.
#display_skipped_hosts = True
display_skipped_hosts = False
# by default, if a task in a playbook does not include a name: field then
# ansible-playbook will construct a header that includes the task's action but
# not the task's args. This is a security feature because ansible cannot know
# if the *module* considers an argument to be no_log at the time that the
# header is printed. If your environment doesn't have a problem securing
# stdout from ansible-playbook (or you have manually specified no_log in your
# playbook on all of the tasks where you have secret information) then you can
# safely set this to True to get more informative messages.
display_args_to_stdout = False
# by default (as of 1.3), Ansible will raise errors when attempting to dereference
# Jinja2 variables that are not set in templates or action lines. Uncomment this line
# to revert the behavior to pre-1.3.
#error_on_undefined_vars = False
# by default (as of 1.6), Ansible may display warnings based on the configuration of the
# system running ansible itself. This may include warnings about 3rd party packages or
# other conditions that should be resolved if possible.
# to disable these warnings, set the following value to False:
system_warnings = False
# by default (as of 1.4), Ansible may display deprecation warnings for language
# features that should no longer be used and will be removed in future versions.
# to disable these warnings, set the following value to False:
deprecation_warnings = False
# (as of 1.8), Ansible can optionally warn when usage of the shell and
# command module appear to be simplified by using a default Ansible module
# instead. These warnings can be silenced by adjusting the following
# setting or adding warn=yes or warn=no to the end of the command line
# parameter string. This will for example suggest using the git module
# instead of shelling out to the git command.
command_warnings = False
# set plugin path directories here, separate with colons
#action_plugins = /usr/share/ansible/plugins/action
#callback_plugins = /usr/share/ansible/plugins/callback
#connection_plugins = /usr/share/ansible/plugins/connection
#lookup_plugins = /usr/share/ansible/plugins/lookup
#vars_plugins = /usr/share/ansible/plugins/vars
#filter_plugins = /usr/share/ansible/plugins/filter
#test_plugins = /usr/share/ansible/plugins/test
#strategy_plugins = /usr/share/ansible/plugins/strategy
# Most callbacks shipped with Ansible are disabled by default
# and need to be whitelisted in your ansible.cfg file in order to function.
callback_whitelist = default
# by default callbacks are not loaded for /bin/ansible, enable this if you
# want, for example, a notification or logging callback to also apply to
# /bin/ansible runs
#bin_ansible_callbacks = False
# don't like cows? that's unfortunate.
# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1
#nocows = 1
# set which cowsay stencil you'd like to use by default. When set to 'random',
# a random stencil will be selected for each task. The selection will be filtered
# against the `cow_whitelist` option below.
#cow_selection = default
#cow_selection = random
# when using the 'random' option for cowsay, stencils will be restricted to this list.
# it should be formatted as a comma-separated list with no spaces between names.
# NOTE: line continuations here are for formatting purposes only, as the INI parser
# in python does not support them.
#cow_whitelist=bud-frogs,bunny,cheese,daemon,default,dragon,elephant-in-snake,elephant,eyes,\
# hellokitty,kitty,luke-koala,meow,milk,moofasa,moose,ren,sheep,small,stegosaurus,\
# stimpy,supermilker,three-eyes,turkey,turtle,tux,udder,vader-koala,vader,www
# don't like colors either?
# set to 1 if you don't want colors, or export ANSIBLE_NOCOLOR=1
nocolor = 0
# if set to a persistent type (not 'memory', for example 'redis') fact values
# from previous runs in Ansible will be stored. This may be useful when
# wanting to use, for example, IP information from one group of servers
# without having to talk to them in the same playbook run to get their
# current IP information.
#fact_caching = memory
# retry files
# When a playbook fails by default a .retry file will be created in ~/
# You can disable this feature by setting retry_files_enabled to False
# and you can change the location of the files by setting retry_files_save_path
#retry_files_enabled = False
retry_files_enabled = False
# squash actions
# Ansible can optimise actions that call modules with list parameters
# when looping. Instead of calling the module once per with_ item, the
# module is called once with all items at once. Currently this only works
# under limited circumstances, and only with parameters named 'name'.
squash_actions = apk,apt,dnf,package,pacman,pkgng,yum,zypper
# prevents logging of task data, off by default
#no_log = False
# prevents logging of tasks, but only on the targets, data is still logged on the master/controller
no_target_syslog = True
# controls whether Ansible will raise an error or warning if a task has no
# choice but to create world readable temporary files to execute a module on
# the remote machine. This option is False by default for security. Users may
# turn this on to have behaviour more like Ansible prior to 2.1.x. See
# https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user
# for more secure ways to fix this than enabling this option.
#allow_world_readable_tmpfiles = False
# controls the compression level of variables sent to
# worker processes. At the default of 0, no compression
# is used. This value must be an integer from 0 to 9.
#var_compression_level = 9
# controls what compression method is used for new-style ansible modules when
# they are sent to the remote system. The compression types depend on having
# support compiled into both the controller's python and the client's python.
# The names should match with the python Zipfile compression types:
# * ZIP_STORED (no compression. available everywhere)
# * ZIP_DEFLATED (uses zlib, the default)
# These values may be set per host via the ansible_module_compression inventory
# variable
#module_compression = 'ZIP_DEFLATED'
# This controls the cutoff point (in bytes) on --diff for files
# set to 0 for unlimited (RAM may suffer!).
#max_diff_size = 1048576
[privilege_escalation]
#become=True
#become_method=sudo
#become_user=root
become_user=root
#become_ask_pass=False
[paramiko_connection]
# uncomment this line to cause the paramiko connection plugin to not record new host
# keys encountered. Increases performance on new host additions. Setting works independently of the
# host key checking setting above.
#record_host_keys=False
# by default, Ansible requests a pseudo-terminal for commands executed under sudo. Uncomment this
# line to disable this behaviour.
#pty=False
[ssh_connection]
# ssh arguments to use
# Leaving off ControlPersist will result in poor performance, so use
# paramiko on older platforms rather than removing it
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o PreferredAuthentications=publickey -o ConnectTimeout=13
# The path to use for the ControlPath sockets. This defaults to
# "%(directory)s/ansible-ssh-%%h-%%p-%%r", however on some systems with
# very long hostnames or very long path names (caused by long user names or
# deeply nested home directories) this can exceed the character limit on
# file socket names (108 characters for most platforms). In that case, you
# may wish to shorten the string below.
#
# Example:
# control_path = %(directory)s/%%h-%%r
#control_path = %(directory)s/ansible-ssh-%%h-%%p-%%r
# Enabling pipelining reduces the number of SSH operations required to
# execute a module on the remote server. This can result in a significant
# performance improvement when enabled, however when using "sudo:" you must
# first disable 'requiretty' in /etc/sudoers
#
# By default, this option is disabled to preserve compatibility with
# sudoers configurations that have requiretty (the default on many distros).
#
#pipelining = False
pipelining=True
# if True, make ansible use scp if the connection type is ssh
# (default is sftp)
#scp_if_ssh = True
# if False, sftp will not use batch mode to transfer files. This may cause some
# types of file transfer failures impossible to catch however, and should
# only be disabled if your sftp version has problems with batch mode
#sftp_batch_mode = False
[accelerate]
#accelerate_port = 5099
#accelerate_timeout = 30
#accelerate_connect_timeout = 5.0
# The daemon timeout is measured in minutes. This time is measured
# from the last activity to the accelerate daemon.
#accelerate_daemon_timeout = 30
# If set to yes, accelerate_multi_key will allow multiple
# private keys to be uploaded to it, though each user must
# have access to the system via SSH to add a new key. The default
# is "no".
#accelerate_multi_key = yes
[selinux]
# file systems that require special treatment when dealing with security context
# the default behaviour that copies the existing context or uses the user default
# needs to be changed to use the file system dependent context.
#special_context_filesystems=nfs,vboxsf,fuse,ramfs
# Set this to yes to allow libvirt_lxc connections to work without SELinux.
#libvirt_lxc_noseclabel = yes
[colors]
#highlight = white
#verbose = blue
#warn = bright purple
#error = red
#debug = dark gray
#deprecate = purple
#skip = cyan
#unreachable = red
#ok = green
#changed = yellow
#diff_add = green
#diff_remove = red
#diff_lines = cyan

View file

@ -0,0 +1,17 @@
---
- name: clone bats source repo
git:
repo: "https://github.com/sstephenson/bats.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/sstephenson/bats"
- name: install bats
command: "./install.sh /usr/local"
args:
chdir: "{{ ansible_env.GOPATH }}/src/github.com/sstephenson/bats"
- name: link bats
file:
src: /usr/local/bin/bats
dest: /usr/bin/bats
state: link

View file

@ -0,0 +1,79 @@
---
- name: stat the expected cri-o directory
stat:
path: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
register: dir_stat
- name: expect cri-o to be cloned already
fail:
msg: "Expected cri-o to be cloned at {{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o but it wasn't!"
when: not dir_stat.stat.exists
- name: install cri-o tools
make:
target: install.tools
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: build cri-o
make:
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: install cri-o
make:
target: install
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: install cri-o systemd files
make:
target: install.systemd
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: install cri-o config
make:
target: install.config
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
- name: install configs
copy:
src: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/{{ item.src }}"
dest: "{{ item.dest }}"
remote_src: yes
with_items:
- src: contrib/cni/10-crio-bridge.conf
dest: /etc/cni/net.d/10-crio-bridge.conf
- src: contrib/cni/99-loopback.conf
dest: /etc/cni/net.d/99-loopback.conf
- src: test/redhat_sigstore.yaml
dest: /etc/containers/registries.d/registry.access.redhat.com.yaml
- name: run with overlay
replace:
regexp: 'storage_driver = ""'
replace: 'storage_driver = "overlay"'
name: /etc/crio/crio.conf
backup: yes
- name: run with systemd cgroup manager
replace:
regexp: 'cgroup_manager = "cgroupfs"'
replace: 'cgroup_manager = "systemd"'
name: /etc/crio/crio.conf
backup: yes
- name: add docker.io default registry
lineinfile:
dest: /etc/crio/crio.conf
line: '"docker.io"'
insertafter: 'registries = \['
regexp: 'docker\.io'
state: present
- name: add overlay storage opts on RHEL/CentOS
lineinfile:
dest: /etc/crio/crio.conf
line: '"overlay.override_kernel_check=1"'
insertafter: 'storage_option = \['
regexp: 'overlay\.override_kernel_check=1'
state: present
when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'

View file

@ -0,0 +1,26 @@
---
- name: clone cri-tools source repo
git:
repo: "https://github.com/kubernetes-incubator/cri-tools.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-tools"
version: "{{ cri_tools_git_version }}"
force: "{{ force_clone | default(False) | bool}}"
- name: install crictl
command: "/usr/bin/go install github.com/kubernetes-incubator/cri-tools/cmd/crictl"
- name: install critest
command: "/usr/bin/go install github.com/kubernetes-incubator/cri-tools/cmd/critest"
- name: link crictl
file:
src: "{{ ansible_env.GOPATH }}/bin/crictl"
dest: /usr/bin/crictl
state: link
- name: link critest
file:
src: "{{ ansible_env.GOPATH }}/bin/critest"
dest: /usr/bin/critest
state: link

View file

@ -0,0 +1,67 @@
---
- name: clone kubernetes source repo
git:
repo: "https://github.com/{{ k8s_github_fork }}/kubernetes.git"
dest: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes"
# based on kube v1.9.0-alpha.2, update as needed
version: "{{ k8s_git_version }}"
force: "{{ force_clone | default(False) | bool}}"
- name: install etcd
command: "hack/install-etcd.sh"
args:
chdir: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes"
- name: build kubernetes
make:
chdir: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes"
- name: Add custom cluster service file for the e2e testing
copy:
dest: /etc/systemd/system/customcluster.service
content: |
[Unit]
After=network-online.target
Wants=network-online.target
[Service]
WorkingDirectory={{ ansible_env.GOPATH }}/src/k8s.io/kubernetes
ExecStart=/usr/local/bin/createcluster.sh
User=root
[Install]
WantedBy=multi-user.target
- name: Add create cluster background script for e2e testing
copy:
dest: /usr/local/bin/createcluster.sh
content: |
#!/bin/bash
export PATH=/usr/local/go/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/root/bin:{{ ansible_env.GOPATH }}/bin:{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/third_party/etcd:{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/_output/local/bin/linux/amd64/
export CONTAINER_RUNTIME=remote
export CGROUP_DRIVER=systemd
export CONTAINER_RUNTIME_ENDPOINT='{{ crio_socket }} --runtime-request-timeout=5m'
export ALLOW_SECURITY_CONTEXT=","
export ALLOW_PRIVILEGED=1
export DNS_SERVER_IP={{ ansible_default_ipv4.address }}
export API_HOST={{ ansible_default_ipv4.address }}
export API_HOST_IP={{ ansible_default_ipv4.address }}
export KUBE_ENABLE_CLUSTER_DNS=true
export ENABLE_HOSTPATH_PROVISIONER=true
export KUBE_ENABLE_CLUSTER_DASHBOARD=true
./hack/local-up-cluster.sh
mode: "u=rwx,g=rwx,o=x"
- name: Set kubernetes_provider to be local
lineinfile:
dest: /etc/environment
line: 'KUBERNETES_PROVIDER=local'
regexp: 'KUBERNETES_PROVIDER='
state: present
- name: Set KUBECONFIG
lineinfile:
dest: /etc/environment
line: 'KUBECONFIG=/var/run/kubernetes/admin.kubeconfig'
regexp: 'KUBECONFIG='
state: present

View file

@ -0,0 +1,50 @@
---
- name: clone plugins source repo
git:
repo: "https://github.com/containernetworking/plugins.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins"
version: "dcf7368eeab15e2affc6256f0bb1e84dd46a34de"
- name: build plugins
command: "./build.sh"
args:
chdir: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins"
- name: install plugins
copy:
src: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins/bin/{{ item }}"
dest: "/opt/cni/bin"
mode: "o=rwx,g=rx,o=rx"
remote_src: yes
with_items:
- bridge
- dhcp
- flannel
- host-local
- ipvlan
- loopback
- macvlan
- ptp
- sample
- tuning
- vlan
- name: clone runcom plugins source repo
git:
repo: "https://github.com/runcom/plugins.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins"
version: "custom-bridge"
force: yes
- name: build plugins
command: "./build.sh"
args:
chdir: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins"
- name: install custom bridge
copy:
src: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins/bin/bridge"
dest: "/opt/cni/bin/bridge-custom"
mode: "o=rwx,g=rx,o=rx"
remote_src: yes

View file

@ -0,0 +1,23 @@
---
- name: clone runc source repo
git:
repo: "https://github.com/opencontainers/runc.git"
dest: "{{ ansible_env.GOPATH }}/src/github.com/opencontainers/runc"
version: "c6e4a1ebeb1a72b529c6f1b6ee2b1ae5b868b14f"
- name: build runc
make:
params: BUILDTAGS="seccomp selinux"
chdir: "{{ ansible_env.GOPATH }}/src/github.com/opencontainers/runc"
- name: install runc
make:
target: "install"
chdir: "{{ ansible_env.GOPATH }}/src/github.com/opencontainers/runc"
- name: link runc
file:
src: /usr/local/sbin/runc
dest: /usr/bin/runc
state: link

View file

@ -0,0 +1,156 @@
'''Plugin to override the default output logic.'''
# upstream: https://gist.github.com/cliffano/9868180
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# For some reason this has to be done
import imp
import os
ANSIBLE_PATH = imp.find_module('ansible')[1]
DEFAULT_PATH = os.path.join(ANSIBLE_PATH, 'plugins/callback/default.py')
DEFAULT_MODULE = imp.load_source(
'ansible.plugins.callback.default',
DEFAULT_PATH
)
try:
from ansible.plugins.callback import CallbackBase
BASECLASS = CallbackBase
except ImportError: # < ansible 2.1
BASECLASS = DEFAULT_MODULE.CallbackModule
class CallbackModule(DEFAULT_MODULE.CallbackModule): # pylint: disable=too-few-public-methods,no-init
'''
Override for the default callback module.
Render std err/out outside of the rest of the result which it prints with
indentation.
'''
CALLBACK_VERSION = 2.0
CALLBACK_TYPE = 'stdout'
CALLBACK_NAME = 'default'
def __init__(self, *args, **kwargs):
# pylint: disable=non-parent-init-called
BASECLASS.__init__(self, *args, **kwargs)
self.failed_task = []
self.result_file = os.environ.get('AHT_RESULT_FILE')
def _dump_results(self, result):
'''Return the text to output for a result.'''
result['_ansible_verbose_always'] = True
save = {}
for key in ['stdout', 'stdout_lines', 'stderr', 'stderr_lines', 'msg']:
if key in result:
save[key] = result.pop(key)
output = BASECLASS._dump_results(self, result) # pylint: disable=protected-access
for key in ['stdout', 'stderr', 'msg']:
if key in save and save[key]:
output += '\n\n%s:\n---\n%s\n---' % (key.upper(), save[key])
for key, value in save.items():
result[key] = value
return output
def v2_runner_on_unreachable(self, result):
self.failed_task = result
if self._play.strategy == 'free' and self._last_task_banner != result._task._uuid:
self._print_task_banner(result._task)
delegated_vars = result._result.get('_ansible_delegated_vars', None)
if delegated_vars:
self._display.display("fatal: [%s -> %s]: UNREACHABLE! => %s" % (result._host.get_name(), delegated_vars['ansible_host'], self._dump_results(result._result)), color=C.COLOR_UNREACHABLE)
else:
self._display.display("fatal: [%s]: UNREACHABLE! => %s" % (result._host.get_name(), self._dump_results(result._result)), color=C.COLOR_UNREACHABLE)
def v2_runner_on_failed(self,result, ignore_errors=False):
if ignore_errors is not True:
# Sets environment variable for test failures for use in playboks.
# Handlers tasks can conditionalize themselves using this variable
# to run only on failure.
os.environ["AHT_FAILURE"] = "1"
# Save last failure
self.failed_task = result
if self._play.strategy == 'free' and self._last_task_banner != result._task._uuid:
self._print_task_banner(result._task)
delegated_vars = result._result.get('_ansible_delegated_vars', None)
if 'exception' in result._result:
if self._display.verbosity < 3:
# extract just the actual error message from the exception text
error = result._result['exception'].strip().split('\n')[-1]
msg = "An exception occurred during task execution. To see the full traceback, use -vvv. The error was: %s" % error
else:
msg = "An exception occurred during task execution. The full traceback is:\n" + result._result['exception']
self._display.display(msg, color=C.COLOR_ERROR)
if result._task.loop and 'results' in result._result:
self._process_items(result)
else:
if delegated_vars:
self._display.display("fatal: [%s -> %s]: FAILED! => %s" % (result._host.get_name(), delegated_vars['ansible_host'], self._dump_results(result._result)), color=C.COLOR_ERROR)
else:
self._display.display("fatal: [%s]: FAILED! => %s" % (result._host.get_name(), self._dump_results(result._result)), color=C.COLOR_ERROR)
if ignore_errors:
self._display.display("...ignoring", color=C.COLOR_SKIP)
def v2_playbook_on_stats(self, stats):
self._display.banner("PLAY RECAP")
hosts = sorted(stats.processed.keys())
for h in hosts:
t = stats.summarize(h)
self._display.display(u"%s : %s %s %s %s" % (
hostcolor(h, t),
colorize(u'ok', t['ok'], C.COLOR_OK),
colorize(u'changed', t['changed'], C.COLOR_CHANGED),
colorize(u'unreachable', t['unreachable'], C.COLOR_UNREACHABLE),
colorize(u'failed', t['failures'], C.COLOR_ERROR)),
screen_only=True
)
self._display.display(u"%s : %s %s %s %s" % (
hostcolor(h, t, False),
colorize(u'ok', t['ok'], None),
colorize(u'changed', t['changed'], None),
colorize(u'unreachable', t['unreachable'], None),
colorize(u'failed', t['failures'], None)),
log_only=True
)
self._display.display("", screen_only=True)
# Save result to file if environment variable exists
if self.result_file is not None:
if self.failed_task:
with open(self.result_file, 'w') as f:
f.write("PLAY: %s\n%s\n%s" % (self._play, \
self.failed_task._task, \
self._dump_results(self.failed_task._result)))
else:
open(self.result_file, 'w').close()

View file

@ -0,0 +1,45 @@
---
- name: enable and start CRI-O
systemd:
name: crio
state: started
enabled: yes
daemon_reload: yes
- name: Flush the iptables
command: iptables -F
- name: Enable localnet routing
command: sysctl -w net.ipv4.conf.all.route_localnet=1
- name: Add masquerade for localhost
command: iptables -t nat -I POSTROUTING -s 127.0.0.1 ! -d 127.0.0.1 -j MASQUERADE
- name: run critest validation
shell: "critest -c --runtime-endpoint /var/run/crio/crio.sock --image-endpoint /var/run/crio/crio.sock v"
args:
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
async: 5400
poll: 30
when: ansible_distribution not in ['RedHat', 'CentOS']
# XXX: RHEL has an additional test which fails because of selinux but disabling
# it doesn't solve the issue.
# TODO(runcom): enable skipped tests once we fix them (selinux)
# https://bugzilla.redhat.com/show_bug.cgi?id=1414236
# https://access.redhat.com/solutions/2897781
- name: run critest validation
shell: "critest -c --runtime-endpoint /var/run/crio/crio.sock --image-endpoint /var/run/crio/crio.sock -s 'should not allow privilege escalation when true' v"
args:
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
async: 5400
poll: 30
when: ansible_distribution in ['RedHat', 'CentOS']
- name: run critest benchmarks
shell: "critest -c --runtime-endpoint /var/run/crio/crio.sock --image-endpoint /var/run/crio/crio.sock b"
args:
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
async: 5400
poll: 30

View file

@ -0,0 +1,58 @@
---
- name: enable and start CRI-O
systemd:
name: crio
state: started
enabled: yes
daemon_reload: yes
- name: update the server address for the custom cluster
lineinfile:
dest: /usr/local/bin/createcluster.sh
line: "export {{ item }}={{ ansible_default_ipv4.address }}"
regexp: "^export {{ item }}="
state: present
with_items:
- DNS_SERVER_IP
- API_HOST
- API_HOST_IP
- name: enable and start the custom cluster
systemd:
name: customcluster.service
state: started
enabled: yes
daemon_reload: yes
- name: wait for the cluster to be running
command: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/_output/bin/kubectl get service kubernetes --namespace default"
register: kube_poll
until: kube_poll | succeeded
retries: 100
delay: 30
- name: ensure directory exists for e2e reports
file:
path: "{{ artifacts }}"
state: directory
# TODO remove the last test skipped once https://github.com/kubernetes-incubator/cri-o/pull/1217 is merged
- name: Buffer the e2e testing command to workaround Ansible YAML folding "feature"
set_fact:
e2e_shell_cmd: >
/usr/bin/go run hack/e2e.go
--test
--test_args="-host=https://{{ ansible_default_ipv4.address }}:6443
--ginkgo.skip=\[Slow\]|\[Serial\]|\[Disruptive\]|\[Flaky\]|\[Feature:.+\]|PersistentVolumes|\[HPA\]|should.support.building.a.client.with.a.CSR|should.support.inline.execution.and.attach
--report-dir={{ artifacts }}"
&> {{ artifacts }}/e2e.log
# Fix vim syntax hilighting: "
- name: disable SELinux
command: setenforce 0
- name: run e2e tests
shell: "{{ e2e_shell_cmd | regex_replace('\\s+', ' ') }}"
args:
chdir: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes"

View file

@ -0,0 +1,55 @@
---
- name: ensure Golang dir is empty first
file:
path: /usr/local/go
state: absent
- name: fetch Golang
unarchive:
remote_src: yes
src: "https://storage.googleapis.com/golang/go{{ version }}.linux-amd64.tar.gz"
dest: /usr/local
- name: link go toolchain
file:
src: "/usr/local/go/bin/{{ item }}"
dest: "/usr/bin/{{ item }}"
state: link
with_items:
- go
- gofmt
- godoc
- name: ensure user profile exists
file:
path: "{{ ansible_user_dir }}/.profile"
state: touch
- name: set up PATH for Go toolchain and built binaries
lineinfile:
dest: "{{ ansible_user_dir }}/.profile"
line: 'PATH={{ ansible_env.PATH }}:{{ ansible_env.GOPATH }}/bin:/usr/local/go/bin'
regexp: '^PATH='
state: present
- name: set up directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ ansible_env.GOPATH }}/src/github.com/containernetworking"
- "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator"
- "{{ ansible_env.GOPATH }}/src/github.com/k8s.io"
- "{{ ansible_env.GOPATH }}/src/github.com/sstephenson"
- "{{ ansible_env.GOPATH }}/src/github.com/opencontainers"
- name: install Go tools and dependencies
shell: /usr/bin/go get -u "github.com/{{ item }}"
with_items:
- tools/godep
- onsi/ginkgo/ginkgo
- onsi/gomega
- cloudflare/cfssl/cmd/...
- jteeuwen/go-bindata/go-bindata
- cpuguy83/go-md2man

View file

@ -0,0 +1,125 @@
- hosts: all
remote_user: root
vars_files:
- "{{ playbook_dir }}/vars.yml"
tags:
- setup
tasks:
- name: set up the system
include: system.yml
- name: install Golang tools
include: golang.yml
vars:
version: "1.8.5"
- name: clone build and install bats
include: "build/bats.yml"
- name: clone build and install cri-tools
include: "build/cri-tools.yml"
vars:
cri_tools_git_version: "b42fc3f364dd48f649d55926c34492beeb9b2e99"
- name: clone build and install kubernetes
include: "build/kubernetes.yml"
vars:
k8s_git_version: "cri-o-node-e2e-patched-logs"
k8s_github_fork: "runcom"
crio_socket: "/var/run/crio.sock"
- name: clone build and install runc
include: "build/runc.yml"
- name: clone build and install networking plugins
include: "build/plugins.yml"
- hosts: all
remote_user: root
vars_files:
- "{{ playbook_dir }}/vars.yml"
tags:
- integration
- e2e
- node-e2e
- critest
tasks:
- name: clone build and install cri-o
include: "build/cri-o.yml"
- hosts: all
remote_user: root
vars_files:
- "{{ playbook_dir }}/vars.yml"
tags:
- integration
tasks:
- name: clone build and install cri-tools
include: "build/cri-tools.yml"
vars:
force_clone: True
cri_tools_git_version: "a9e38a4a000bc1a4052fb33de1c967b8cfe9ad40"
- name: run cri-o integration tests
include: test.yml
- hosts: all
remote_user: root
vars_files:
- "{{ playbook_dir }}/vars.yml"
tags:
- critest
tasks:
- name: install Golang tools
include: golang.yml
vars:
version: "1.9.2"
- name: setup critest
include: "build/cri-tools.yml"
vars:
force_clone: True
cri_tools_git_version: "a9e38a4a000bc1a4052fb33de1c967b8cfe9ad40"
- name: run critest validation and benchmarks
include: critest.yml
- hosts: all
remote_user: root
vars_files:
- "{{ playbook_dir }}/vars.yml"
tags:
- node-e2e
tasks:
- name: install Golang tools
include: golang.yml
vars:
version: "1.9.2"
- name: clone build and install kubernetes
include: "build/kubernetes.yml"
vars:
force_clone: True
k8s_git_version: "master"
k8s_github_fork: "kubernetes"
crio_socket: "/var/run/crio/crio.sock"
- name: run k8s node-e2e tests
include: node-e2e.yml
- hosts: all
remote_user: root
vars_files:
- "{{ playbook_dir }}/vars.yml"
tags:
- e2e
tasks:
- name: install Golang tools
include: golang.yml
vars:
version: "1.9.2"
- name: clone build and install kubernetes
include: "build/kubernetes.yml"
vars:
force_clone: True
# master as of 12/11/2017
k8s_git_version: "master-nfs-fix"
k8s_github_fork: "runcom"
crio_socket: "/var/run/crio/crio.sock"
- name: run k8s e2e tests
include: e2e.yml

View file

@ -0,0 +1,26 @@
---
- name: enable and start CRI-O
systemd:
name: crio
state: started
enabled: yes
daemon_reload: yes
- name: disable SELinux
command: setenforce 0
- name: Flush the iptables
command: iptables -F
- name: run node-e2e tests
shell: |
# parametrize crio socket
# cgroup-driver???
# TODO(runcom): remove conformance focus, we want everything for testgrid
make test-e2e-node PARALLELISM=1 RUNTIME=remote CONTAINER_RUNTIME_ENDPOINT=/var/run/crio.sock IMAGE_SERVICE_ENDPOINT=/var/run/crio/crio.sock TEST_ARGS='--prepull-images=true --kubelet-flags="--cgroup-driver=systemd"' FOCUS="\[Conformance\]" &> {{ artifacts }}/node-e2e.log
args:
chdir: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes"
async: 7200
poll: 10
ignore_errors: true

View file

@ -0,0 +1,62 @@
---
# vim-syntax: ansible
- hosts: '{{ hosts | default("all") }}'
vars_files:
- "{{ playbook_dir }}/vars.yml"
vars:
_result_filepaths: [] # do not use
_dstfnbuff: [] # do not use
tasks:
- name: The crio_integration_filepath is required
tags:
- integration
set_fact:
_result_filepaths: "{{ _result_filepaths + [crio_integration_filepath] }}"
- name: The crio_node_e2e_filepath is required
tags:
- e2e
set_fact:
_result_filepaths: "{{ _result_filepaths + [crio_node_e2e_filepath] }}"
- name: Verify expectations
assert:
that:
- 'result_dest_basedir | default(False, True)'
- '_result_filepaths | default(False, True)'
- '_dstfnbuff == []'
- 'results_fetched is undefined'
- name: Results directory exists
file:
path: "{{ result_dest_basedir }}"
state: directory
delegate_to: localhost
- name: destination file paths are buffered for overwrite-checking and jUnit conversion
set_fact:
_dstfnbuff: >
{{ _dstfnbuff |
union( [result_dest_basedir ~ "/" ~ inventory_hostname ~ "/" ~ item | basename] ) }}
with_items: '{{ _result_filepaths }}'
- name: Overwriting existing results assumed very very bad
fail:
msg: "Cowardly refusing to overwrite {{ item }}"
when: item | exists
delegate_to: localhost
with_items: '{{ _dstfnbuff }}'
# fetch module doesn't support directories
- name: Retrieve results from all hosts
synchronize:
checksum: True # Don't rely on date/time being in sync
archive: False # Don't bother with permissions or times
copy_links: True # We want files, not links to files
recursive: True
mode: pull
dest: '{{ result_dest_basedir }}/{{ inventory_hostname }}/' # must end in /
src: '{{ item }}'
register: results_fetched
with_items: '{{ _result_filepaths }}'

View file

@ -0,0 +1,134 @@
---
- name: Make sure we have all required packages
package:
name: "{{ item }}"
state: present
with_items:
- atomic-registries
- container-selinux
- curl
- device-mapper-devel
- expect
- findutils
- gcc
- git
- glib2-devel
- glibc-devel
- glibc-static
- gpgme-devel
- hostname
- iproute
- iptables
- krb5-workstation
- libassuan-devel
- libffi-devel
- libgpg-error-devel
- libguestfs-tools
- libseccomp-devel
- libvirt-client
- libvirt-python
- libxml2-devel
- libxslt-devel
- make
- mlocate
- nfs-utils
- nmap-ncat
- oci-register-machine
- oci-systemd-hook
- oci-umount
- openssl
- openssl-devel
- ostree-devel
- pkgconfig
- python
- python2-crypto
- python-devel
- python-rhsm-certificates
- python-virtualenv
- PyYAML
- redhat-rpm-config
- rpcbind
- rsync
- sed
- skopeo-containers
- socat
- tar
- wget
async: 600
poll: 10
- name: Add python2-boto for Fedora
package:
name: "{{ item }}"
state: present
with_items:
- python2-boto
when: ansible_distribution in ['Fedora']
- name: Add python-boto for RHEL and CentOS
package:
name: "{{ item }}"
state: present
with_items:
- python-boto
when: ansible_distribution in ['RedHat', 'CentOS']
- name: Add Btrfs for Fedora
package:
name: "{{ item }}"
state: present
with_items:
- btrfs-progs-devel
when: ansible_distribution in ['Fedora']
- name: Update all packages
package:
name: '*'
state: latest
async: 600
poll: 10
- name: Setup swap to prevent kernel firing off the OOM killer
shell: |
truncate -s 8G /root/swap && \
export SWAPDEV=$(losetup --show -f /root/swap | head -1) && \
mkswap $SWAPDEV && \
swapon $SWAPDEV && \
swapon --show
- name: ensure directories exist as needed
file:
path: "{{ item }}"
state: directory
with_items:
- /opt/cni/bin
- /etc/cni/net.d
- name: set sysctl vm.overcommit_memory=1 for CentOS
sysctl:
name: vm.overcommit_memory
state: present
value: 1
when: ansible_distribution == 'CentOS'
- name: inject hostname into /etc/hosts
lineinfile:
dest: /etc/hosts
line: '{{ ansible_default_ipv4.address }} {{ ansible_nodename }}'
insertafter: 'EOF'
regexp: '{{ ansible_default_ipv4.address }}\s+{{ ansible_nodename }}'
state: present
- name: Flush the iptables
command: iptables -F
- name: Enable localnet routing
command: sysctl -w net.ipv4.conf.all.route_localnet=1
- name: Add masquerade for localhost
command: iptables -t nat -I POSTROUTING -s 127.0.0.1 ! -d 127.0.0.1 -j MASQUERADE
- name: Update the kernel cmdline to include quota support
command: grubby --update-kernel=ALL --args="rootflags=pquota"
when: ansible_distribution in ['RedHat', 'CentOS']

View file

@ -0,0 +1,25 @@
---
- name: Make testing output verbose so it can be converted to xunit
lineinfile:
dest: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/hack/make-rules/test.sh"
line: ' go test -v "${goflags[@]:+${goflags[@]}}" \'
regexp: ' go test \"\$'
state: present
- name: set extra storage options
set_fact:
extra_storage_opts: " --storage-opt overlay.override_kernel_check=1"
when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'
- name: ensure directory exists for e2e reports
file:
path: "{{ artifacts }}"
state: directory
- name: run integration tests
shell: "CGROUP_MANAGER=cgroupfs STORAGE_OPTIONS='--storage-driver=overlay{{ extra_storage_opts | default('') }}' make localintegration >& {{ artifacts }}/testout.txt"
args:
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
async: 5400
poll: 30

View file

@ -0,0 +1,8 @@
---
# For results.yml Paths use rsync 'source' conventions
artifacts: "/tmp/artifacts" # Base-directory for collection
crio_integration_filepath: "{{ artifacts }}/testout.txt"
crio_node_e2e_filepath: "{{ artifacts }}/junit_01.xml"
result_dest_basedir: '{{ lookup("env","WORKSPACE") |
default(playbook_dir, True) }}/artifacts'

View file

@ -0,0 +1,54 @@
# Pip requirements file for Ansible-based integration-testing environment.
# Intended to be utilized by venv-ansible-playbook.sh script
#
# N/B: Hashes are required here | versions frozen for stability
ansible==2.3.1.0 --hash=sha256:cd4b8f53720fcd0c351156b840fdd15ecfbec22c951b5406ec503de49d40b9f5
asn1crypto==0.22.0 --hash=sha256:d232509fefcfcdb9a331f37e9c9dc20441019ad927c7d2176cf18ed5da0ba097 \
--hash=sha256:cbbadd640d3165ab24b06ef25d1dca09a3441611ac15f6a6b452474fdf0aed1a
bcrypt==3.1.3 --hash=sha256:05b35b9842b009b44496fa5433ce462f69966291e50fbd471dbb427f399f748f \
--hash=sha256:6645c8d0ad845308de3eb9be98b6fd22a46ec5412bfc664a423e411cdd8f5488
cffi==1.10.0 --hash=sha256:c49187260043bd4c1d6a52186f9774f17d9b1da0a406798ebf4bfc12da166ade \
--hash=sha256:b3b02911eb1f6ada203b0763ba924234629b51586f72a21faacc638269f4ced5
cryptography==1.9 --hash=sha256:5518337022718029e367d982642f3e3523541e098ad671672a90b82474c84882
enum34==1.1.6 --hash=sha256:6bd0f6ad48ec2aa117d3d141940d484deccda84d4fcd884f5c3d93c23ecd8c79 \
--hash=sha256:8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1
idna==2.5 --hash=sha256:cc19709fd6d0cbfed39ea875d29ba6d4e22c0cebc510a76d6302a28385e8bb70 \
--hash=sha256:3cb5ce08046c4e3a560fc02f138d0ac63e00f8ce5901a56b32ec8b7994082aab
ipaddress==1.0.18 --hash=sha256:d34cf15d95ce9a734560f7400a8bd2ac2606f378e2a1d0eadbf1c98707e7c74a \
--hash=sha256:5d8534c8e185f2d8a1fda1ef73f2c8f4b23264e8e30063feeb9511d492a413e1
Jinja2==2.9.6 --hash=sha256:2231bace0dfd8d2bf1e5d7e41239c06c9e0ded46e70cc1094a0aa64b0afeb054 \
--hash=sha256:ddaa01a212cd6d641401cb01b605f4a4d9f37bfc93043d7f760ec70fb99ff9ff
MarkupSafe==1.0 --hash=sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665
paramiko==2.2.1 --hash=sha256:9c9402377ba8594889aab1e44a13b78eda685eb2145dc00b2353b4fbb25088cf \
--hash=sha256:ff94ae65379914ec3c960de731381f49092057b6dd1d24d18842ead5a2eb2277
pyasn1==0.2.3 --hash=sha256:0439b9bd518418260c2641a571f0e07fce4370cab13b68f19b5e023306c03cad \
--hash=sha256:738c4ebd88a718e700ee35c8d129acce2286542daa80a82823a7073644f706ad
pycparser==2.17 --hash=sha256:0aac31e917c24cb3357f5a4d5566f2cc91a19ca41862f6c3c22dc60a629673b6
pycrypto==2.6.1 --hash=sha256:f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c
PyNaCl==1.1.2 --hash=sha256:57314a7bad4bd39501dc622942f9921923673e52e126b0fc4f0214b5d25d619a \
--hash=sha256:32f52b754abf07c319c04ce16905109cab44b0e7f7c79497431d3b2000f8af8c
PyYAML==3.12 --hash=sha256:592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab
six==1.10.0 --hash=sha256:0ff78c403d9bccf5a425a6d31a12aa6b47f1c21ca4dc2573a7e2f32a97335eb1 \
--hash=sha256:105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a
virtualenv==15.1.0 --hash=sha256:39d88b533b422825d644087a21e78c45cf5af0ef7a99a1fc9fbb7b481e5c85b0 \
--hash=sha256:02f8102c2436bb03b3ee6dede1919d1dac8a427541652e5ec95171ec8adbc93a
pip==9.0.1 --hash=sha256:690b762c0a8460c303c089d5d0be034fb15a5ea2b75bdf565f40421f542fefb0

View file

@ -0,0 +1,106 @@
#!/bin/bash
# example usage
# $ ./venv-ansible-playbook.sh \
# -i 192.168.169.170 \
# --private-key=/path/to/key \
# --extra-vars "pullrequest=42" \
# --extra-vars "commit=abcd1234" \
# --user root \
# --verbose \
# $PWD/crio-integration-playbook.yaml
# All errors are fatal
set -e
SCRIPT_PATH=`realpath $(dirname $0)`
REQUIREMENTS="$SCRIPT_PATH/requirements.txt"
echo
if ! type -P virtualenv &> /dev/null
then
echo "Could not find required 'virtualenv' binary installed on system."
exit 1
fi
if [ "$#" -lt "1" ]
then
echo "No ansible-playbook command-line options specified."
echo "usage: $0 -i whatever --private-key=something --extra-vars foo=bar playbook.yml"
exit 2
fi
# Avoid dirtying up repository, keep execution bits confined to a known location
if [ -z "$WORKSPACE" ] || [ ! -d "$WORKSPACE" ]
then
export WORKSPACE="$(mktemp -d)"
echo "Using temporary \$WORKSPACE=\"$WORKSPACE\" for execution environment."
echo "Directory will be removed upon exit. Export this variable with path"
echo "to an existing directory to preserve contents."
trap 'rm -rf "$WORKSPACE"' EXIT
else
echo "Using existing \$WORKSPACE=\"$WORKSPACE\" for execution environment."
echo "Directory will be left as-is upon exit."
# Don't recycle cache, next job may have different requirements
trap 'rm -rf "$PIPCACHE"' EXIT
fi
# Create a directory to contain logs and test artifacts
export ARTIFACTS=$(mkdir -pv $WORKSPACE/artifacts | tail -1 | cut -d \' -f 2)
[ -d "$ARTIFACTS" ] || exit 3
# All command failures from now on are fatal
set -e
echo
echo "Bootstrapping trusted virtual environment, this may take a few minutes, depending on networking."
echo "(logs: \"$ARTIFACTS/crio_venv_setup_log.txt\")"
echo
(
set -x
cd "$WORKSPACE"
# When running more than once, make it fast by skipping the bootstrap
if [ ! -d "./.cri-o_venv" ]; then
# N/B: local system's virtualenv binary - uncontrolled version fixed below
virtualenv --no-site-packages --python=python2.7 ./.venvbootstrap
# Set up paths to install/operate out of $WORKSPACE/.venvbootstrap
source ./.venvbootstrap/bin/activate
# N/B: local system's pip binary - uncontrolled version fixed below
# pip may not support --cache-dir, force it's location into $WORKSPACE the ugly-way
OLD_HOME="$HOME"
export HOME="$WORKSPACE"
export PIPCACHE="$WORKSPACE/.cache/pip"
pip install --force-reinstall --upgrade pip==9.0.1
# Undo --cache-dir workaround
export HOME="$OLD_HOME"
# Install fixed, trusted, hashed versions of all requirements (including pip and virtualenv)
pip --cache-dir="$PIPCACHE" install --require-hashes \
--requirement "$SCRIPT_PATH/requirements.txt"
# Setup trusted virtualenv using hashed binary from requirements.txt
./.venvbootstrap/bin/virtualenv --no-site-packages --python=python2.7 ./.cri-o_venv
# Exit untrusted virtualenv
deactivate
fi
# Enter trusted virtualenv
source ./.cri-o_venv/bin/activate
# Upgrade stock-pip to support hashes
pip install --force-reinstall --cache-dir="$PIPCACHE" --upgrade pip==9.0.1
# Re-install from cache but validate all hashes (including on pip itself)
pip --cache-dir="$PIPCACHE" install --require-hashes \
--requirement "$SCRIPT_PATH/requirements.txt"
# Remove temporary bootstrap virtualenv
rm -rf ./.venvbootstrap
# Exit trusted virtualenv
) &> $ARTIFACTS/crio_venv_setup_log.txt;
echo
echo "Executing \"$WORKSPACE/.cri-o_venv/bin/ansible-playbook $@\""
echo
# Execute command-line arguments under virtualenv
source ${WORKSPACE}/.cri-o_venv/bin/activate
${WORKSPACE}/.cri-o_venv/bin/ansible-playbook $@

1
crictl.yaml Normal file
View file

@ -0,0 +1 @@
runtime-endpoint: /var/run/crio/crio.sock

8
crio-umount.conf Normal file
View file

@ -0,0 +1,8 @@
# This contains a list of paths on host which will be unmounted inside
# container. (If they are mounted inside container).
# If there is a "/*" at the end, that means only mounts underneath that
# mounts (submounts) will be unmounted but top level mount will remain
# in place.
/var/run/containers/*
/var/lib/containers/storage/*

142
docs/crio.8.md Normal file
View file

@ -0,0 +1,142 @@
% crio(8) Open Container Initiative Daemon
% Dan Walsh
% SEPTEMBER 2016
# NAME
crio - OCI Kubernetes Container Runtime daemon
# SYNOPSIS
crio
```
[--apparmor-profile=[value]]
[--cgroup-manager=[value]]
[--cni-config-dir=[value]]
[--cni-plugin-dir=[value]]
[--config=[value]]
[--conmon=[value]]
[--cpu-profile=[value]]
[--default-transport=[value]]
[--help|-h]
[--insecure-registry=[value]]
[--listen=[value]]
[--log=[value]]
[--log-format value]
[--log-level value]
[--pause-command=[value]]
[--pause-image=[value]]
[--registry=[value]]
[--root=[value]]
[--runroot=[value]]
[--runtime=[value]]
[--seccomp-profile=[value]]
[--selinux]
[--signature-policy=[value]]
[--storage-driver=[value]]
[--storage-opt=[value]]
[--version|-v]
```
# DESCRIPTION
OCI-based implementation of Kubernetes Container Runtime Interface Daemon
crio is meant to provide an integration path between OCI conformant runtimes and the kubelet. Specifically, it implements the Kubelet Container Runtime Interface (CRI) using OCI conformant runtimes. The scope of crio is tied to the scope of the CRI.
1. Support multiple image formats including the existing Docker image format.
2. Support for multiple means to download images including trust & image verification.
3. Container image management (managing image layers, overlay filesystems, etc).
4. Container process lifecycle management.
5. Monitoring and logging required to satisfy the CRI.
6. Resource isolation as required by the CRI.
**Usage**:
```
crio [GLOBAL OPTIONS]
crio [GLOBAL OPTIONS] config [OPTIONS]
```
# GLOBAL OPTIONS
**--apparmor_profile**="": Name of the apparmor profile to be used as the runtime's default (default: "crio-default")
**--cgroup-manager**="": cgroup manager (cgroupfs or systemd)
**--config**="": path to configuration file
**--conmon**="": path to the conmon executable (default: "/usr/local/libexec/crio/conmon")
**--cpu-profile**="": set the CPU profile file path
**--default-transport**: A prefix to prepend to image names that can't be pulled as-is.
**--help, -h**: Print usage statement
**--insecure-registry=**: Enable insecure registry communication, i.e., enable un-encrypted and/or untrusted communication.
1. List of insecure registries can contain an element with CIDR notation to specify a whole subnet.
2. Insecure registries accept HTTP or accept HTTPS with certificates from unknown CAs.
3. Enabling `--insecure-registry` is useful when running a local registry. However, because its use creates security vulnerabilities, **it should ONLY be enabled for testing purposes**. For increased security, users should add their CA to their system's list of trusted CAs instead of using `--insecure-registry`.
**--image-volumes**="": Image volume handling ('mkdir', 'bind' or 'ignore') (default: "mkdir")
1. mkdir: A directory is created inside the container root filesystem for the volumes.
2. bind: A directory is created inside container state directory and bind mounted into the container for the volumes.
3. ignore: All volumes are just ignored and no action is taken.
**--listen**="": Path to CRI-O socket (default: "/var/run/crio/crio.sock")
**--log**="": Set the log file path where internal debug information is written
**--log-format**="": Set the format used by logs ('text' (default), or 'json') (default: "text")
**--log-level**="": log crio messages above specified level: debug, info (default), warn, error, fatal or panic
**--log-size-max**="": Maximum log size in bytes for a container (default: -1 (no limit)). If it is positive, it must be >= 8192 (to match/exceed conmon read buffer).
**--pause-command**="": Path to the pause executable in the pause image (default: "/pause")
**--pause-image**="": Image which contains the pause executable (default: "kubernetes/pause")
**--pids-limit**="": Maximum number of processes allowed in a container (default: 1024)
**--enable-shared-pid-namespace**="": Enable using a shared PID namespace for containers in a pod (default: false)
**--root**="": The crio root dir (default: "/var/lib/containers/storage")
**--registry**="": Registry host which will be prepended to unqualified images, can be specified multiple times
**--runroot**="": The crio state dir (default: "/var/run/containers/storage")
**--runtime**="": OCI runtime path (default: "/usr/bin/runc")
**--selinux**=**true**|**false**: Enable selinux support (default: false)
**--seccomp-profile**="": Path to the seccomp json profile to be used as the runtime's default (default: "/etc/crio/seccomp.json")
**--signature-policy**="": Path to the signature policy json file (default: "", to use the system-wide default)
**--storage-driver**: OCI storage driver (default: "devicemapper")
**--storage-opt**: OCI storage driver option (no default)
**--cni-config-dir**="": CNI configuration files directory (default: "/etc/cni/net.d/")
**--cni-plugin-dir**="": CNI plugin binaries directory (default: "/opt/cni/bin/")
**--cpu-profile**: Set the CPU profile file path
**--version, -v**: Print the version
# COMMANDS
CRI-O's default command is to start the daemon. However, it currently offers a
single additional subcommand.
## config
Outputs a commented version of the configuration file that would've been used
by CRI-O. This allows you to save you current configuration setup and then load
it later with **--config**. Global options will modify the output.
**--default**
Output the default configuration (without taking into account any configuration options).
# SEE ALSO
crio.conf(5)
# HISTORY
Sept 2016, Originally compiled by Dan Walsh <dwalsh@redhat.com> and Aleksa Sarai <asarai@suse.de>

162
docs/crio.conf.5.md Normal file
View file

@ -0,0 +1,162 @@
% crio.conf(5) Open Container Initiative Daemon
% Aleksa Sarai
% OCTOBER 2016
# NAME
crio.conf - CRI-O configuration file
# DESCRIPTION
The CRI-O configuration file specifies all of the available command-line options
for the crio(8) program, but in a TOML format that can be more easily modified
and versioned.
# FORMAT
The [TOML format][toml] is used as the encoding of the configuration file.
Every option and subtable listed here is nested under a global "crio" table.
No bare options are used. The format of TOML can be simplified to:
[table]
option = value
[table.subtable1]
option = value
[table.subtable2]
option = value
## CRIO TABLE
The `crio` table supports the following options:
**root**=""
CRIO root dir (default: "/var/lib/containers/storage")
**runroot**=""
CRIO state dir (default: "/var/run/containers/storage")
**storage_driver**=""
CRIO storage driver (default is "overlay")
Note:
**overlay** and **overlay2** are the same driver
**storage_option**=[]
CRIO storage driver option list (no default)
Values:
"STORAGE_DRIVER.imagestore=/PATH",
Paths to additional container image stores. These are read/only and are usually stored on remote network shares, based on overlay storage format.
storage_option=[ "overlay.imagestore=/mnt/overlay", ]
"STORAGE_DRIVER.size=SIZE"
Maximum size of a container image. Default is 10GB. The size flag sets quota on the size of container images.
storage_option=[ "overlay.size=1G", ]
Note: Not all drivers support all options.
Note: In order to use the **size** option for quota on *overlay* storage you must use the *xfs* file system. The mount point that the *overlay* file system must be setup with the *pquota* flag at mount time. If you are setting up / to be used with quota, you have to modify the linux boot line in /etc/grubq2.conf and add the rootflags=pquota flag.
Example:
linux16 /vmlinuz-4.12.13-300.fc26.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet LANG=en_US.UTF-8 rootflags=pquota
## CRIO.API TABLE
**listen**=""
Path to crio socket (default: "/var/run/crio/crio.sock")
## CRIO.RUNTIME TABLE
**conmon**=""
Path to the conmon executable (default: "/usr/local/libexec/crio/conmon")
**conmon_env**=[]
Environment variable list for conmon process (default: ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",])
**log_size_max**=""
Maximum sized allowed for the container log file (default: -1)
Negative numbers indicate that no size limit is imposed.
If it is positive, it must be >= 8192 (to match/exceed conmon read buffer).
The file is truncated and re-opened so the limit is never exceeded.
**pids_limit**=""
Maximum number of processes allowed in a container (default: 1024)
**enable_shared_pid_namespace**=""
Enable using a shared PID namespace for containers in a pod (default: false)
**runtime**=""
OCI runtime path (default: "/usr/bin/runc")
**selinux**=*true*|*false*
Enable selinux support (default: false)
**signature_policy**=""
Path to the signature policy json file (default: "", to use the system-wide default)
**seccomp_profile**=""
Path to the seccomp json profile to be used as the runtime's default (default: "/etc/crio/seccomp.json")
**apparmor_profile**=""
Name of the apparmor profile to be used as the runtime's default (default: "crio-default")
**no_pivot**=*true*|*false*
Instructs the runtime to not use pivot_root, but instead use MS_MOVE
**default_mounts**=[]
List of mount points, in the form host:container, to be mounted in every container
## CRIO.IMAGE TABLE
**default_transport**
A prefix to prepend to image names that can't be pulled as-is (default: "docker://")
**image_volumes**=""
Image volume handling ('mkdir', 'bind' or 'ignore') (default: "mkdir")
mkdir: A directory is created inside the container root filesystem for the volumes.
bind: A directory is created inside container state directory and bind mounted into
the container for the volumes.
ignore: All volumes are just ignored and no action is taken.
**insecure_registries**=""
Enable insecure registry communication, i.e., enable un-encrypted
and/or untrusted communication.
List of insecure registries can contain an element with CIDR notation
to specify a whole subnet. Insecure registries accept HTTP and/or
accept HTTPS with certificates from unknown CAs.
Enabling --insecure-registry is useful when running a local registry.
However, because its use creates security vulnerabilities it should
ONLY be enabled for testing purposes. For increased security, users
should add their CA to their system's list of trusted CAs instead of
using --insecure-registry.
**pause_command**=""
Path to the pause executable in the pause image (default: "/pause")
**pause_image**=""
Image which contains the pause executable (default: "kubernetes/pause")
**registries**=""
Comma separated list of registries that will be prepended when pulling
unqualified images
## CRIO.NETWORK TABLE
**network_dir**=""
Path to CNI configuration files (default: "/etc/cni/net.d/")
**plugin_dir**=""
Path to CNI plugin binaries (default: "/opt/cni/bin/")
# SEE ALSO
crio(8)
# HISTORY
Oct 2016, Originally compiled by Aleksa Sarai <asarai@suse.de>

View file

@ -1,42 +0,0 @@
% kpod(8) # kpod-launch - Simple management tool for pods and images
% Dan Walsh
% SEPTEMBER 2016
# NAME
kpod-launch - Launch a new pod
# SYNOPSIS
**kpod launch**
[**--help**|**-h**]
# DESCRIPTION
Launch a container process in a new pod. **kpod launch** starts a process with
its own file system, its own networking, and its own isolated process tree.
The IMAGE which starts the process may define defaults related to the process
that will be launch in the pod, the networking to expose, and more, but
**kpod launch** gives final control to the operator or administrator who
starts the pod from the image. For that reason **kpod launch** has more
options than any other kpod commands.
If the IMAGE is not already loaded then **kpod launch** will pull the IMAGE, and
all image dependencies, from the repository in the same way launching **kpod
pull** IMAGE, before it starts the container from that image.
**kpod [GLOBAL OPTIONS]**
**kpod [GLOBAL OPTIONS] launch [OPTIONS]**
# GLOBAL OPTIONS
**--help, -h**
Print usage statement
# COMMANDS
## launch
Launch a pod
# SEE ALSO
kpod(1), ocid(8), ocid.conf(5)
# HISTORY
Dec 2016, Originally compiled by Dan Walsh <dwalsh@redhat.com>

View file

@ -1,39 +0,0 @@
% kpod(8) # kpod - Simple management tool for pods and images
% Dan Walsh
% SEPTEMBER 2016
# NAME
kpod
# SYNOPSIS
**kpod**
[**--help**|**-h**]
# DESCRIPTION
kpod is a simple client only tool to help with debugging issues when daemons
such as CRI runtime and the kubelet are not responding or failing. A shared API
layer could be created to share code between the daemon and kpod. kpod does not
require any daemon running. kpod utilizes the same underlying components that
ocid uses i.e. containers/image, container/storage, oci-runtime-tool/generate,
runc or any other OCI compatible runtime. kpod shares state with ocid and so
has the capability to debug pods/images created by ocid.
**kpod [GLOBAL OPTIONS]**
# GLOBAL OPTIONS
**--help, -h**
Print usage statement
**--version, -v**
Print the version
# COMMANDS
## launch
Launch a pod
# SEE ALSO
ocid(8), ocid.conf(5)
# HISTORY
Dec 2016, Originally compiled by Dan Walsh <dwalsh@redhat.com>

View file

@ -1,136 +0,0 @@
% ocid(8) Open Container Initiative Daemon
% Dan Walsh
% SEPTEMBER 2016
# NAME
ocid - Enable OCI Kubernetes Container Runtime daemon
# SYNOPSIS
**ocid**
[**--config**=[*value*]]
[**--conmon**=[*value*]]
[**--debug**]
[**--default-transport**=[*value*]]
[**--help**|**-h**]
[**--listen**=[*value*]]
[**--log**=[*value*]]
[**--log-format value**]
[**--pause-command**=[*value*]]
[**--pause-image**=[*value*]]
[**--root**=[*value*]]
[**--runroot**=[*value*]]
[**--runtime**=[*value*]]
[**--signature-policy**=[*value*]]
[**--storage-driver**=[*value*]]
[**--storage-opt**=[*value*]]
[**--selinux**]
[**--seccomp-profile**=[*value*]]
[**--apparmor-profile**=[*value*]]
[**---cni-config-dir**=[*value*]]
[**---cni-plugin-dir**=[*value*]]
[**--version**|**-v**]
# DESCRIPTION
OCI-based implementation of Kubernetes Container Runtime Interface Daemon
ocid is meant to provide an integration path between OCI conformant runtimes and the kubelet. Specifically, it implements the Kubelet Container Runtime Interface (CRI) using OCI conformant runtimes. The scope of ocid is tied to the scope of the CRI.
* Support multiple image formats including the existing Docker image format
* Support for multiple means to download images including trust & image verification
* Container image management (managing image layers, overlay filesystems, etc)
* Container process lifecycle management
* Monitoring and logging required to satisfy the CRI
* Resource isolation as required by the CRI
**ocid [GLOBAL OPTIONS]**
**ocid [GLOBAL OPTIONS] config [OPTIONS]**
# GLOBAL OPTIONS
**--apparmor_profile**=""
Name of the apparmor profile to be used as the runtime's default (default: "ocid-default")
**--config**=""
path to configuration file
**--conmon**=""
path to the conmon executable (default: "/usr/local/libexec/ocid/conmon")
**--debug**
Enable debug output for logging
**--default-transport**
A prefix to prepend to image names that can't be pulled as-is.
**--help, -h**
Print usage statement
**--listen**=""
Path to ocid socket (default: "/var/run/ocid.sock")
**--log**=""
Set the log file path where internal debug information is written
**--log-format**=""
Set the format used by logs ('text' (default), or 'json') (default: "text")
**--pause-command**=""
Path to the pause executable in the pause image (default: "/pause")
**--pause-image**=""
Image which contains the pause executable (default: "kubernetes/pause")
**--root**=""
OCID root dir (default: "/var/lib/containers/storage")
**--runroot**=""
OCID state dir (default: "/var/run/containers/storage")
**--runtime**=""
OCI runtime path (default: "/usr/bin/runc")
**--selinux**=*true*|*false*
Enable selinux support (default: false)
**--seccomp-profile**=""
Path to the seccomp json profile to be used as the runtime's default (default: "/etc/ocid/seccomp.json")
**--signature-policy**=""
Path to the signature policy json file (default: "", to use the system-wide default)
**--storage-driver**
OCI storage driver (default: "devicemapper")
**--storage-opt**
OCI storage driver option (no default)
**--cni-config-dir**=""
CNI configuration files directory (default: "/etc/cni/net.d/")
**--cni-plugin-dir**=""
CNI plugin binaries directory (default: "/opt/cni/bin/")
**--cpu-profile**
Set the CPU profile file path
**--version, -v**
Print the version
# COMMANDS
OCID's default command is to start the daemon. However, it currently offers a
single additional subcommand.
## config
Outputs a commented version of the configuration file that would've been used
by OCID. This allows you to save you current configuration setup and then load
it later with **--config**. Global options will modify the output.
**--default**
Output the default configuration (without taking into account any configuration options).
# SEE ALSO
ocid.conf(5)
# HISTORY
Sept 2016, Originally compiled by Dan Walsh <dwalsh@redhat.com> and Aleksa Sarai <asarai@suse.de>

View file

@ -1,95 +0,0 @@
% ocid.conf(5) Open Container Initiative Daemon
% Aleksa Sarai
% OCTOBER 2016
# NAME
ocid.conf - Syntax of OCID configuration file
# DESCRIPTION
The OCID configuration file specifies all of the available command-line options
for the ocid(8) program, but in a TOML format that can be more easily modified
and versioned.
# FORMAT
The [TOML format][toml] is used as the encoding of the configuration file.
Every option and subtable listed here is nested under a global "ocid" table.
No bare options are used. The format of TOML can be simplified to:
[table]
option = value
[table.subtable1]
option = value
[table.subtable2]
option = value
## OCID TABLE
The `ocid` table supports the following options:
**root**=""
OCID root dir (default: "/var/lib/containers/storage")
**runroot**=""
OCID state dir (default: "/var/run/containers/storage")
**storage_driver**=""
OCID storage driver (default is "devicemapper")
**storage_option**=[]
OCID storage driver option list (no default)
## OCID.API TABLE
**listen**=""
Path to ocid socket (default: "/var/run/ocid.sock")
## OCID.RUNTIME TABLE
**conmon**=""
Path to the conmon executable (default: "/usr/local/libexec/ocid/conmon")
**conmon_env**=[]
Environment variable list for conmon process (default: ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",])
**runtime**=""
OCI runtime path (default: "/usr/bin/runc")
**selinux**=*true*|*false*
Enable selinux support (default: false)
**signature_policy**=""
Path to the signature policy json file (default: "", to use the system-wide default)
**seccomp_profile**=""
Path to the seccomp json profile to be used as the runtime's default (default: "/etc/ocid/seccomp.json")
**apparmor_profile**=""
Name of the apparmor profile to be used as the runtime's default (default: "ocid-default")
## OCID.IMAGE TABLE
**default_transport**
A prefix to prepend to image names that can't be pulled as-is (default: "docker://")
**pause_command**=""
Path to the pause executable in the pause image (default: "/pause")
**pause_image**=""
Image which contains the pause executable (default: "kubernetes/pause")
## OCID.NETWORK TABLE
**network_dir**=""
Path to CNI configuration files (default: "/etc/cni/net.d/")
**plugin_dir**=""
Path to CNI plugin binaries (default: "/opt/cni/bin/")
# SEE ALSO
ocid(8)
# HISTORY
Oct 2016, Originally compiled by Aleksa Sarai <asarai@suse.de>

7
hack/btrfs_installed_tag.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
cc -E - > /dev/null 2> /dev/null << EOF
#include <btrfs/ioctl.h>
EOF
if test $? -ne 0 ; then
echo exclude_graphdriver_btrfs
fi

View file

@ -23,7 +23,7 @@ function find-deps() {
local deps=
# gather imports from cri-o
pkgs=$(cd ${basepath}/${srcdir} && go list -f "{{.Imports}}" . | tr ' ' '\n' | grep -v "/vendor/" | grep ${pkgname} | sed -e "s|${pkgname}/||g")
pkgs=$(cd ${basepath}/${srcdir} && go list -f "{{.Imports}}" . | tr ' ' '\n' | tr -d '[]' | grep -v "/vendor/" | grep ${pkgname} | sed -e "s|${pkgname}/||g")
# add each Go import's sources to the deps list,
# and recursively get that imports's imports too

7
hack/libdm_installed.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
cc -E - > /dev/null 2> /dev/null << EOF
#include <libdevmapper.h>
EOF
if test $? -ne 0 ; then
echo exclude_graphdriver_devicemapper
fi

4
hack/ostree_tag.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
if ! pkg-config ostree-1 2> /dev/null ; then
echo containers_image_ostree_stub
fi

4
hack/selinux_tag.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
if pkg-config libselinux 2> /dev/null ; then
echo selinux
fi

30
hack/validate/.validate Normal file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -e -o pipefail
if [ -z "$VALIDATE_UPSTREAM" ]; then
# this is kind of an expensive check, so let's not do this twice if we
# are running more than one validate bundlescript
VALIDATE_REPO='https://github.com/kubernetes-incubator/cri-o.git'
VALIDATE_BRANCH='master'
VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH"
VALIDATE_UPSTREAM="$(git rev-parse --verify FETCH_HEAD)"
VALIDATE_COMMIT_LOG="$VALIDATE_UPSTREAM..$VALIDATE_HEAD"
VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
validate_diff() {
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
git diff "$VALIDATE_COMMIT_DIFF" "$@"
fi
}
validate_log() {
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
git log "$VALIDATE_COMMIT_LOG" "$@"
fi
}
fi

Some files were not shown because too many files have changed in this diff Show more