Skip to content

crossplane render only honors the LAST --extra-resources flag #90

@melvinkcx

Description

@melvinkcx

Summary

crossplane render (and crossplane composition render) silently ignores all but the
last --extra-resources / --required-resources flag
. When the flag is passed more
than once, only the file/dir given in the final occurrence is loaded; resources in the
earlier occurrences are never made available to the function pipeline — with no error or
warning. Functions that request those resources receive an empty set.

  • CLI: crossplane v2.3.1
  • Render engine: --crossplane-version=v2.3.1 (Docker-based render; default stable)
  • function-go-templating v0.12.1, function-auto-ready v0.6.5

Files

  • xr.yaml — a trivial composite resource
  • xrd.yaml — the XRD defining the XR composite type. Optionalcrossplane render does not require an XRD (it renders the XR directly against the Composition);
    it's included only to make the example self-contained and can be passed with --xrd.
  • min-composition.yaml — one pipeline step (function-go-templating) that requests a
    ConfigMap labelled group=a and writes the number it received into the composed
    ConfigMap's data.count
  • min-wanted.yaml — the ConfigMap the function wants (group=a)
  • min-filler.yaml — an unrelated ConfigMap (group=b)
  • functions-public.yaml — same functions using public xpkg.crossplane.io images

functions-public.yaml
min-composition.yaml
min-filler.yaml
min-wanted.yaml
xr.yaml
xrd.yaml

Run

# Docker must be running (the engine renders in a container)

# A) single flag — works, count == 1
crossplane composition render --crossplane-version=v2.3.1 \
  xr.yaml min-composition.yaml functions-public.yaml \
  --extra-resources min-wanted.yaml | grep count

# B) two flags, wanted THEN filler — BUG: count == 0 (wanted file is dropped)
crossplane composition render --crossplane-version=v2.3.1 \
  xr.yaml min-composition.yaml functions-public.yaml \
  --extra-resources min-wanted.yaml \
  --extra-resources min-filler.yaml | grep count

# C) two flags, filler THEN wanted — works, count == 1 (only the LAST flag is honored)
crossplane composition render --crossplane-version=v2.3.1 \
  xr.yaml min-composition.yaml functions-public.yaml \
  --extra-resources min-filler.yaml \
  --extra-resources min-wanted.yaml | grep count

Observed

Invocation data.count
A) --extra-resources wanted "1"
B) --extra-resources wanted --extra-resources filler "0"
C) --extra-resources filler --extra-resources wanted "1"

Putting both resources in a single file (or a single directory) also yields "1",
confirming the data is fine — only the repeated flag is mishandled.

The same is observable with --required-resources (the non-deprecated flag) and with a
mix of resource kinds (e.g. a step requesting a custom resource plus a
function-environment-configs step requesting an EnvironmentConfig): whichever
requirement's resource is not in the final --extra-resources file is dropped, and the
corresponding function silently composes nothing.

Expected

Resources from all --extra-resources / --required-resources occurrences should be
merged and made available to the pipeline.

Workaround

Pass a single --extra-resources argument — either one YAML file containing all the
resources, or a directory of YAML files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions