sys - add IsRunningOnPod

This commit is contained in:
Mahdi Abu Yasmine 2023-11-07 22:38:10 +01:00
parent e88b75c71f
commit ef88ea018c

View File

@ -142,3 +142,8 @@ func HandleSigKill(done chan os.Signal) {
os.Exit(0)
}()
}
func IsRunningOnPod() bool {
var bufout bytes.Buffer
return PipeCmd(exec.Command("cat", "/proc/1/cgroup"), exec.Command("grep", "kubepods"), &bufout) == 0
}