Skip to content

feat: ReaperPod CRD, reaper-controller, and Helm chart#31

Merged
miguelgila merged 18 commits intomainfrom
crd-exploration
Mar 7, 2026
Merged

feat: ReaperPod CRD, reaper-controller, and Helm chart#31
miguelgila merged 18 commits intomainfrom
crd-exploration

Conversation

@miguelgila
Copy link
Owner

@miguelgila miguelgila commented Mar 7, 2026

Summary

  • ReaperPod CRD (reaper.io/v1alpha1) — simplified Reaper-native workload definition
  • reaper-controller — watches ReaperPod resources, creates Pods with runtimeClassName: reaper-v2
  • Helm chart (deploy/helm/reaper/) — replaces Ansible as the default installation method
  • Pod name matches ReaperPod name (enables kubectl logs <reaperpod-name>)
  • KUBECONFIG isolation prevents context pollution with multiple Kind clusters
  • 8 integration tests for CRD lifecycle, status mirroring, exit codes, annotations, GC

Helm Chart

The Helm chart installs everything needed to run Reaper:

  • Node DaemonSet — init container copies shim + runtime binaries to every node
  • Controller Deployment — watches ReaperPod CRDs and creates Pods
  • CRDreaperpods.reaper.io custom resource
  • RuntimeClassreaper-v2
  • RBAC — ServiceAccount, ClusterRole, ClusterRoleBinding

Ansible deployment is marked as DEPRECATED (kept but no longer tested in CI).

Test plan

  • helm lint deploy/helm/reaper/ passes
  • helm template renders all resources correctly
  • All 8 CRD integration tests pass (--crd-only)
  • 9 pod_builder unit tests pass
  • cargo clippy and cargo fmt pass
  • Full integration test suite in CI

🤖 Generated with Claude Code

miguelgila and others added 10 commits March 6, 2026 14:46
Introduce a ReaperPod custom resource that provides a simplified,
Reaper-native way to run workloads. A new reaper-controller binary
watches ReaperPod resources and creates real Pods with runtimeClassName
pre-configured, translating the simplified spec (inline volumes,
dnsMode, overlayName) into full Pod specs with owner references.

- CRD types with own simple structs (avoids k8s-openapi schemars dep)
- Pod builder with 9 unit tests covering all field translations
- Reconciler using kube::runtime::Controller with owns() for Pod watches
- Deployment manifests, Dockerfile, build/generate scripts
- Example YAMLs (simple-task, with-volumes, with-node-selector)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 4b tests: CRD installation, controller deployment, ReaperPod
creation with Pod verification, status mirroring, exit code propagation,
annotation translation, kubectl column output, and GC on delete.

Also updates build-controller-image.sh to match agent build pattern
(--cluster-name, --skip-build, --quiet) and wires controller image
build into phase_setup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Skips cargo tests, integration tests, and agent tests — runs only
Phase 4b controller tests (CRD install, ReaperPod lifecycle, status
mirroring, annotation translation, GC).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The controller deployment targets the reaper-system namespace, which is
normally created during agent setup. When running with --crd-only, agent
setup is skipped, causing "namespace not found" errors. Create the
namespace idempotently before applying the controller manifest.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CLAUDE.md: add controller binary, CRD types, scripts, and example 09
  to project structure; document Phase 4b in integration test phases
- TESTING.md: add --crd-only and --agent-only flags; add Phase 4b
  controller tests; add CRD iteration example
- examples/README.md: add 09-reaperpod section with usage instructions
- examples/09-reaperpod/simple-task.yaml: add namespace prerequisite
- docs/CRD_PLAN.md: note namespace fix for --crd-only runs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Installs the ReaperPod CRD, builds and loads the controller image into
Kind, and deploys the reaper-controller. Adds CRD usage examples to the
playground summary output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The ReaperPod CRD and reaper-controller are now installed by default
when setting up a playground cluster. Remove the --with-controller flag
since this is the standard mode of operation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use --context=kind-<cluster-name> in all example commands so they work
correctly when multiple Kind clusters are running. Also add an inline
ReaperPod one-liner example.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace generateName with a fixed name so the Pod created by the
controller has the same name as the ReaperPod. This enables
`kubectl logs <reaperpod-name>` to work directly without needing
to look up the Pod name from the ReaperPod status.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Mar 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.21%. Comparing base (36a5ca7) to head (40f3023).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #31   +/-   ##
=======================================
  Coverage   84.21%   84.21%           
=======================================
  Files           6        6           
  Lines         285      285           
=======================================
  Hits          240      240           
  Misses         45       45           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add a Helm chart (deploy/helm/reaper/) that installs everything needed
to run Reaper: node DaemonSet with init container for binary installation,
controller Deployment, CRDs, RuntimeClass, and RBAC.

- Add Dockerfile.node and scripts/install-node.sh for init container
- Add scripts/build-node-image.sh for Kind image builds
- Rewrite setup-playground.sh to use Helm instead of Ansible
- Update test-phases.sh to use Helm-based setup
- Make CRD/controller tests idempotent (work with Helm or standalone)
- Mark Ansible deployment as DEPRECATED (kept but no longer default)
- Update README.md and CLAUDE.md to reflect Helm as default

All 8 CRD integration tests pass with the new Helm-based flow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@miguelgila miguelgila changed the title feat: ReaperPod CRD and reaper-controller feat: ReaperPod CRD, reaper-controller, and Helm chart Mar 7, 2026
miguelgila and others added 7 commits March 7, 2026 15:54
Update TESTING.md, RELEASING.md, and deploy/kubernetes/README.md to
reflect Helm as the default installation method. Mark Ansible references
as deprecated throughout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
setup-playground.sh no longer supports --release (Helm handles
installation). Remove the CI job that tested release resolution modes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add --features controller --bin reaper-controller to musl build step
- Include reaper-controller in uploaded artifacts
- Replace 'Install Ansible' step with 'Install Helm' for kind-integration

The controller binary was missing from CI artifacts, causing
build-controller-image.sh --skip-build to fail in kind-integration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
yield_now() is insufficient under CI load — the kernel may still hold
the inode after chmod. A small sleep reliably avoids the ETXTBSY race
when exec'ing a freshly-written shell script.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
With CRD controller tests (Phase 4b) added on top of agent GC tests
(some taking 90-120s each), 20 minutes is too tight. Increase to 30
minutes to give the full suite room to complete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@miguelgila miguelgila merged commit 101d7ed into main Mar 7, 2026
9 checks passed
@miguelgila miguelgila deleted the crd-exploration branch March 7, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant