MCPcopy Index your code
hub / github.com/containers/conmon-rs

github.com/containers/conmon-rs @v1.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.1 ↗ · + Follow
1,614 symbols 3,859 edges 42 files 393 documented · 24% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ci gh-pages codecov dependencies builds docs go-docs

A pod level OCI container runtime monitor.

The goal of this project is to provide a container monitor in Rust. The scope of conmon-rs encompasses the scope of the c iteration of conmon, including daemonizing, holding open container standard streams, writing the exit code.

However, the goal of conmon-rs also extends past that of conmon, attempting to become a monitor for a full pod (or a group of containers). Instead of a container engine creating a conmon per container (as well as subsequent conmons per container exec), the engine will spawn a conmon-rs instance when a pod is created. That instance will listen over an UNIX domain socket for new requests to create containers, and exec processes within them.

Obtain the latest version

We provide statically linked binaries for every successfully built commit on main via our Google Cloud Storage Bucket. Our provided get script can be used to download the latest version:

> curl https://raw.githubusercontent.com/containers/conmon-rs/main/scripts/get | bash

It is also possible to select a specific git SHA or the output binary path by:

> curl https://raw.githubusercontent.com/containers/conmon-rs/main/scripts/get | \
    bash -s -- -t $GIT_SHA -o $OUTPUT_PATH

The script automatically verifies the created sigstore signatures if the local system has cosign available in its $PATH.

More information about how to use conmon-rs can be found in the usage documentation.

If you want to create a new conmon-rs release, please refer to the release documentation.

Architecture

The whole application consists of two main components:

  1. The Rust server: conmon-rs/server (docs)
  2. A golang client: pkg/client (docs)

The golang client should act as main interface while it takes care of creating the server instance via the Command Line Interface (CLI) as well as communicating to the server via Cap’n Proto. The client itself hides the raw Cap’n Proto parts and exposes dedicated golang structures to provide a clean API surface.

The following flow chart explains the client and container creation process:

Goals

  • [x] Single conmon per pod (post MVP/stretch)
  • [x] Keeping RSS under 3-4 MB
  • [x] Support exec without respawning a new conmon
  • [x] API with RPC to make it extensible (should support golang clients)
  • [x] Use pidfds for async process exit waiting
  • [ ] Act as pid namespace init
  • [ ] Join network namespace to solve running hooks inside the pod context
  • [ ] Use io_uring
  • [ ] Plugin support for seccomp notification
  • [ ] Logging rate limiting (double buffer?)
  • [ ] Stats
  • [ ] IPv6 port forwarding

Future development

In the future, conmon-rs may:

  • Be extended to mirror the functionality for each runtime operation.
  • Thus reducing the amount of exec calls that must happen in the container engine, and reducing the amount of memory it uses.
  • Be in charge of configuring the namespaces for the pod
  • Taking over functionality that pinns has historically done.

Extension points exported contracts — how you extend this code

CommandFdExt (Interface)
Extension to add file descriptor mappings to a Command. [1 implementers]
conmon-rs/server/src/fd_mapping.rs
Conmon_Server (Interface)
A Conmon_Server is a Conmon with a local implementation.
internal/proto/conmon.capnp.go
RequestWithMetadata (Interface)
(no doc)
pkg/client/client.go
IntoKeyValue (Interface)
Convert from a MapEntry capnp struct to a (key, value) tuple. [1 implementers]
conmon-rs/server/src/capnp_util.rs
SetKeyValue (Interface)
Set the key and value properties of a MapEntry capnp struct. [1 implementers]
conmon-rs/server/src/capnp_util.rs
ListenerImpl (Interface)
(no doc) [2 implementers]
conmon-rs/server/src/listener.rs
InitImpl (Interface)
(no doc) [1 implementers]
conmon-rs/server/src/init.rs

Core symbols most depended-on inside this repo

Struct
called by 869
internal/proto/conmon.capnp.go
ToPtr
called by 144
internal/proto/conmon.capnp.go
Segment
called by 95
internal/proto/conmon.capnp.go
clone
called by 65
conmon-rs/server/src/attach.rs
EncodeAsPtr
called by 47
internal/proto/conmon.capnp.go
DecodeFromPtr
called by 47
internal/proto/conmon.capnp.go
IsValid
called by 47
internal/proto/conmon.capnp.go
Message
called by 46
internal/proto/conmon.capnp.go

Shape

Method 1,110
Function 291
Struct 90
TypeAlias 58
Class 48
Enum 10
Interface 7

Languages

Go78%
Rust22%

Modules by API surface

internal/proto/conmon.capnp.go1,133 symbols
pkg/client/client.go59 symbols
pkg/client/suite_test.go29 symbols
conmon-rs/server/src/streaming_server.rs27 symbols
conmon-rs/server/src/terminal.rs22 symbols
conmon-rs/server/src/child_reaper.rs22 symbols
conmon-rs/server/src/config.rs21 symbols
conmon-rs/server/src/container_io.rs20 symbols
conmon-rs/common/src/lib.rs19 symbols
conmon-rs/server/src/server.rs18 symbols
conmon-rs/server/src/pause.rs17 symbols
conmon-rs/server/src/init.rs17 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add conmon-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page