Skip to content

Commit

Permalink
chore(libsinsp): add some comments
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo authored and poiana committed Jan 8, 2025
1 parent 1a6b372 commit 52d8ad2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion userspace/libsinsp/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,12 @@ class sinsp_container_manager : public libsinsp::container_engine::container_cac
* \brief do we want to start a new lookup for container metadata?
* @param container_id the container id we want to look up
* @param ctype the container engine that is doing the lookup
* @param engine_index index of container engine in case of multiple
* engines per container type
* @return true if there's no lookup in progress and we're free to start
* a new one, false otherwise
*
* This method effectively checks if m_lookups[container_id][ctype]
* This method effectively checks if m_lookups[container_id][ctype][engine_index]
* exists, without creating unnecessary map entries along the way.
*/
bool should_lookup(const std::string& container_id,
Expand Down
3 changes: 3 additions & 0 deletions userspace/libsinsp/container_engine/containerd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ limitations under the License.
using namespace libsinsp::container_engine;
using namespace libsinsp::runc;

// Containers created via ctr use the "default" namespace (instead of the cri "k8s.io" namespace)
// which will result in the `/default` cgroup path.
// https://github.com/containerd/containerd/blob/3b15606e196e450cf817fa9f835ab5324b35a28b/pkg/namespaces/context.go#L32
constexpr const cgroup_layout CONTAINERD_CGROUP_LAYOUT[] = {{"/default/", ""}, {nullptr, nullptr}};

constexpr const std::string_view CONTAINERD_SOCKETS[] = {
Expand Down
2 changes: 2 additions & 0 deletions userspace/libsinsp/container_engine/cri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ bool cri::resolve(sinsp_threadinfo *tinfo, bool query_os_for_missing_info) {
} else {
cache->notify_new_container(container, tinfo);
}
// note: with more than one container runtime we cannot be sure if a resolution is enough
// and we have to query all the runtimes.
return false;
}

Expand Down

0 comments on commit 52d8ad2

Please sign in to comment.