Commit Graph

4473 Commits

Author SHA1 Message Date
Kir Kolyshkin fbf047bf2f
Merge pull request #2501 from XiaodongLoong/systemderror-fix
fix TestPidsSystemd and TestRunWithKernelMemorySystemd test error
2020-07-08 20:39:39 -07:00
Xiaodong Liu f57bb2fe3d fix TestPidsSystemd and TestRunWithKernelMemorySystemd test error
Signed-off-by: Xiaodong Liu <liuxiaodong@loongson.cn>
2020-07-09 09:36:03 +08:00
Mrunal Patel ce54a9d4d7
Merge pull request #2514 from rhatdan/windows
Allow libcontainer/configs to be imported on Windows
2020-07-08 14:00:54 -07:00
Kir Kolyshkin 9806eb5567
Merge pull request #2513 from lsm5/custom-PREFIX-in-Makefile
allow customizable PREFIX variable
2020-07-08 12:54:11 -07:00
Daniel J Walsh d78ee47154
Allow libcontainer/configs to be imported on Windows
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-08 15:20:37 -04:00
Kir Kolyshkin 5517d1d71d
Merge pull request #2505 from XiaodongLoong/redundant-copy-src
fix redundant source code copy issue
2020-07-08 07:37:55 -07:00
Lokesh Mandvekar bc1a9c11a2 allow customizable PREFIX variable
This change would let me specify my own PREFIX so that I can reuse
Makefile targets for building rpm packages.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-07-08 09:20:03 -04:00
Aleksa Sarai 819fcc687e
merge branch 'pr-2495'
Kir Kolyshkin (1):
  cgroups/fs/path: optimize

LGTMs: @mrunalp @cyphar
Closes #2495
2020-07-07 11:51:06 +10:00
Mrunal Patel 30dc54a995
Merge pull request #2503 from giuseppe/cgroup-fixes
cgroup, systemd: cleanup cgroups
2020-07-06 15:14:29 -07:00
Mrunal Patel 3f81131845
Merge pull request #2490 from kolyshkin/dev-opt
libct/cgroups: add SkipDevices to Resources
2020-07-06 14:28:30 -07:00
Giuseppe Scrivano 32034481ea
cgroup, systemd: cleanup cgroups
some hierarchies were created directly by .Apply() on top of systemd
managed cgroups.  systemd doesn't manage these and as a result we leak
these cgroups.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-06 23:06:16 +02:00
Mrunal Patel 46a304b592
Merge pull request #2502 from tjucoder/master
make sure pty.Close() will be called and fix comment
2020-07-06 11:49:20 -07:00
Mrunal Patel e638eda0cb
Merge pull request #2496 from kolyshkin/freeze-nits
libct/cgroups/fs: simplify/speedup freezer code
2020-07-06 11:30:01 -07:00
Xiaodong Liu a4cb88f307 redundant souce code copy
There is a docker -v flag for test in Makefile

Signed-off-by: Xiaodong Liu <liuxiaodong@loongson.cn>
2020-07-06 19:03:26 +08:00
Giuseppe Scrivano 2deaeab08f
cgroup: store the result of IsRunningSystemd
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-07-05 12:42:27 +02:00
tjucoder ab35cfe23c make sure pty.Close() will be called and fix comment
Signed-off-by: tjucoder <chinesecoder@foxmail.com>
2020-07-05 16:37:21 +08:00
Kir Kolyshkin 62a30709d2 cgroups/fs/path: optimize
The result of cgroupv1.FindCgroupMountpoint() call (which is relatively
expensive) is only used in case raw.innerPath is absolute, so it only
makes sense to call it in that case.

This drastically reduces the number of calls to FindCgroupMountpoint
during container start (from 116 to 62 in my setup).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-07-03 14:07:27 -07:00
Kir Kolyshkin 46b26bc05d cgroups/fs/Freeze: simplify
In here, defer looks like an overkill, since the code is very simple and
we already have an error path.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-07-03 14:02:57 -07:00
Kir Kolyshkin cd479f9d14 cgroupv1/freezer: don't use subsystemSet.Get()
Iterating over the list of subsystems and comparing their names to get an
instance of fs.cgroupFreezer is useless and a waste of time, since it is
a shallow type (i.e. does not have any data/state) and we can create an
instance in place.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-07-03 14:00:44 -07:00
Akihiro Suda 3cb1909c70
Merge pull request #2493 from thaJeztah/bump_ebpf
vendor: update cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775
2020-07-03 11:43:59 +09:00
Kir Kolyshkin 108ee85b82 libct/cgroups: add SkipDevices to Resources
The kubelet uses libct/cgroups code to set up cgroups. It creates a
parent cgroup (kubepods) to put the containers into.

The problem (for cgroupv2 that uses eBPF for device configuration) is
the hard requirement to have devices cgroup configured results in
leaking an eBPF program upon every kubelet restart.  program. If kubelet
is restarted 64+ times, the cgroup can't be configured anymore.

Work around this by adding a SkipDevices flag to Resources.

A check was added so that if SkipDevices is set, such a "container"
can't be started (to make sure it is only used for non-containers).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-07-02 15:19:31 -07:00
Sebastiaan van Stijn f49adb5277
vendor: update cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775
full diff: a9f01edf17...1c8d4c9ef7

drops support for go1.12, and removes dependency on the golang.org/x/xerrors
transitional package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-07-02 14:48:23 +02:00
Aleksa Sarai 6f5edda901
merge branch 'pr-2491'
Mrunal Patel (2):
  VERSION: back to development
  VERSION: release 1.0.0-rc91

Vote: +7 -0 #0
Closes #2491
2020-07-02 10:52:29 +10:00
Mrunal Patel d0e928961e VERSION: back to development
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2020-06-30 08:25:05 -07:00
Mrunal Patel 24a3cf88a7 VERSION: release 1.0.0-rc91
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2020-06-30 08:24:30 -07:00
Mrunal Patel 1b94395c06
Merge pull request #2476 from kolyshkin/cpt-err-log
fixups to tests/int/checkpoint.bats
2020-06-23 18:13:56 -07:00
Kir Kolyshkin 834c45736b
Merge pull request #2482 from kinvolk/alban/integration-tests
integration tests: fix typo in README.md

LGTMs: @cyphar @kolyshkin
2020-06-22 12:31:25 -07:00
Alban Crequy 327284eb35 integration tests: fix typo in README.md
Signed-off-by: Alban Crequy <alban@kinvolk.io>
2020-06-22 15:55:56 +02:00
Aleksa Sarai 0fa097fc37
merge branch 'pr-2481'
Tianjia Zhang (1):
  nsenter: fix repeat close() operations

LGTMs: @kolyshkin @cyphar
Closes #2481
2020-06-20 12:18:31 +10:00
Kir Kolyshkin dff7685c18
Merge pull request #2459 from tedyu/linux-cont-set-cfg
Set configs back when intelrdt configs cannot be set

LGTMS: @AkihiroSuda @kolyshkin
2020-06-19 12:57:53 -07:00
Kir Kolyshkin e643db6e0f
Merge pull request #2479 from haircommander/fix-systemd-version
systemd: parse systemdVersion when only an int is returned

LGTMS: @mrunalp @kolyshkin
2020-06-19 12:19:16 -07:00
Tianjia Zhang 04806abd39 nsenter: fix repeat close() operations
It is obvious that the loop at the first place executes at least
twice, and the close() call after the first time always returns
an EBADF error, so move these operations outside the loop that
do not need to be repeated.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
2020-06-19 19:28:39 +08:00
Akihiro Suda 9748b48742
Merge pull request #2229 from RenaudWasTaken/create-container
Add CreateRuntime, CreateContainer and StartContainer Hooks
2020-06-19 12:27:51 +09:00
Renaud Gaubert 861afa7509 Add integration tests for the new runc hooks
This patch adds a test based on real world usage of runc hooks
(libnvidia-container). We verify that mounting a library inside
a container and running ldconfig succeeds.

Signed-off-by: Renaud Gaubert <rgaubert@nvidia.com>
2020-06-19 02:39:20 +00:00
Renaud Gaubert 2f7bdf9d3b Tests the new Hook
Signed-off-by: Renaud Gaubert <rgaubert@nvidia.com>
2020-06-19 02:39:20 +00:00
Peter Hunt 6a0f64e7c9 systemd: add unit tests for systemdVersion
Signed-off-by: Peter Hunt <pehunt@redhat.com>
2020-06-18 22:30:50 -04:00
Peter Hunt 6369e38871 systemd: parse systemdVersion in more situations
there have been cases observed where instead of `v$VER.0-$OS` the systemdVersion returned is just `$VER`, or `$VER-1`.
handle these cases

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2020-06-18 22:30:50 -04:00
Mrunal Patel 819c40b34f
Merge pull request #2478 from kolyshkin/get-pids
libct/cgroups/readProcsFile: return an error if read failed
2020-06-18 16:02:08 -07:00
Kir Kolyshkin 89516d17dd libct/cgroups/readProcsFile: ret errorr if scan failed
Not sure why but the errors from scanner were ignored. Such errors
can happen if open(2) has succeeded but the subsequent read(2) fails.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-06-17 12:33:01 -07:00
Mrunal Patel 406298fdf0
Merge pull request #2466 from kolyshkin/systemd-cpu-quota-period
cgroups/systemd: add setting CPUQuotaPeriod prop
2020-06-17 12:03:30 -07:00
Mrunal Patel 12a7c8fc2b
Merge pull request #2411 from kolyshkin/v1-specific
libct/cgroups/utils: fix/separate cgroupv1 code
2020-06-17 06:45:19 -07:00
Renaud Gaubert ccdd75760c Add the CreateRuntime, CreateContainer and StartContainer Hooks
Signed-off-by: Renaud Gaubert <rgaubert@nvidia.com>
2020-06-17 02:10:00 +00:00
Kir Kolyshkin e232a71a3d tests/int/checkpoint: fix checks, add logs
1. When using `runc`, we should check `$status` and not `$?`.

2. Before exit code check, let's (try to) show errors from CRIU log.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-06-16 16:56:00 -07:00
Kir Kolyshkin a6ddabd6e9 tests/int/checkpoint: whitespace cleanups
Remove whitespace at EOL

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-06-16 16:48:12 -07:00
Kir Kolyshkin e751a168dc cgroups/systemd: add setting CPUQuotaPeriod prop
For some reason, runc systemd drivers (both v1 and v2) never set
systemd unit property named `CPUQuotaPeriod` (known as
`CPUQuotaPeriodUSec` on dbus and in `systemctl show` output).

Set it, and add a check to all the integration tests. The check is less
than trivial because, when not set, the value is shown as "infinity" but
when set to the same (default) value, shown as "100ms", so in case we
expect 100ms (period = 100000 us), we have to _also_ check for
"infinity".

[v2: add systemd version checks since CPUQuotaPeriod requires v242+]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-06-16 15:48:06 -07:00
Kir Kolyshkin 8c5a19f79b libct/cgroups/fs: rename some files
no changes, just a few git renames

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-06-16 12:45:54 -07:00
Kir Kolyshkin cec5ae7c2d libct/cgroupv1/getCgroupMountsHelper: minor nit
It is easy to just use TrimPrefix which does nothing in case the prefix
does not exist.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-06-16 12:45:50 -07:00
Kir Kolyshkin 0626c150c1 libct/cgroupv1: fix TestGetCgroupMounts test cases
When testing GetCgroupMounts, the map data is supposed to be obtained
from /proc/self/cgroup, but since we're mocking things, we provide
our own map.

Unfortunately, not all controllers existing in mountinfos were listed.
Also, "name=systemd" needs special handling, so add it.

The controllers added were:

 * for fedoraMountinfo case: name=systemd
 * for systemdMountinfo case: name=systemd, net_prio
 * for bedrockMountinfo case: name=systemd, net_prio, pids

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-06-16 12:45:30 -07:00
Kir Kolyshkin 0681d456fc libct/cgroups/utils: move cgroup v1 code to separate file
In most project, "utils" is a big mess, and this is not an exception.
Try to clean it up a bit by moving cgroup v1 specific code to a separate
source file.

There are no code changes in this commit, just moving it from one file
to another.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-06-16 12:45:07 -07:00
Kir Kolyshkin 7db2d3e146 libcontainer/cgroups: rm FindCgroupMountpointDir
This function is cgroupv1-specific, is only used once, and its name
is very close to the name of another function, FindCgroupMountpoint.

Inline it into the (only) caller.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-06-16 12:40:15 -07:00