Skip to content

Commit c97cdbe

Browse files
authored
Merge pull request #4 from garnizeh/p1/1.2-drawing
feat: add White Security Specification for container security management
2 parents 2c44a0a + 0d640de commit c97cdbe

72 files changed

Lines changed: 16978 additions & 143 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
push:
5-
branches: ["main", "p*/**"]
5+
branches: ["main"]
66
pull_request:
77
branches: ["main"]
88

@@ -22,6 +22,7 @@ jobs:
2222
uses: golangci/golangci-lint-action@v9
2323
with:
2424
version: v2.11.3
25+
args: ./...
2526

2627
test:
2728
name: Test (${{ matrix.os }} / ${{ matrix.arch }})
@@ -43,11 +44,6 @@ jobs:
4344
go-version-file: "go.mod"
4445
- name: Run unit tests
4546
run: make test
46-
- name: Upload coverage
47-
uses: codecov/codecov-action@v4
48-
if: matrix.os == 'linux' && matrix.arch == 'amd64'
49-
with:
50-
flags: unit
5147

5248
vuln:
5349
name: Vulnerability scan
@@ -58,7 +54,7 @@ jobs:
5854
with:
5955
go-version-file: "go.mod"
6056
- name: govulncheck
61-
run: go run golang.org/x/vuln/cmd/govulncheck@latest ./...
57+
run: make vuln
6258

6359
build:
6460
name: Build
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
release-please:
13+
name: Release Please
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: googleapis/release-please-action@v4
17+
with:
18+
config-file: release-please-config.json
19+
manifest-file: .release-please-manifest.json

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
with:
1919
fetch-depth: 0
2020
- uses: actions/setup-go@v6
21+
id: setup-go
2122
with:
2223
go-version-file: "go.mod"
2324
- name: Run GoReleaser
@@ -28,3 +29,4 @@ jobs:
2829
args: release --clean
2930
env:
3031
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
GOVERSION: ${{ steps.setup-go.outputs.go-version }}

.goreleaser.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ builds:
2222
- -X github.com/rodrigo-baliza/maestro/internal/cli.Version={{.Version}}
2323
- -X github.com/rodrigo-baliza/maestro/internal/cli.Commit={{.Commit}}
2424
- -X github.com/rodrigo-baliza/maestro/internal/cli.BuildDate={{.Date}}
25+
- -X github.com/rodrigo-baliza/maestro/internal/cli.GoVersion={{.Env.GOVERSION}}
2526

2627
archives:
2728
- id: maestro

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.1.0"
3+
}

Makefile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LDFLAGS := -X $(MODULE)/internal/cli.Version=$(VERSION) \
1616
STATIC_LDFLAGS := $(LDFLAGS) -w -s -extldflags "-static"
1717

1818
.PHONY: help build build-static install test test-integration test-e2e \
19-
lint fmt clean generate completions ci-local
19+
lint vuln fmt clean generate completions ci-local
2020

2121
help: ## Display available targets
2222
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} \
@@ -43,6 +43,9 @@ test-e2e: ## Run end-to-end tests (requires full environment)
4343
lint: ## Run golangci-lint
4444
golangci-lint run ./...
4545

46+
vuln: ## Run govulncheck
47+
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
48+
4649
fmt: ## Format code with gofmt
4750
gofmt -w -s .
4851
go fix ./...
@@ -58,15 +61,15 @@ ci-local: ## Run the same checks as CI (lint → vuln → test → build → smo
5861
@echo "==> lint config verify"
5962
golangci-lint config verify
6063
@echo "==> lint"
61-
golangci-lint run ./...
64+
$(MAKE) lint
6265
@echo "==> vuln"
63-
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
66+
$(MAKE) vuln
6467
@echo "==> test"
65-
go test -race -count=1 -cover ./internal/...
68+
$(MAKE) test
6669
@echo "==> build"
67-
go build -ldflags "$(LDFLAGS)" -o ./bin/$(BINARY) $(CMD)
70+
$(MAKE) build
6871
@echo "==> build-static"
69-
CGO_ENABLED=0 go build -ldflags "$(STATIC_LDFLAGS)" -o ./bin/$(BINARY)-static $(CMD)
72+
$(MAKE) build-static
7073
@echo "==> smoke"
7174
./bin/$(BINARY) version
7275
@echo "==> OK — all CI checks passed locally"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ maestro/
9191

9292
## Prerequisites
9393

94-
- Go 1.26.1+
94+
- Go 1.26.2+
9595
- Git
9696
- An OCI runtime: [crun](https://github.com/containers/crun) (recommended), [runc](https://github.com/opencontainers/runc), or [youki](https://github.com/youki-dev/youki)
9797
- [conmon-rs](https://github.com/containers/conmon-rs) (container monitor)
@@ -244,7 +244,7 @@ Full details: [docs/roadmap.md](docs/roadmap.md)
244244

245245
| Category | Choice |
246246
|----------|--------|
247-
| Language | Go 1.26.1+ |
247+
| Language | Go 1.26.2+ |
248248
| CLI | [cobra](https://github.com/spf13/cobra) v1.10+ |
249249
| TUI | [bubbletea](https://github.com/charmbracelet/bubbletea) v2 + [lipgloss](https://github.com/charmbracelet/lipgloss) v2 |
250250
| Registry | [go-containerregistry](https://github.com/google/go-containerregistry) v0.21+ |

docs/design-document.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ The daemonless architecture is the correct choice for Maestro. The analysis:
166166
**Positronics — Optional socket mode for advanced use cases:**
167167

168168
Some operations benefit from a persistent process:
169+
169170
- **Ka-shume (event streaming)**`maestro events --follow`
170171
- **Breaker (background GC)** — periodic cleanup without user intervention
171172
- **Container monitoring** — health checks, restart policies
@@ -185,6 +186,7 @@ systemctl --user enable --now maestro
185186
```
186187

187188
The Positronics process:
189+
188190
- Runs as the invoking user (never root)
189191
- Stores state in `$XDG_RUNTIME_DIR/maestro/`
190192
- Uses Khef (flock-based locking) to coordinate with concurrent CLI invocations
@@ -214,6 +216,7 @@ sequenceDiagram
214216
```
215217

216218
**Cort** (conmon-rs — the weapons master who watches over his charges):
219+
217220
- Lightweight (~2MB RSS per container)
218221
- Handles stdio forwarding, logging, and exit code collection
219222
- Independent of the CLI process lifecycle
@@ -250,6 +253,7 @@ graph LR
250253
```
251254

252255
**Khef — Locking strategy:**
256+
253257
- Per-resource `flock()` locks (container, image, volume, network)
254258
- Lock files in `thinnies/<resource-type>/<id>.lock`
255259
- Read locks for inspection, write locks for mutations
@@ -336,6 +340,7 @@ sequenceDiagram
336340
**Deduplication:** Layers are stored by content digest. Identical content produces identical digests — if `nginx:latest` and `nginx:1.25` share 3 of 4 layers, those 3 are stored once.
337341

338342
**Reap — Cache eviction (Charyou tree, "come reap"):**
343+
339344
1. **LRU by last-access time** — track `atime` or custom metadata
340345
2. **Reference counting** — each manifest references layers; unreferenced blobs eligible for reaping
341346
3. **Max storage limit** — configurable via `katet.toml` (`storage.max_size = "50GB"`)
@@ -358,6 +363,7 @@ graph TD
358363
```
359364

360365
Keystone selection algorithm:
366+
361367
1. Exact match: `os` + `architecture` + `variant`
362368
2. Fallback: `os` + `architecture` (ignore variant)
363369
3. Error: no compatible Keystone found
@@ -457,11 +463,13 @@ type Eld interface {
457463
```
458464

459465
**Pathfinder — Runtime discovery:**
466+
460467
1. Explicit config: `runtime.path = "/usr/bin/crun"` in `katet.toml`
461468
2. `$PATH` lookup: `crun` -> `runc` -> `youki` (preference order)
462469
3. Error if no gunslinger found
463470

464471
**Runtime selection per-container:**
472+
465473
```bash
466474
maestro run --runtime crun nginx # Fast startup (crun's speed)
467475
maestro run --runtime runsc nginx # gVisor sandbox (Todash isolation)
@@ -611,6 +619,7 @@ Maestro creates a default bridge network called **beam0** on first use:
611619
> *"Pere Callahan knows everyone in the Calla by name."*
612620
613621
Callahan is a lightweight embedded DNS resolver (inspired by Aardvark-dns) per network:
622+
614623
- Resolves container names and aliases within the same Beam (network)
615624
- Forwards external queries to host DNS servers
616625
- Listens on `127.0.0.53` inside each container's Todash (netns)
@@ -712,6 +721,7 @@ Two-phase garbage collection:
712721
2. **Sweep (Reap):** Remove blobs not referenced by any manifest; remove snapshots not referenced by any container; optionally reap Dogans not mounted by any container
713722

714723
Reap is triggered:
724+
715725
- Manually: `maestro system prune`
716726
- On threshold: when storage exceeds `storage.gc_threshold` (default: 80% of `storage.max_size`)
717727
- By Breaker: if Positronics is active, every `storage.gc_interval` (default: 24h)
@@ -762,6 +772,7 @@ sequenceDiagram
762772
```
763773

764774
**Sigul resolution order:**
775+
765776
1. `--username`/`--password` CLI flags
766777
2. `$MAESTRO_REGISTRY_TOKEN` environment variable
767778
3. `~/.config/maestro/auth.json` (maestro-native)
@@ -1349,7 +1360,7 @@ maestro/
13491360

13501361
### 6.1 Language and Version
13511362

1352-
**Go 1.26.1+** — Required for `slices`/`maps` packages, range over integers, enhanced `net/http` routing, and improved generics.
1363+
**Go 1.26.2+** — Required for `slices`/`maps` packages, range over integers, enhanced `net/http` routing, and improved generics.
13531364

13541365
### 6.2 Key Dependencies
13551366

@@ -1378,31 +1389,31 @@ BUILD_DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
13781389
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(BUILD_DATE)
13791390

13801391
build: ## Build maestro binary
1381-
go build -ldflags "$(LDFLAGS)" -o bin/maestro ./cmd/maestro
1392+
go build -ldflags "$(LDFLAGS)" -o bin/maestro ./cmd/maestro
13821393

13831394
build-static: ## Build static binary (for containers)
1384-
CGO_ENABLED=0 go build -ldflags "$(LDFLAGS) -s -w" -o bin/maestro ./cmd/maestro
1395+
CGO_ENABLED=0 go build -ldflags "$(LDFLAGS) -s -w" -o bin/maestro ./cmd/maestro
13851396

13861397
install: ## Install to $GOPATH/bin
1387-
go install -ldflags "$(LDFLAGS)" ./cmd/maestro
1398+
go install -ldflags "$(LDFLAGS)" ./cmd/maestro
13881399

13891400
test: ## Run unit tests
1390-
go test -race -count=1 ./internal/... ./pkg/...
1401+
go test -race -count=1 ./internal/... ./pkg/...
13911402

13921403
test-integration: ## Run integration tests (requires Eld runtime)
1393-
go test -race -count=1 -tags=integration ./test/integration/...
1404+
go test -race -count=1 -tags=integration ./test/integration/...
13941405

13951406
test-e2e: ## Run end-to-end tests
1396-
go test -race -count=1 -tags=e2e ./test/e2e/...
1407+
go test -race -count=1 -tags=e2e ./test/e2e/...
13971408

13981409
lint: ## Run linters
1399-
golangci-lint run ./...
1410+
golangci-lint run ./...
14001411

14011412
fmt: ## Format code
1402-
gofumpt -w .
1413+
gofumpt -w .
14031414

14041415
clean: ## Reap build artifacts
1405-
rm -rf bin/
1416+
rm -rf bin/
14061417
```
14071418

14081419
### 6.4 Testing Strategy
@@ -1441,6 +1452,7 @@ graph TD
14411452
```
14421453

14431454
**First-run diagnostics:** `maestro system check` validates:
1455+
14441456
- subuid/subgid allocation
14451457
- Kernel version and features
14461458
- Available Eld runtimes (Pathfinder scan)
@@ -1645,12 +1657,14 @@ service TowerService { // System
16451657
## Appendix A: References
16461658

16471659
### Specifications
1660+
16481661
- [OCI Image Spec v1.1.1](https://github.com/opencontainers/image-spec)
16491662
- [OCI Distribution Spec v1.1.0](https://github.com/opencontainers/distribution-spec)
16501663
- [OCI Runtime Spec v1.3.0](https://github.com/opencontainers/runtime-spec)
16511664
- [CNI Spec v1.1.0](https://www.cni.dev/docs/spec/)
16521665

16531666
### Key Projects
1667+
16541668
- [containerd](https://github.com/containerd/containerd) — Container runtime daemon
16551669
- [Podman](https://github.com/containers/podman) — Daemonless container engine
16561670
- [runc](https://github.com/opencontainers/runc) — OCI reference runtime
@@ -1660,12 +1674,14 @@ service TowerService { // System
16601674
- [Sigstore/cosign](https://github.com/sigstore/cosign) — Container signing
16611675

16621676
### Go Libraries
1677+
16631678
- [go-containerregistry](https://github.com/google/go-containerregistry) — Shardik's foundation
16641679
- [cobra](https://github.com/spf13/cobra) — Dinh's framework
16651680
- [bubbletea](https://github.com/charmbracelet/bubbletea) — Glass engine
16661681
- [lipgloss](https://github.com/charmbracelet/lipgloss) — Glass styling
16671682

16681683
### Research
1684+
16691685
- See [oci-ecosystem-research.md](./oci-ecosystem-research.md) for full research document
16701686
- See [dark-tower-naming-map.md](./dark-tower-naming-map.md) for complete naming reference with justifications
16711687

0 commit comments

Comments
 (0)