Skip to content

Commit d1103e5

Browse files
Initial public release of containerd-manager
Rust library for managing containerd containers, tasks, and images. Docker-free alternative to bollard, targeting MongoDB Atlas Local CLI's test-data and integration-test workflows. Highlights: - Full container lifecycle: pull, create, start, stop, kill, delete - Snapshot / restore / reset-to-snapshot / clone with copy-on-write rootfs - Bridge networking via OCI hooks (colima-VM compatible) + host/isolated modes - Per-container background log tailer writing timestamped + rotated events.log - LogFollower for live tailing (mpsc + futures::Stream) - HEALTHCHECK-aware readiness with start_period grace (Healthy / Starting / Unhealthy) - Exec inside running tasks with capability + env inheritance - Image-config caching, multi-arch resolution, content store integration - Per-namespace tracking of task start times, managed port forwards, log tailers - typed-builder Opts for ergonomic construction - tracing instrumentation on all public Client methods
0 parents  commit d1103e5

39 files changed

Lines changed: 12983 additions & 0 deletions

.github/dependabot.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
day: "monday"
8+
time: "09:00"
9+
open-pull-requests-limit: 10
10+
commit-message:
11+
prefix: "chore(deps)"
12+
labels:
13+
- "dependencies"
14+
groups:
15+
rust-all:
16+
patterns: ["*"]
17+
18+
- package-ecosystem: "github-actions"
19+
directory: "/"
20+
schedule:
21+
interval: "weekly"
22+
day: "monday"
23+
time: "09:00"
24+
open-pull-requests-limit: 5
25+
commit-message:
26+
prefix: "chore(deps)"
27+
labels:
28+
- "dependencies"

.github/workflows/ci.yml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
check:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install Rust toolchain
18+
run: |
19+
rustup update stable
20+
rustup default stable
21+
rustup component add clippy rustfmt
22+
23+
- name: Cache cargo
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
~/.cargo/registry
28+
~/.cargo/git
29+
target
30+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-cargo-
33+
34+
- name: Check formatting
35+
run: cargo fmt --all -- --check
36+
37+
- name: Run clippy
38+
run: cargo clippy --all-targets --no-deps -- -D warnings
39+
40+
- name: Build
41+
run: cargo build --verbose
42+
43+
- name: Run unit tests
44+
run: cargo test --lib --verbose
45+
46+
- name: Build examples
47+
run: cargo build --examples --verbose
48+
49+
test-matrix:
50+
# Ubuntu stable is covered by `check`; this job adds platform breadth.
51+
runs-on: ${{ matrix.os }}
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
os: [macos-latest, windows-latest]
56+
57+
steps:
58+
- uses: actions/checkout@v4
59+
60+
- name: Install Rust toolchain
61+
run: |
62+
rustup update stable
63+
rustup default stable
64+
65+
- name: Cache cargo
66+
uses: actions/cache@v4
67+
with:
68+
path: |
69+
~/.cargo/registry
70+
~/.cargo/git
71+
target
72+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
73+
restore-keys: |
74+
${{ runner.os }}-cargo-
75+
76+
- name: Build
77+
run: cargo build --verbose
78+
79+
- name: Run unit tests
80+
run: cargo test --lib --verbose
81+
82+
msrv:
83+
# Matches `rust-version` in Cargo.toml. `cargo check` is enough; tests
84+
# may pull in features unavailable on the MSRV toolchain.
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: actions/checkout@v4
88+
89+
- name: Install Rust 1.88
90+
run: |
91+
rustup update 1.88
92+
rustup default 1.88
93+
94+
- name: Cache cargo
95+
uses: actions/cache@v4
96+
with:
97+
path: |
98+
~/.cargo/registry
99+
~/.cargo/git
100+
target
101+
key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.lock') }}
102+
restore-keys: |
103+
${{ runner.os }}-cargo-msrv-
104+
105+
- name: Check MSRV build
106+
run: cargo check --verbose
107+
108+
e2e-linux:
109+
# Runs the e2e suite against native Linux containerd. macOS-specific
110+
# tests (bridge networking over colima's VZ network) won't be exercised
111+
# but the lifecycle, exec, logs, port-forward, and readiness paths are.
112+
runs-on: ubuntu-latest
113+
env:
114+
CONTAINERD_SOCKET: /run/containerd/containerd.sock
115+
steps:
116+
- uses: actions/checkout@v4
117+
118+
- name: Install Rust toolchain
119+
run: |
120+
rustup update stable
121+
rustup default stable
122+
123+
- name: Install containerd + OCI hook deps
124+
run: |
125+
sudo apt-get update
126+
# containerd brings runc. socat, python3, iptables, iproute2,
127+
# util-linux back the bridge OCI hooks.
128+
sudo apt-get install -y containerd socat python3 iptables iproute2 util-linux
129+
130+
- name: Start containerd
131+
run: |
132+
sudo systemctl start containerd
133+
sudo systemctl status containerd --no-pager
134+
# Default socket is root-owned; relax for the runner user.
135+
sudo chmod 666 /run/containerd/containerd.sock
136+
ls -la /run/containerd/containerd.sock
137+
138+
- name: Cache cargo
139+
uses: actions/cache@v4
140+
with:
141+
path: |
142+
~/.cargo/registry
143+
~/.cargo/git
144+
target
145+
key: ${{ runner.os }}-cargo-e2e-${{ hashFiles('**/Cargo.lock') }}
146+
restore-keys: |
147+
${{ runner.os }}-cargo-e2e-
148+
149+
- name: Run e2e tests
150+
env:
151+
RUST_BACKTRACE: 1
152+
# Test process only needs socket access. Containerd runs as root via
153+
# systemd, so the OCI hooks (which need CAP_NET_ADMIN for veth +
154+
# iptables) inherit privileges from the daemon.
155+
run: cargo test --features e2e-tests --no-fail-fast

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/target
2+
/tasks
3+
/.claude
4+
*.code-workspace

0 commit comments

Comments
 (0)