containers / conmon-rs

An OCI container runtime monitor written in Rust
Apache License 2.0
180 stars 43 forks source link

Expose number of containers attached to a conmon-rs process #2020

Open umohnani8 opened 6 months ago

umohnani8 commented 6 months ago

As part of the conmon-rs integration with podman, we need a way of querying conmon-rs to get the number of containers already attached to a single conmon-rs process.

This will help us determine whether to add a new container to an existing conmon-rs or to create a new conmon-rs process because we have reached the allowed limit.

Podman plans to keep a list of active conmon-rs processes so that we can go through those and query the number of containers attached to each one before making a decision.

umohnani8 commented 6 months ago

@haircommander PTAL

haircommander commented 6 months ago

would a ListContainers like API be useful? instead of just the number, include the IDs as well?

umohnani8 commented 6 months ago

Yes, that would be even better!

saschagrunert commented 6 months ago

This will help us determine whether to add a new container to an existing conmon-rs or to create a new conmon-rs process because we have reached the allowed limit.

Is this something we should handle directly in conmon-rs (the golang client/API of it)?

umohnani8 commented 6 months ago

@saschagrunert yes I believe so. The plan is to use a conmon-rs id (or whatever its unique attribute is) and call the conmon-rs API with that id to get a list of containers (or number of containers) currently attached to that conmon-rs process.

This is the workflow I had in mind, but open to other ideas as well :)