Skip to content

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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 17, 2025
@xrstf xrstf requested a review from embik June 17, 2025 14:31
Copy link
Member

@embik embik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 24, 2025
@kcp-ci-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: e80978d74ba820cd4c8f935b1723ef34ff6ee5ba

@kcp-ci-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: embik

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 24, 2025
@kcp-ci-bot kcp-ci-bot merged commit 09a0f58 into main Jun 24, 2025
9 checks passed
@kcp-ci-bot kcp-ci-bot deleted the mutation-refactoring branch June 24, 2025 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. 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. lgtm Indicates that a PR is ready to be merged. 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.

4 participants