Add V2 container and process lifecycle monitors - #266
Conversation
Add lifecycle monitors for V2 containers, processes, networks, and removable volumes. Support explicit monitor targets for retained containers and processes, retain volumes by default, and bound in-use volume cleanup retries. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Monitor cancellation races, retained-container startup ordering, and stale volume-name ownership can prevent cleanup or remove replacement resources.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds crash-monitor processes for V2 physical resources and makes created volumes retained by default.
Changes:
- Adds lifecycle monitors for containers, processes, networks, and removable volumes.
- Adds retained-resource monitor PID/timestamp configuration.
- Updates volume cleanup policy, generated APIs, documentation, and tests.
File summaries
| File | Description |
|---|---|
api/v2/common_types.go |
Validates monitor identity fields. |
api/v2/physical_container_types.go |
Adds retained-container monitoring fields. |
api/v2/physical_container_types_test.go |
Tests container monitor validation. |
api/v2/physical_process_types.go |
Adds retained-process monitoring fields. |
api/v2/physical_process_types_test.go |
Tests process monitor validation. |
api/v2/physical_container_volume_types.go |
Reverses the volume cleanup default. |
api/v2/physical_container_volume_types_test.go |
Updates volume immutability coverage. |
api/v2/zz_generated.deepcopy.go |
Regenerates deep-copy methods. |
controllers/physical_container_controller.go |
Launches retained-container monitors. |
controllers/physical_process_controller.go |
Launches configurable process monitors. |
controllers/physical_container_network_controller.go |
Launches network cleanup monitors. |
controllers/physical_container_volume_controller.go |
Applies opt-in cleanup and monitoring. |
controllers/physical_resource_invalid_state_test.go |
Updates volume retention assumptions. |
internal/dcpctrl/commands/run_controllers.go |
Supplies process executors to controllers. |
internal/dcpproc/dcpproc_api.go |
Adds network and volume watcher launchers. |
internal/dcpproc/dcpproc_api_test.go |
Tests watcher command construction. |
internal/dcpproc/commands/network.go |
Implements network cleanup monitoring. |
internal/dcpproc/commands/volume.go |
Implements bounded volume cleanup monitoring. |
internal/dcpproc/commands/root.go |
Registers new monitor commands. |
internal/dcpproc/commands/container_resource_test.go |
Tests network and volume cleanup behavior. |
pkg/generated/openapi/zz_generated.openapi.go |
Regenerates V2 OpenAPI schemas. |
plan/v2-resource-plan.md |
Documents lifecycle policy and roadmap. |
test/integration/advanced_test_env.go |
Updates advanced controller construction. |
test/integration/standard_test_env.go |
Enables monitors in standard tests. |
test/integration/v2_physical_container_controller_test.go |
Covers retained-container monitoring. |
test/integration/v2_physical_container_network_controller_test.go |
Covers network monitor launching. |
test/integration/v2_physical_container_network_durability_test.go |
Updates network reconciler construction. |
test/integration/v2_physical_container_volume_controller_test.go |
Covers volume retention and monitoring. |
test/integration/v2_physical_container_volume_durability_test.go |
Updates removable-volume durability tests. |
test/integration/v2_physical_process_controller_test.go |
Covers retained-process monitoring. |
Review details
Files not reviewed (1)
- api/v2/zz_generated.deepcopy.go: Generated file
- Files reviewed: 28/30 changed files
- Comments generated: 5
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Make resource-removal polling cancellation-safe, start retained container monitors only after successful startup, and protect volume cleanup against same-name replacement using the physical resource UID. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Restore the V1 container controller's private UID label declaration so the V2 volume monitor ownership fix does not create an unrelated V1 source change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace the custom container-resource polling loop with the shared resiliency retry helper and a jittered constant-interval backoff. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove dedicated network and volume crash monitors while preserving normal controller deletion and retained-by-default volumes. Forward the selected container runtime through the existing container monitor API. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Restore the pre-existing pollContainerRemoved behavior and remove the shared polling abstraction that is no longer needed after dropping network and volume crash monitors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The stated network and volume monitor scope does not match the implementation or updated roadmap.
Get a fresh assessment by requesting another Copilot review.
Review details
Files not reviewed (1)
- api/v2/zz_generated.deepcopy.go: Generated file
- Files reviewed: 19/21 changed files
- Comments generated: 1
- Review effort level: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Public API, controller lifecycle, and subprocess cleanup changes warrant final human validation despite comprehensive coverage.
Review details
Files not reviewed (1)
- api/v2/zz_generated.deepcopy.go: Generated file
- Files reviewed: 22/24 changed files
- Comments generated: 0 new
- Review effort level: Balanced
V2-created containers and processes need runtime cleanup when DCP exits unexpectedly, while retained resources need explicit lifecycle ownership. This adds lifecycle monitors for those active resources and makes created volumes retained by default, with controller-managed deletion as an explicit opt-in.
Summary
retainRuntimeVolumewithremoveRuntimeVolumeOnDelete. Created volumes are now retained by default; setting the new flag opts into non-forced controller deletion. Namespace cleanup bounds in-use volume removal retries to 30 seconds.Validation
make testmake lint