Commit graph

584 commits

Author SHA1 Message Date
Daniel J Walsh
0a1ae89ba6
Merge pull request #1345 from runcom/fsnotify-hooks
Fsnotify hooks
2018-03-01 12:18:00 -08:00
Antonio Murdaca
0fe2aa6e2f
sandbox_stop: close/remove the netns _after_ stopping the containers
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-02-22 17:28:23 +01:00
Mrunal Patel
5f7ac28059 Update code for latest k8s
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2018-02-21 11:03:56 -08:00
Antonio Murdaca
ca94095739
server: fsnotify on hooks
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-02-19 17:05:37 +01:00
Antonio Murdaca
d6c32fa88e
server|cmd: refactor monitors chan
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-02-16 12:52:25 +01:00
Mrunal Patel
8f5e37a83c
Merge pull request #1249 from theatrus/add-container-stats
Add methods for listing and fetching container stats
2018-02-15 13:29:15 -08:00
Mrunal Patel
ea90be40c4
Merge pull request #1337 from nalind/fix-runasuser-cache
imageService: cache information about images
2018-02-15 11:22:33 -08:00
Yann Ramin
9a86dbabc2 Add logging support for base condition in debug
Signed-off-by: Yann Ramin <atrus@stackworks.net>
2018-02-14 08:10:26 -08:00
Yann Ramin
a2fc41358a Simplify filter block
Signed-off-by: Yann Ramin <atrus@stackworks.net>
2018-02-14 08:10:26 -08:00
Yann Ramin
50c94a9335 Specifying a filter with no filtering expressions is now idempotent
Signed-off-by: Yann Ramin <atrus@stackworks.net>
2018-02-14 08:10:26 -08:00
Yann Ramin
14c1c70407 Add methods for listing and fetching container stats
This uses the previously unusued lib/stats.go code to return data
about container stats to the CRI API. Helpers have been built around
filtering based on the OCI API, and CPU stat reporting has been fixed.

No data on filesystem layer usage is returned at this time.

Fixes one-half of #1248

Signed-off-by: Yann Ramin <atrus@stackworks.net>
2018-02-14 08:10:13 -08:00
Antonio Murdaca
96fb47213e
container_create: correctly set user
We had a bug in ImageStatus where we weren't returning the default
image user if set, thus running all containers as root despite a user
being set in the image config. We weren't populating the Username field
of ImageStatus.
This patch fixes that along with the handling of multiple images based
on the registry patch for multiple images.
It also fixes ListImages to return Username as well.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-02-14 13:17:20 +01:00
Antonio Murdaca
ab204b6641
sandbox: record whether sb is using host network
We need to record whether the sandbox is using hostnetwok because the
kubelet needs that information when computing pod changes. Without this
patch it could happen that a pod that's using host network is restarted
just because the sandbox's status isn't reporting that it's running
using host network.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-02-13 11:45:33 +01:00
Antonio Murdaca
a12990d4a0
container_status: expose LogPath as requested by the CRI
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-02-12 11:38:27 +01:00
Antonio Murdaca
e5fc48a3ca
sandbox: restore portMappings on restart
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-02-12 11:32:17 +01:00
Antonio Murdaca
c3f1e7aec2
container_create: read ctr annotations for hooks first
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-02-12 11:32:15 +01:00
Antonio Murdaca
a0157078ad
sandbox: fix sandbox logPath when crio restarts
We weren't setting the logPath of the sandbox when restoring sandboxes
and containers upon a crio restarts. That means that if you restart
CRI-O you get sandboxes with empty logPath. That means that when you're
starting a container in a restored sandbox you get a relative logPath
for the container:

sandboxLogPath: "/var/something"
- restore
sandboxLogPath: ""
- create container foo
containerLogPath: "foo_attempt.log"

With this patch we actually get an absolute path (which is correct):

sandboxLogPath: "/var/something"
- restore
sandboxLogPath: "/var/something"
- create container foo
containerLogPath: "/var/something/foo_attempt.log"

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-02-09 15:54:47 +01:00
Daniel J Walsh
5345c6299a
Merge pull request #1283 from lyft/imagefs-stats-1.9
Implement the stats for the image_fs_info command
2018-02-05 09:06:31 -05:00
Bo Zhao
bfaf35b063 Implement the stats for the image_fs_info command
Signed-off-by: Bo Zhao <bzhao@lyft.com>
2018-01-29 10:01:19 -08:00
Mrunal Patel
6f45c1726e container_attach: Ensure ctl file is closed
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2018-01-25 17:04:01 -08:00
Antonio Murdaca
cf37995d30
container_create: only bind mount /etc/hosts if not provided by k8s
k8s already mounts /etc/hosts from /var/lib/kubelet/pods/<ID>/etc-hosts
even for host network. We shouldn't play with it unless we're running
from crictl for instance.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2018-01-24 15:06:41 +01: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
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
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
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
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
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
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
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
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
0eaa52c356
Merge pull request #1184 from willstudy/unit_test
Adding unit tests for server/secrets.go
2017-12-01 10:04:30 +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
Antonio Murdaca
b8bba70f99
libkpod -> lib rename
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-30 17:08:26 +01: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
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
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
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
Antonio Murdaca
87f1ae214f
image_pull: fix image resolver
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-28 23:53:18 +01: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
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
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
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
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
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
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
Á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
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
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
33f699bad4
server: validate labels size to avoid dos
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-11-12 01:54:19 +01:00