Skip to content

Refactor mutation handling #78

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Refactor mutation handling #78

wants to merge 2 commits into from

Conversation

xrstf
Copy link
Contributor

@xrstf xrstf commented Jun 17, 2025

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

NONE

@kcp-ci-bot kcp-ci-bot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the DCO. labels Jun 17, 2025
@kcp-ci-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from xrstf. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot kcp-ci-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 17, 2025
@xrstf xrstf requested a review from embik June 17, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has signed the DCO. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants