-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove managedFields from gathered resources #460
Remove managedFields from gathered resources #460
Conversation
Skipping CI for Draft Pull Request. |
69f8b2c
to
6b541ef
Compare
Haven't tested, but looks great |
|
||
if len(jsonBytesRM) >= len(jsonBytesDirect) { | ||
t.Fatalf("JSON from ResourceMarshaller is not smaller than directly marshalled JSON (%d >= %d)", len(jsonBytesRM), len(jsonBytesDirect)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last two tests could be merged into one using two test cases I guess, but it's really a minor detail and this is OK as well.
I didn't check the json files updates. I reviewed the changes in the code and randomly checked some files in the archive (IOW I ran it against cluster-bot cluster). The |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: natiiix, tremes The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
In OCP 4, JSON representations of resources returned by the API contain a metadata field called
managedFields
, which takes up a considerable amount of space without being of any use to us.This PR introduces a serialization/marshalling filter, which automatically removes this field from resources stored in the IO archive by using
ResourceMarshaller
instead ofJSONMarshaller
for resources that havemanagedFields
. This is performed in a somewhat type-safe way for compile-time transparency.The result is an archive size reduction, both in the raw and compressed form, by approximately 10%.
Categories
Sample Archive
Many sample resource JSONs have been modified, so please see the "Files changed" tab for a complete list.
All resources affected by this change should now be updated in the sample archive. There should be no
managedFields
present in any of the sample resources.Documentation
No.
Unit Tests
pkg/record/resource_marshaller_test.go
Test_ResourceMarshaller_GetExtension
Test_ResourceMarshaller_MarshalUnstructured
Test_ResourceMarshaller_MarshalPod
Privacy
Yes. There are no sensitive data in the newly collected information.
This PR adds no new data to the archive, only removes the
managedFields
fields.Changelog
No.
Breaking Changes
No.
The
managedFields
fields have been removed, but these should not be used by any of the software that processes the IO archives.References
Jira Task: https://issues.redhat.com/browse/CCXDEV-4899