add unstructured and add grace handling to integration resources#76
Merged
sourcehawk merged 7 commits intomainfrom Mar 26, 2026
Merged
add unstructured and add grace handling to integration resources#76sourcehawk merged 7 commits intomainfrom
sourcehawk merged 7 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds first-class “unstructured” primitives (static/workload/integration/task) for managing arbitrary Kubernetes objects without compile-time Go types, and extends several existing integration primitives to participate in grace-period health reporting.
Changes:
- Introduce shared unstructured mutation/identity/handler utilities plus four lifecycle-specific unstructured primitive variants (static/workload/integration/task) with unit + e2e coverage.
- Add
GraceStatussupport (default handlers + builder wiring + tests) to Service, PVC, PV, Ingress, HPA, and CronJob primitives. - Add documentation for unstructured primitives and update existing primitive docs to describe grace behavior.
Reviewed changes
Copilot reviewed 70 out of 70 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/primitives/unstructured/workload/resource_test.go | Adds unit tests for unstructured workload resource wrapper behavior. |
| pkg/primitives/unstructured/workload/resource.go | Introduces unstructured workload resource wrapper around generic workload base. |
| pkg/primitives/unstructured/workload/builder_test.go | Adds unit tests for unstructured workload builder validation/defaults. |
| pkg/primitives/unstructured/workload/builder.go | Adds unstructured workload builder wiring mutations and handlers into generic workload builder. |
| pkg/primitives/unstructured/task/resource_test.go | Adds unit tests for unstructured task resource wrapper behavior. |
| pkg/primitives/unstructured/task/resource.go | Introduces unstructured task resource wrapper around generic task base. |
| pkg/primitives/unstructured/task/builder_test.go | Adds unit tests for unstructured task builder validation/defaults. |
| pkg/primitives/unstructured/task/builder.go | Adds unstructured task builder wiring mutations and suspension defaults. |
| pkg/primitives/unstructured/static/resource_test.go | Adds unit tests for unstructured static resource wrapper behavior. |
| pkg/primitives/unstructured/static/resource.go | Introduces unstructured static resource wrapper around generic static base. |
| pkg/primitives/unstructured/static/builder_test.go | Adds unit tests for unstructured static builder behavior and validation. |
| pkg/primitives/unstructured/static/builder.go | Adds unstructured static builder wiring identity and mutation/extraction. |
| pkg/primitives/unstructured/mutator_test.go | Adds unit tests for shared unstructured mutator plan/apply semantics. |
| pkg/primitives/unstructured/mutator.go | Adds shared Mutator implementation for unstructured primitives (metadata + content edits). |
| pkg/primitives/unstructured/integration/resource_test.go | Adds unit tests for unstructured integration resource wrapper behavior. |
| pkg/primitives/unstructured/integration/resource.go | Introduces unstructured integration resource wrapper around generic integration base. |
| pkg/primitives/unstructured/integration/builder_test.go | Adds unit tests for unstructured integration builder validation/defaults. |
| pkg/primitives/unstructured/integration/builder.go | Adds unstructured integration builder wiring mutations and handlers into generic integration builder. |
| pkg/primitives/unstructured/identity_test.go | Adds tests for unstructured identity formatting (namespaced/cluster-scoped). |
| pkg/primitives/unstructured/identity.go | Adds MakeIdentityFunc helper for stable unstructured identities. |
| pkg/primitives/unstructured/handlers.go | Adds safe default grace/suspension handler implementations for unstructured primitives. |
| pkg/primitives/service/resource.go | Exposes GraceStatus on Service primitive resource wrapper. |
| pkg/primitives/service/handlers_test.go | Adds unit tests for Service default grace status handler. |
| pkg/primitives/service/handlers.go | Implements Service default grace status logic (LB ingress assignment). |
| pkg/primitives/service/builder.go | Wires default grace status handler and exposes WithCustomGraceStatus. |
| pkg/primitives/pvc/resource.go | Exposes GraceStatus on PVC primitive resource wrapper. |
| pkg/primitives/pvc/handlers_test.go | Adds unit tests for PVC default grace status handler. |
| pkg/primitives/pvc/handlers.go | Implements PVC default grace status mapping from phase. |
| pkg/primitives/pvc/builder.go | Wires default grace status handler and exposes WithCustomGraceStatus. |
| pkg/primitives/pv/resource.go | Exposes GraceStatus on PV primitive resource wrapper. |
| pkg/primitives/pv/handlers_test.go | Adds unit tests for PV default grace status handler. |
| pkg/primitives/pv/handlers.go | Implements PV default grace status mapping from phase. |
| pkg/primitives/pv/builder.go | Wires default grace status handler and exposes WithCustomGraceStatus. |
| pkg/primitives/ingress/resource.go | Exposes GraceStatus on Ingress primitive resource wrapper. |
| pkg/primitives/ingress/handlers_test.go | Adds unit tests for Ingress default grace status handler. |
| pkg/primitives/ingress/handlers.go | Implements Ingress default grace status (LB address assignment). |
| pkg/primitives/ingress/builder.go | Wires default grace status handler and exposes WithCustomGraceStatus. |
| pkg/primitives/hpa/resource.go | Exposes GraceStatus on HPA primitive resource wrapper. |
| pkg/primitives/hpa/handlers_test.go | Adds unit tests for HPA default grace status handler. |
| pkg/primitives/hpa/handlers.go | Implements HPA default grace status based on conditions. |
| pkg/primitives/hpa/builder.go | Wires default grace status handler and exposes WithCustomGraceStatus. |
| pkg/primitives/cronjob/resource.go | Exposes GraceStatus on CronJob primitive resource wrapper. |
| pkg/primitives/cronjob/handlers_test.go | Adds unit tests for CronJob default grace status handler. |
| pkg/primitives/cronjob/handlers.go | Implements CronJob default grace status (always healthy) and documents semantics. |
| pkg/primitives/cronjob/builder.go | Wires default grace status handler and exposes WithCustomGraceStatus. |
| pkg/mutation/editors/unstructuredcontent_test.go | Adds tests for UnstructuredContentEditor helper methods. |
| pkg/mutation/editors/unstructuredcontent.go | Introduces UnstructuredContentEditor for nested field mutation helpers. |
| pkg/generic/resource_integration.go | Adds grace status handler field + method to generic integration resource base. |
| pkg/generic/builder_workload.go | Adds //nolint:dupl directive for lint consistency. |
| pkg/generic/builder_task.go | Removes //nolint:dupl directive from generic task builder. |
| pkg/generic/builder_integration_test.go | Extends integration builder tests to cover grace handler wiring. |
| pkg/generic/builder_integration.go | Adds WithCustomGraceStatus to generic integration builder. |
| e2e/primitives/unstructured_workload_test.go | Adds e2e coverage for unstructured workload creation, grace, and error paths. |
| e2e/primitives/unstructured_task_test.go | Adds e2e coverage for unstructured task creation, mutations, grace, and error paths. |
| e2e/primitives/unstructured_static_test.go | Adds e2e coverage for unstructured static creation, mutations, and error paths. |
| e2e/primitives/unstructured_integration_test.go | Adds e2e coverage for unstructured integration creation, mutations, grace, and error paths. |
| e2e/primitives/service_test.go | Adds e2e scenario validating grace-period degraded reporting for Service. |
| e2e/primitives/pvc_test.go | Adds e2e scenario validating grace-period degraded reporting for PVC. |
| e2e/primitives/pv_test.go | Adds e2e scenario validating grace-period degraded reporting for PV (+ cleanup update). |
| e2e/primitives/ingress_test.go | Adds e2e scenario validating grace-period degraded reporting for Ingress. |
| e2e/primitives/hpa_test.go | Adds e2e scenario validating grace-period degraded reporting for HPA. |
| e2e/primitives/cronjob_test.go | Adds e2e scenario validating grace-period degraded reporting for CronJob. |
| docs/primitives/unstructured.md | Adds new documentation page describing unstructured primitives and usage. |
| docs/primitives/service.md | Documents Service grace status capability and handler override. |
| docs/primitives/pvc.md | Documents PVC grace status capability and handler override. |
| docs/primitives/pv.md | Documents PV grace status capability and handler override. |
| docs/primitives/ingress.md | Documents Ingress grace status capability and handler override. |
| docs/primitives/hpa.md | Documents HPA grace status capability and handler override. |
| docs/primitives/cronjob.md | Documents CronJob grace status (always healthy) and override guidance. |
| docs/primitives.md | Updates primitive category/interface docs and links to unstructured primitives docs. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 70 out of 70 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
pkg/generic/builder_task.go:6
duplis enabled in golangci-lint, and the other generic builder files suppress it via a//nolint:duplfile header. This file used to have that header but it was removed, which is likely to cause CI lint failures due to the high similarity across builder_*.go files. Consider restoring//nolint:duplat the top of this file (consistent with builder_integration.go / builder_workload.go).
package generic
import (
"github.com/sourcehawk/operator-component-framework/pkg/component/concepts"
"sigs.k8s.io/controller-runtime/pkg/client"
)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.