feat(diffprocessor): add --function-registry flag to override function image registry#2
Draft
cahillsf wants to merge 4 commits into
Draft
Conversation
ecbe34e to
b0700d5
Compare
…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
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.Refs: CLOUDR-1645
I have:
earthly -P +reviewableto ensure this PR is ready for review.