Skip to content

Update to function-sdk-go 0.5.0#498

Merged
bobh66 merged 15 commits intocrossplane-contrib:mainfrom
bobh66:update_v2
Dec 17, 2025
Merged

Update to function-sdk-go 0.5.0#498
bobh66 merged 15 commits intocrossplane-contrib:mainfrom
bobh66:update_v2

Conversation

@bobh66
Copy link
Collaborator

@bobh66 bobh66 commented Oct 21, 2025

Description of your changes

Update to function-sdk-go 0.5.0 which includes crossplane-runtime v2

I have:

@bobh66 bobh66 force-pushed the update_v2 branch 6 times, most recently from 8c2e1a4 to 89d5e73 Compare October 21, 2025 15:54
Copy link
Member

@jbw976 jbw976 left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me @bobh66, thanks for the follow up here!

@bobh66 bobh66 marked this pull request as draft October 21, 2025 16:39
fn.go Outdated

// Initialize the requirements.
requirements := &fnv1.Requirements{ExtraResources: make(map[string]*fnv1.ResourceSelector)}
requirements := &fnv1.Requirements{Resources: make(map[string]*fnv1.ResourceSelector)}

Choose a reason for hiding this comment

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

Switching from ExtraResources to Resources will break things
See crossplane/function-sdk-go#219

Copy link

@tenitski tenitski Oct 21, 2025

Choose a reason for hiding this comment

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

My PR #496 was breaking my Crossplane environment until I undid the related change ec3ecd1

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, that's why I put it back in Draft. We need to maintain the existing API to the user, which means adding the "extraResources" key into the template context with the same content as "requiredResources". Not ideal, but here we are.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch @tenitski, thanks for the reminder here! 😥

Copy link
Collaborator Author

@bobh66 bobh66 Dec 3, 2025

Choose a reason for hiding this comment

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

@negz - how does this work with a version of Crossplane that is still using the v1 version of the protobuf? Are we going to break ExtraResources functionality for older releases of Crossplane by changing this?

I'm concerned that this change may mean that the function now only works with v2 core Crossplane. Maybe we need to handle both message attributes for some interval until v1 Crossplane is completely unsupported.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm leaning towards a solution where namespaced extra resources use the new "resources" field and non-namespaced extra resources use the deprecated "extra_resources" field. That allows existing v1 core Crossplane deployments to continue working and v2 deployments can use the namespaced extra resources. Then if/when v1 Crossplane is declared dead we can update the function to use "resources" for all cases.

The existing "ExtraResources" API in the template will remain as it is not worth breaking backwards compatibility.

Thoughts/concerns?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm over-thinking this - we can continue to use rsp.requirements["extra_resources"] since it is supported in both v1 and v2 of Crossplane core, and we can accept both req.extra_resources and req.required_resources. I'll push an updated patchset.

Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
@bobh66 bobh66 marked this pull request as ready for review December 4, 2025 03:57
@bobh66 bobh66 requested review from jbw976 and tenitski December 4, 2025 03:58
renovate bot and others added 6 commits December 5, 2025 17:46
…ovate/examples

chore(deps): update xpkg.crossplane.io/crossplane-contrib/function-auto-ready docker tag to v0.6.0
…ovate/google.golang.org-protobuf-1.x

fix(deps): update module google.golang.org/protobuf to v1.36.11
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
@bobh66 bobh66 requested a review from tenitski December 12, 2025 21:08
@bobh66
Copy link
Collaborator Author

bobh66 commented Dec 12, 2025

@tenitski @jbw976 could you take one more pass - I think it's ready but I'd hate to miss something. Thanks!

Copy link

@tenitski tenitski left a comment

Choose a reason for hiding this comment

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

All good from my perspective

@bobh66 bobh66 merged commit fba11b5 into crossplane-contrib:main Dec 17, 2025
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.

3 participants