Skip to content

feat(diffprocessor): add --function-registry flag to override function image registry#2

Draft
cahillsf wants to merge 4 commits into
mainfrom
stephen.cahill/CLOUDR-1645-introduce-registry-override
Draft

feat(diffprocessor): add --function-registry flag to override function image registry#2
cahillsf wants to merge 4 commits into
mainfrom
stephen.cahill/CLOUDR-1645-introduce-registry-override

Conversation

@cahillsf
Copy link
Copy Markdown
Owner

@cahillsf cahillsf commented May 5, 2026

Description of your changes

Adds a --function-registry-override CLI flag that rewrites the registry portion of every function package reference at diff time, via a new RegistryOverrideFunctionProvider that wraps the default FunctionProvider. 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 how crossplane-diff pulls images locally — it does not modify Function resources or anything in the cluster.

Example: --function-registry-override my-company.registry.io rewrites
xpkg.crossplane.io/crossplane-contrib/function-go-templating:v0.11.0 to
my-company.registry.io/crossplane-contrib/function-go-templating:v0.11.0.

Refs: CLOUDR-1645

I have:

  • Read and followed Crossplane's contribution process.
  • Run earthly -P +reviewable to ensure this PR is ready for review.
  • Added or updated unit tests.
  • Added or updated e2e tests.
  • Documented this change as needed.
  • Followed the API promotion workflow if this PR introduces, removes, or promotes an API.

@cahillsf cahillsf force-pushed the stephen.cahill/CLOUDR-1645-introduce-registry-override branch 4 times, most recently from ecbe34e to b0700d5 Compare May 5, 2026 18:16
cahillsf added 4 commits May 5, 2026 14:36
…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>
@cahillsf cahillsf force-pushed the stephen.cahill/CLOUDR-1645-introduce-registry-override branch from b0700d5 to d265494 Compare May 5, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant