Conversation
There was a problem hiding this comment.
Pull request overview
Implements a new pvc primitive (PersistentVolumeClaim) that plugs into the framework’s integration-resource lifecycle, including typed mutation/editing support, default handlers, flavors, docs, and a runnable example.
Changes:
- Added
pkg/primitives/pvc/(resource, builder, mutator, handlers, flavors) with unit tests. - Added a shared typed editor
PVCSpecEditorunderpkg/mutation/editors/with tests. - Added a dedicated
pvc-primitiveexample and new documentation pagedocs/primitives/pvc.md.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/primitives/pvc/resource.go | Adds PVC integration Resource wrapper + default field applicator (immutable-field preservation). |
| pkg/primitives/pvc/mutator.go | Adds PVC mutator with plan/apply pattern and typed spec/meta edits. |
| pkg/primitives/pvc/mutator_test.go | Unit tests for mutator behavior and ordering. |
| pkg/primitives/pvc/handlers.go | Default operational + suspension handlers for PVCs. |
| pkg/primitives/pvc/handlers_test.go | Unit tests for default handlers. |
| pkg/primitives/pvc/flavors.go | PVC flavors for preserving labels/annotations. |
| pkg/primitives/pvc/flavors_test.go | Unit tests for flavors + builder integration check. |
| pkg/primitives/pvc/builder.go | Fluent builder for PVC primitive configuration. |
| pkg/primitives/pvc/builder_test.go | Unit tests for builder configuration/validation wiring. |
| pkg/mutation/editors/pvcspec.go | Adds shared PVCSpecEditor for typed PVC spec mutations. |
| pkg/mutation/editors/pvcspec_test.go | Unit tests for PVCSpecEditor. |
| examples/pvc-primitive/resources/pvc.go | Example resource factory using pvc.Builder + mutations/flavors/extractor. |
| examples/pvc-primitive/README.md | Documentation for running/understanding the PVC example. |
| examples/pvc-primitive/main.go | Runnable fake-client example demonstrating versioning/suspension flows. |
| examples/pvc-primitive/features/mutations.go | Example feature-gated PVC mutations. |
| examples/pvc-primitive/app/owner.go | Re-export of shared ExampleApp types for the example. |
| examples/pvc-primitive/app/controller.go | Example controller wiring the PVC resource into a Component. |
| docs/primitives/pvc.md | Adds primitive documentation for PVC. |
Claude Review Cycle 1 CompleteAddressed: Intentionally ignored:
<!-- claude-review-cycle --> |
1789aed to
2d07ac1
Compare
Claude Review Cycle 1 CompleteAddressed:
Intentionally ignored:
|
Claude Review Cycle 1 CompleteAddressed:
Intentionally ignored:
<!-- claude-review-cycle --> |
| "k8s.io/apimachinery/pkg/api/resource" | ||
| ) | ||
|
|
||
| // Mutation defines a mutation that is applied to a pvc Mutator |
There was a problem hiding this comment.
Spelling/terminology: "a pvc Mutator" should be "a PVC Mutator" (PVC is an acronym) to match naming used elsewhere in the repo and in the rest of this package's GoDoc.
| // Mutation defines a mutation that is applied to a pvc Mutator | |
| // Mutation defines a mutation that is applied to a PVC Mutator |
Typed editor providing SetStorageRequest, SetAccessModes, SetStorageClassName, SetVolumeMode, SetVolumeName, and Raw() escape hatch. Follows the existing editor patterns (DeploymentSpecEditor, ContainerEditor, etc.). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements PersistentVolumeClaim as an Integration primitive with: - Builder with fluent API for mutations, flavors, status handlers - Mutator with plan-and-apply pattern (metadata edits, spec edits) - DefaultFieldApplicator preserving immutable fields (accessModes, storageClassName, volumeMode, volumeName) on existing PVCs - DefaultOperationalStatusHandler (Bound/Pending/Lost → status mapping) - DefaultSuspendMutationHandler (no-op, PVCs have no runtime state) - DefaultSuspensionStatusHandler (always Suspended) - DefaultDeleteOnSuspendHandler (false, preserve data) - PreserveCurrentLabels and PreserveCurrentAnnotations flavors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers capabilities, building, default field application (immutable field preservation), mutations (boolean-gated, version-gated), internal ordering, editors (PVCSpecEditor, ObjectMetaEditor), convenience methods, flavors, status handlers, and usage guidance. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Demonstrates PVC builder with version labels, storage annotations, conditional large-storage expansion, label/annotation flavors, data extraction, and suspension. Follows the configmap and deployment example patterns. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address Copilot review comment: DefaultFieldApplicator had no test coverage for its immutable field preservation logic. Add tests validating that: - New PVCs (empty ResourceVersion) use all fields from desired - Existing PVCs preserve immutable fields (accessModes, storageClassName, volumeMode, volumeName) from current - Mutable fields (e.g. storage requests) come from desired Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…inFeature Aligns with the fix applied to the deployment and configmap primitives, preventing an empty leading feature plan when the mutator helper calls beginFeature(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add generic.PreserveStatus call in DefaultFieldApplicator to prevent status clobbering on update - Add TestDefaultFieldApplicator_PreservesStatus regression test - Update pvc.md to accurately describe mutation ordering (no per-feature boundaries due to unexported FeatureMutator interface) - Update DefaultFieldApplicator doc comment to mention Status preservation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Align with upstream change in main that exported BeginFeature() on the FeatureMutator interface. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
afbb0a0 to
dc9f30a
Compare
Add integration tests for the Resource type covering Identity, Object deep copy, Mutate with mutations and field flavors, ConvergingStatus for Bound/Pending/Lost phases, default suspension behavior, and data extraction. These tests validate the generic.IntegrationResource plumbing end-to-end, matching coverage provided by other primitives. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude Review Cycle 1 CompleteAddressed:
Intentionally ignored: <!-- claude-review-cycle --> |
Align PVC mutator with deployment/configmap: NewMutator no longer creates an initial feature plan. BeginFeature must be called before registering mutations. Updates all tests accordingly and adds constructor/feature-plan invariant tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The framework now uses Server-Side Apply instead of ctrl.CreateOrUpdate, so field applicators and flavors are no longer needed. This removes DefaultFieldApplicator, WithCustomFieldApplicator, WithFieldApplicationFlavor, the FieldApplicationFlavor type, flavors.go, flavors_test.go, and updates all tests to use the Object()-then-Mutate() pattern. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| ## Built-in Primitives | ||
|
|
||
| | Primitive | Category | Documentation | | ||
| | --------------------------- | -------- | ----------------------------------------- | | ||
| | `pkg/primitives/deployment` | Workload | [deployment.md](primitives/deployment.md) | | ||
| | `pkg/primitives/configmap` | Static | [configmap.md](primitives/configmap.md) | | ||
| | Primitive | Category | Documentation | | ||
| | --------------------------- | ----------- | ----------------------------------------- | | ||
| | `pkg/primitives/deployment` | Workload | [deployment.md](primitives/deployment.md) | | ||
| | `pkg/primitives/configmap` | Static | [configmap.md](primitives/configmap.md) | | ||
| | `pkg/primitives/pvc` | Integration | [pvc.md](primitives/pvc.md) | |
There was a problem hiding this comment.
PR description mentions the PVC primitive "includes ... flavors", but there doesn’t appear to be any flavor API/types added under pkg/primitives/pvc (or in the generic builders) in this change. Either implement the flavor functionality for PVC or update the PR description/checklist to match what was actually delivered.
Implements the
pvcKubernetes resource primitive following the pattern established by the existingConfigMapandDeploymentprimitives.Summary
pvcprimitive package underpkg/primitives/pvc/PVCSpecEditorunderpkg/mutation/editors/docs/primitives.mdto include PVC in the built-in primitives tableChecklist