Skip to content

feat(agent): node condition reporting — patch Node with ReaperReady condition#30

Merged
miguelgila merged 1 commit intomainfrom
node-condition-reporting
Mar 6, 2026
Merged

feat(agent): node condition reporting — patch Node with ReaperReady condition#30
miguelgila merged 1 commit intomainfrom
node-condition-reporting

Conversation

@miguelgila
Copy link
Owner

Summary

  • The reaper-agent now periodically patches the Node object's .status.conditions with a ReaperReady condition that reflects the health of Reaper binaries and state directory on the node
  • Uses strategic merge patch on the /status subresource to upsert the condition by type without disturbing other conditions (Ready, MemoryPressure, etc.)
  • Configurable via --node-condition-enabled (default: true), --node-condition-interval (default: 30s), and NODE_NAME env var (set via downward API)

Changes

  • New module: src/bin/reaper-agent/node_condition.rs — core condition patching logic
  • RBAC: Added nodes (get) and nodes/status (patch) permissions
  • DaemonSet: Added NODE_NAME env var via downward API (spec.nodeName)
  • Metrics: reaper_agent_node_condition_updates_total, reaper_agent_node_condition_healthy
  • Integration tests: 3 new tests (condition set, health reflection, metrics)
  • Bugfix: Gated pre-existing Linux-only functions with #[cfg(target_os = "linux")] to fix clippy warnings on macOS

Test plan

  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes (222 tests)
  • ./scripts/run-integration-tests.sh --agent-only passes (16/16 tests)
    • Agent node condition ReaperReady set (0.2s)
    • Agent node condition reflects health (50.5s) — verifies True→False→True transition
    • Agent node condition metrics (2.1s)

🤖 Generated with Claude Code

…ondition

The reaper-agent now periodically patches the Node object's status
conditions with a ReaperReady condition that reflects the health of
Reaper binaries and state directory on the node. Uses strategic merge
patch on the /status subresource to upsert the condition by type.

- New node_condition module with configurable interval (default 30s)
- NODE_NAME set via downward API (spec.nodeName)
- RBAC: nodes (get) and nodes/status (patch)
- Prometheus metrics: node_condition_updates_total, node_condition_healthy
- Integration tests: condition set, health reflection, metrics
- Can be disabled via --node-condition-enabled=false

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

codecov bot commented Mar 5, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #30      +/-   ##
==========================================
- Coverage   86.83%   84.21%   -2.63%     
==========================================
  Files           6        6              
  Lines         319      285      -34     
==========================================
- Hits          277      240      -37     
- Misses         42       45       +3     

☔ 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.

@miguelgila miguelgila merged commit 36a5ca7 into main Mar 6, 2026
9 of 10 checks passed
@miguelgila miguelgila deleted the node-condition-reporting branch March 6, 2026 08:04
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