Fix 'virtual_subtype' grain for kubernetes and libpod containers

All the containers started by kubelet (hence kubernetes) are assigned
to the `kubepods` cgroup slice (see [1]). That happens despite of the
Container Runtime Interface being used.

Containers started via tools using `libpod` [2] (eg: podman) are
assigned to the `libpod_parent` cgroup slice.

[1] https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node/node-allocatable.md#recommended-cgroups-setup
[2] https://github.com/projectatomic/libpod

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
This commit is contained in:
Flavio Castelli 2018-03-28 18:53:34 +02:00
parent 7874c908ac
commit ac1d943394
No known key found for this signature in database
GPG Key ID: F1020D69DC004F48

View File

@ -821,6 +821,10 @@ def _virtual(osdata):
fhr_contents = fhr.read()
if ':/lxc/' in fhr_contents:
grains['virtual_subtype'] = 'LXC'
elif ':/kubepods/' in fhr_contents:
grains['virtual_subtype'] = 'kubernetes'
elif ':/libpod_parent/' in fhr_contents:
grains['virtual_subtype'] = 'libpod'
else:
if any(x in fhr_contents
for x in (':/system.slice/docker', ':/docker/',