Skip to content

Crossplane v1-compatible build of function-extra-resources - #111

Merged
phisco merged 8 commits into
crossplane-contrib:mainfrom
jakubramut:feat/crossplane-v1
Jul 29, 2026
Merged

Crossplane v1-compatible build of function-extra-resources#111
phisco merged 8 commits into
crossplane-contrib:mainfrom
jakubramut:feat/crossplane-v1

Conversation

@jakubramut

Copy link
Copy Markdown
Contributor

Description of your changes

What

  • Protocol: revert to the legacy extra_resources gRPC fields (read/call/write) instead of the v2-only resources/required_resources. This is the only functional change - everything else (max-recv flag, custom context key, sorting, selectors) is untouched.
  • Package metadata: constraint >=v2.0.0-0 → >=v1.15.0-0; removed the capabilities: [required-resources] block.
  • Namespace guard: if Crossplane doesn't advertise capabilities (v1.x or <v2.2), a selector with namespace set now fails fast - on v1 the namespace filter is ignored server-side and would silently match across all namespaces.
  • Plus two guard unit tests and a README compatibility note.

Why

Upstream main (v0.3.0+) moved to the v2-only protocol fields, so it silently no-ops on Crossplane v1. This stream restores v1 support while staying dual-compatible: it uses the deprecated fields, which Crossplane v2 still resolves.

How has this code been tested

  • go build, go test, golangci-lint (CI-pinned v2.6.2): all pass.
  • E2E on kind, Crossplane 1.20.0: function installs; label-selected EnvironmentConfigs land in a custom context key and reach a downstream go-templating step (two-pass legacy round-trip); namespace selector yields the guard's Fatal event.
  • E2E on kind, Crossplane 2.3.4: same build installs and the same composition works (dual-compat); a namespace-scoped selector is honored server-side (guard stays silent).
  • --max-recv-message-size: verified it raises the function's request-recv limit (function accepted a 5.4 MB request that the 4 MB default rejected).

I have:

Signed-off-by: Jakub Ramut <jakub@upbound.io>
@jakubramut
jakubramut force-pushed the feat/crossplane-v1 branch from b1afab9 to 9f3aff5 Compare July 28, 2026 15:23
Comment thread README.md Outdated
Signed-off-by: Jakub Ramut <jakub@upbound.io>

@phisco phisco left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constraint and README look right now. One thing left.

Comment thread fn.go Outdated
@phisco

phisco commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Longer term, return requirements.resources when HasCapability(req, CAPABILITY_REQUIRED_RESOURCES) and the legacy field otherwise, merging both on read — then only the v1 leg breaks when the deprecated fields go. Beyond this PR's scope.

…ty guard

Signed-off-by: Jakub Ramut <jakub@upbound.io>
@jakubramut

Copy link
Copy Markdown
Contributor Author

@phisco,
thank you for the review - agreed with your comment - that's the right long-term shape. Keeping it out of this PR as you suggested - happy to follow up separately.

phisco and others added 4 commits July 29, 2026 11:28
Crossplane only defaults a Function to the composition capability when no
capabilities are declared at all, so an empty list would silently break
every composition using this function.

Signed-off-by: Philippe Scorsolini <5697904+phisco@users.noreply.github.com>
The namespace is not honored server-side on Crossplane v1 and never
matches a cluster-scoped kind on either major. The Reference not-found
error also blamed the Crossplane version for what is usually a typo.

Signed-off-by: Philippe Scorsolini <5697904+phisco@users.noreply.github.com>
Signed-off-by: Philippe Scorsolini <5697904+phisco@users.noreply.github.com>
Follow-ups for Crossplane v1 compatibility
@phisco
phisco self-requested a review July 29, 2026 11:37
@phisco
phisco merged commit 6594f83 into crossplane-contrib:main Jul 29, 2026
6 checks passed
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.

2 participants