This repository has been archived by the owner on Nov 25, 2024. It is now read-only.
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 of your changes
We are planning to use
kustomize
to process the family provider CRDs.kustomize
outputs a multi-document YAML that contains all the processed CRDs and theup xpkg batch
command relies on the controller-tools naming conventions for the CRD files to decide which CRD goes into which family provider package. Thus it cannot currently partition CRDs if they are in a single file. I checked the possibility of a content based filter (instead of relying on the generated file name) but the interface isio.ReadCloser
, which processes a byte stream and is not aware of the YAML documents. Implementing a content filter will introduce unnecessary complexity due to the mismatching abstraction layers. Also considered a filteringparser.Parser
implementation but that interface returns a concreteparser.Package
(struct), which does not allow writes to its content list. So, that approach would require us to change theparser.Parser
interface.Instead of introducing
yq
, we first implemented a bash script processing the multi-doc YAML file line-by-line and splitting the over 900 CRDs of the official AWS provider family and it takes ~70 s on an M2 Mac to do so. Doing experiments withyq
, it completes in ~10 s. So, we would like to useyq
for splitting the multi-doc YAML output fromkustomize
.I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR, as appropriate.How has this code been tested
Tested both on the darwin ARM64 & linux AMD64 platforms.