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.
Summary
This PR refactors the internal code for handling mutations a bit. Each possible mutation (called "transformation" to have a different word for it) is now its own dedicated type (like templateTransformer, deleteTransformer, ...) and one aggregatedTransformer (that runs a number of other transformers in sequence).
The existing Mutator interface remains, but now makes use of the aggregated transformers in the background.
The reason for doing this refactoring is that we want to soon support CEL, but from what I read and saw in the k/k codebase, CEL compilation is comparatively expensive and so we should cache any compiled CEL expression. Thankfully the agent already works by re-starting the sync controller whenever a PubRes changes, so it's now trivial for the sync controller to ensure all mutations (transformations) are compiled once and then cached.
There is no CEL yet because I think this PR alone is hefty enough to review.
part of #73
What Type of PR Is This?
/kind cleanup
Release Notes