feat(diffprocessor): add --function-registry-override flag to override function image registry#314
Merged
jcogilvie merged 4 commits intoMay 5, 2026
Conversation
ecbe34e to
b0700d5
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a CLI flag to override the registry host used when pulling Crossplane function images during diff processing, intended to support registry mirrors / air-gapped environments without mutating in-cluster Function resources.
Changes:
- Added
--function-registry-overrideflag and threaded it from CLI parsing into diff processor configuration. - Wrapped the existing
FunctionProviderwith aRegistryOverrideFunctionProviderthat rewrites function package refs before use. - Added unit tests for the registry rewrite helper and provider wrapper; updated README flag documentation for
xrandcomp.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new --function-registry-override flag for xr and comp. |
| cmd/diff/main.go | Adds the new CLI flag to shared command fields. |
| cmd/diff/cmd_utils.go | Plumbs the CLI flag into diffprocessor options. |
| cmd/diff/diffprocessor/processor_config.go | Adds config field + option constructor for the override. |
| cmd/diff/diffprocessor/diff_processor.go | Wraps the FunctionProvider when an override is configured. |
| cmd/diff/diffprocessor/function_provider.go | Implements the provider wrapper and replaceRegistry helper. |
| cmd/diff/diffprocessor/function_provider_test.go | Adds tests for replaceRegistry and the wrapper provider. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…n image registry Introduces a CLI flag that rewrites the registry portion of every function package ref before functions are pulled, via a RegistryOverrideFunctionProvider that wraps the default provider. Refs: CLOUDR-1645 Signed-off-by: Stephen Cahill <stephen.cahill@datadoghq.com>
- Drop redundant explicit type from functionProvider declaration; use a type conversion at the call site to keep the variable typed as the FunctionProvider interface. - Add doc comments on RegistryOverrideFunctionProvider.GetFunctionsForComposition and .Cleanup. Signed-off-by: Stephen Cahill <stephen.cahill@datadoghq.com>
…rride The flag always rewrites the registry portion of every function package ref; "override" reads more accurately than the flag setting "the" function registry, and aligns with the existing RegistryOverrideFunctionProvider type name. Renames: - --function-registry -> --function-registry-override - CommonCmdFields.FunctionRegistry -> .FunctionRegistryOverride - ProcessorConfig.FunctionRegistry -> .FunctionRegistryOverride - WithFunctionRegistry -> WithFunctionRegistryOverride Refs: CLOUDR-1645 Signed-off-by: Stephen Cahill <stephen.cahill@datadoghq.com>
Adds the new flag to the xr and comp flag tables and a "Function Registry Override" section parallel to the existing "Function Credentials" section, covering when to use the flag and how it rewrites package refs. Refs: CLOUDR-1645 Signed-off-by: Stephen Cahill <stephen.cahill@datadoghq.com>
b0700d5 to
d265494
Compare
Collaborator
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
jcogilvie
approved these changes
May 5, 2026
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.
Description of your changes
Adds a
--function-registry-overrideCLI flag that rewrites the registry portion of every function package reference at diff time, via a newRegistryOverrideFunctionProviderthat wraps the defaultFunctionProvider. The path, tag, and/or digest in each ref are preserved — only the registry hostname is replaced. Useful in air-gapped environments, behind corporate proxies, or when pulling function images from a registry mirror.The override applies to both standard tag refs (
registry/path:tag) and digest refs (registry/path@sha256:...). Refs without a/are left untouched. The flag only affects howcrossplane-diffpulls images locally — it does not modifyFunctionresources or anything in the cluster.Example:
--function-registry-override my-company.registry.iorewritesxpkg.crossplane.io/crossplane-contrib/function-go-templating:v0.11.0tomy-company.registry.io/crossplane-contrib/function-go-templating:v0.11.0.Fixes #
I have:
earthly -P +reviewableto ensure this PR is ready for review.Added or updated e2e tests.Followed the API promotion workflow if this PR introduces, removes, or promotes an API.