Add explicit Apply method to ClientApplicator#115
Merged
DMilmont merged 1 commit intoreddit:mainfrom May 6, 2026
Merged
Conversation
Resolves method ambiguity for external consumers that use a newer controller-runtime (v0.22+) where client.Client gains its own Apply method. Without this, *ClientApplicator has two promoted Apply methods with incompatible signatures, causing compile errors in downstream repos. Includes a compile-time interface satisfaction check for Applicator.
erik-ringsmuth
approved these changes
May 6, 2026
erik-ringsmuth
left a comment
There was a problem hiding this comment.
I like this approach! I'm adding @harveyxia as well since he had a different idea, but I think this is better because it's not a breaking change.
harveyxia
approved these changes
May 6, 2026
Collaborator
harveyxia
left a comment
There was a problem hiding this comment.
Awesome, nice and simple fix that is backwards compatible.
And users will still have access to the controller-runtime method by calling c.Client.Apply()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When consumers use a newer controller-runtime than the SDK, the promoted method set on ClientApplicator breaks. This will also be a problem if/when the SDK itself upgrades.
Note: The SDK itself is not yet on controller-runtime v0.22, making this a preemptive fix. That said, the change is minimal and removes complexity that any consumer on v0.22+ would otherwise have to work around independently. It also means one (minor) fewer thing to address if/when this is upgraded to v0.22+
This is probably worth discussing if this is worth adding now vs later (v0.22+)
Closes # #114
💸 TL;DR
controller-runtime v0.22 added
Applytoclient.Client. SinceClientApplicatorembeds bothclient.ClientandApplicator(which also hasApply), Go's method promotion becomes ambiguous for consumers on v0.22+. This adds an explicitApplymethod that delegates toApplicator.Apply, resolving the ambiguity with zero behavioral change.📜 Details
Background:
ClientApplicatorstruct's public API.What changed:
func (ca *ClientApplicator) Apply(...)that delegates toca.Applicator.Apply(...)var _ Applicator = (*ClientApplicator)(nil)compile-time checkWhy now:
Downstream consumers that depend on achilles-sdk but use controller-runtime v0.22+ are currently broken by this ambiguity. This will also be required when achilles-sdk itself upgrades to v0.22.
🧪 Testing Steps / Validation
go build ./...passes across the entire SDKvar _ Applicator = (*ClientApplicator)(nil)) serves as a regression guardpkg/io/applicator_test.goexerciseapplicator.Apply(...)and compile cleanly with the new explicit method✅ Checks