From ac1d943394b61a5a1d1390f555f5108edb7da81f Mon Sep 17 00:00:00 2001 From: Flavio Castelli Date: Wed, 28 Mar 2018 18:53:34 +0200 Subject: [PATCH] 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 --- salt/grains/core.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/salt/grains/core.py b/salt/grains/core.py index b6f6b28aea..595eebd3da 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -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/',