Add PrrSizeBytes to v1alpha2 PackageRevision status#977
Open
efiacor wants to merge 7 commits into
Open
Conversation
Both PR controller and repo controller now calculate and set status.prrSizeBytes on v1alpha2 CRDs from the in-memory resource map. Covers init, clone, push/render, and repo discovery paths. E2E tests use relative assertions (> 0, > initial) for resilience. Signed-off-by: Fiachra Corcoran <fiachra.corcoran@est.tech>
✅ Deploy Preview for porch ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new status.prrSizeBytes field to the porch.kpt.dev/v1alpha2 PackageRevision API so clients can see total package resource content size without fetching PRR contents, and wires both the package revision controller and repository sync controller to populate it.
Changes:
- Added
PrrSizeBytesto the v1alpha2PackageRevisionStatustype and CRD schema. - Populated
status.prrSizeBytesfrom package resources in the package revision controller and repository controller sync. - Added unit tests and extended E2E coverage to assert
PrrSizeBytesis populated and updates after content changes.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/crd/repository_test.go | Asserts discovered v1alpha2 package revisions have status.prrSizeBytes populated. |
| test/e2e/crd/push_test.go | Records initial size and asserts PrrSizeBytes increases after pushing content. |
| test/e2e/crd/init_test.go | Asserts PrrSizeBytes is populated after init. |
| test/e2e/crd/clone_test.go | Asserts PrrSizeBytes is populated after clone. |
| pkg/repository/util.go | Introduces CalculateResourcesSize helper to sum resource content sizes. |
| pkg/repository/util_test.go | Adds unit tests for CalculateResourcesSize. |
| controllers/repositories/pkg/controllers/repository/pkgrevsync.go | Computes and syncs PrrSizeBytes on repo-discovered v1alpha2 PackageRevisions. |
| controllers/repositories/pkg/controllers/repository/pkgrevsync_test.go | Adds tests validating size calculation and up-to-date checks include PrrSizeBytes. |
| controllers/packagerevisions/pkg/controllers/packagerevision/status.go | Computes PrrSizeBytes during PR controller status updates. |
| controllers/packagerevisions/pkg/controllers/packagerevision/status_test.go | Extends status unit tests to assert PrrSizeBytes is set. |
| controllers/packagerevisions/pkg/controllers/packagerevision/packagerevision_controller_test.go | Updates mock defaults to provide resource contents for new status calculation. |
| api/porch/v1alpha2/porch.kpt.dev_packagerevisions.yaml | Adds CRD schema for status.prrSizeBytes. |
| api/porch/v1alpha2/packagerevision_types.go | Adds PrrSizeBytes field to PackageRevisionStatus. |
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.



Description
status.prrSizeByteson v1alpha2 CRDsRelated Issue(s)
Type of Change
Checklist
Testing Instructions
kubectl get packagerevision <name> -o yaml— verifystatus.prrSizeBytes > 0Additional Notes
AI Disclosure
[x] I have used AI in the creation of this PR.