Commit graph

975 commits

Author SHA1 Message Date
Antonio Murdaca
42d3decd28
sandbox_stop: fix import
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-01 12:16:23 +02:00
Antonio Murdaca
53945dea08
RemovePodSandbox must be idempotent
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-01 12:07:03 +02:00
Antonio Murdaca
4bb7a7cc5d
oci: do not error out on runtime state failure
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-01 11:21:20 +02:00
Antonio Murdaca
66618507ef
*: stability fixes
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-01 11:20:22 +02:00
Antonio Murdaca
717881eddb
vendor: patch c/image to pull manifest lists
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-06-01 09:55:43 +02:00
Samuel Ortiz
ba652fbcde
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 09:40:03 +02:00
Antonio Murdaca
1a105fa152
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 20:50:46 +02:00
Antonio Murdaca
4138191b8d
server: add nil checks to not panic
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-30 13:34:40 +02:00
Antonio Murdaca
e8dc54ba04
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-30 13:34:09 +02:00
Antonio Murdaca
66e9c7d2a9
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-30 13:33:36 +02:00
Antonio Murdaca
330f5cc9db
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-30 13:32:46 +02:00
Antonio Murdaca
6fb21f5d67
server: store and use image's stop signal to stop containers
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-30 13:30:52 +02:00
Antonio Murdaca
ddc6cdf69d
test: use nginx:alpine when testing pull-by-digest
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-30 13:29:22 +02:00
Antonio Murdaca
d568eb1dd5
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 18:41:04 +02:00
Antonio Murdaca
da421f8ad7
.gitignore: do not ignore *.rej files
also do some cleanup

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 18:40:59 +02:00
Antonio Murdaca
6af1c86573
Makefile: exclude ./vendor from git-validation
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:18:26 +02:00
Antonio Murdaca
0da992bbf9
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-26 15:17:33 +02:00
Antonio Murdaca
85cce7da84
Dockerfile: move to containernetworking/plugins
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:17:05 +02:00
Mrunal Patel
10adfe2fc7
test: Add a test for container OOM
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-26 15:16:19 +02:00
Mrunal Patel
f694184b31
test: Ensure image for testing oom is present
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-26 15:16:10 +02:00
Mrunal Patel
c1167dc58f
Set Container Status Reason when OOM Killed
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-26 15:16:05 +02:00
Mrunal Patel
9cab24d2d2
conmon: Disable OOM handling if cgroups not setup
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-05-26 15:15:59 +02:00
Mrunal Patel
04f525eed2
conmon: Create oom file for container on OOM notification
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-26 15:15:51 +02:00
Mrunal Patel
5c1665d33c
conmon: Add OOM eventfd to epoll monitoring list
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-26 15:15:46 +02:00
Mrunal Patel
78cb7709c7
conmon: Setup cgroups for container pid OOM notification
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-26 15:15:40 +02:00
Mrunal Patel
02efe00c12
conmon: Add helper function to get pid cgroup subsystem path
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-26 15:15:34 +02:00
Mrunal Patel
a200fcc844
conmon: Add helper for closing C stdlib FILEs
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2017-05-26 15:15:27 +02:00
Antonio Murdaca
790020e484
server: workaround images with Config.Volumes
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:14:40 +02:00
Antonio Murdaca
5ac5c94822
server: sandbox_remove: add comment on sandbox not found empty response
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:14:21 +02:00
Antonio Murdaca
7f58ef8591
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-26 15:14:12 +02:00
Antonio Murdaca
2e7a04fd4a
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-26 15:14:01 +02:00
Antonio Murdaca
3fb566ca70
server: sandbox_stop: ignore not found sandboxes
This patch matches dockershim behavior

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:13:50 +02:00
Antonio Murdaca
42cb5c1eea
test: fix typo
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:13:13 +02:00
Antonio Murdaca
71d6cf9bd0
test: add CGROUP_MANAGER env to switch to systemd
default is still cgroupfs

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:13:05 +02:00
Mrunal Patel
6b45279b51
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-26 15:12:40 +02:00
Antonio Murdaca
bfbf9d348e
Makefile: enable git-validation dangling whitespace
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:11:21 +02:00
Antonio Murdaca
05194ac258
test: fix restore test
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:09:06 +02:00
Antonio Murdaca
681a178500
test: add bad state restore test
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:09:00 +02:00
Antonio Murdaca
0edf5efa7a
server: move StopAllSandboxes in sandbox_stop.go
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:08:54 +02:00
Antonio Murdaca
e1f7f0c156
add a note on server shutdown...
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:08:46 +02:00
Antonio Murdaca
49f0857928
server: do not remove but stop sandboxes on shutdown
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:08:36 +02:00
Antonio Murdaca
f40bbce464
oci: do not serialize empty fields on disk
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:08:29 +02:00
Antonio Murdaca
c9f60011c3
server: still update status on container not found in runc
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:08:20 +02:00
Antonio Murdaca
cdb59528fc
server: ignore runc not exist errors
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:08:14 +02:00
Antonio Murdaca
ddb9e73d55
server: restore containers state from disk on startup
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:08:05 +02:00
Antonio Murdaca
d8d4861647
server: store containers state on disk
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:07:56 +02:00
Antonio Murdaca
06ec274d27
oci: ignore non existing containers on delete
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:07:50 +02:00
Antonio Murdaca
20d5a600a5
oci: save container's finished time
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:07:43 +02:00
Antonio Murdaca
c11254c0fd
server: store creation in containers
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:07:31 +02:00
Antonio Murdaca
00909c985f
oci: add container directory to Container struct
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-05-26 15:07:20 +02:00