Skip to content

Conversation

@jbw976
Copy link
Member

@jbw976 jbw976 commented Dec 29, 2025

This PR adds support for connection details in Crossplane v2 composite resources.

v2 XRs don't support the classic connection details flow where functions return details via the function response and Crossplane core creates the secret. Instead, for v2 XRs, this function now automatically composes a Secret resource containing the connection details and includes it with the XR's other composed resources.

The README has been updated with some details about how this works and some small snippet examples, I recommend reading that first.

The new connection details composition guide will be updated to include an example for function-patch-and-transform once this PR is merged and a release is published.

A full [connection details guide][docs-connection-details] can be found in the
Crossplane documentation.

### Setting name/namespace

Choose a reason for hiding this comment

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

it would be helpful to explicitly state that these rules apply only to Crossplane v2-style XRs

Copy link
Member Author

Choose a reason for hiding this comment

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

cool, i will add some clarification here, good point!

schema, this function will use that reference. This can be useful for maintaining
consistency with existing XR configurations.

**Default auto generated**

Choose a reason for hiding this comment

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

I’m sceptical about automatically generating a connection Secret. Creating a Secret is a security and lifecycle significant action, and I think it should require explicit user intent via the options above.

Copy link
Member Author

@jbw976 jbw976 Jan 1, 2026

Choose a reason for hiding this comment

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

thanks for bringing this up, I can see some merit to this point. However, I think it's still a good idea to automatically generate a connection secret because:

  • this was already being done in the v1 flow, the XR would automatically get a connection secret created for it named <XR-uuid>
  • i would argue the user has explicitly specified their intent to have a secret by including connectionDetails for at least 1 of their resources in the composition. If they haven't specified any of those, then no secret will be created
  • this hopefully lowers the friction/changes for users migrating from v1 - if they do nothing with their composition for connection details, it "still works" and a secret is still created for them.

what do you think about that perspective?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Although I can also see the security concern, I agree it makes sense to default to the v1 behavior here 👍

Choose a reason for hiding this comment

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

i would argue the user has explicitly specified their intent to have a secret by including connectionDetails for at least 1 of their resources in the composition. If they haven't specified any of those, then no secret will be created

This is a valid point :)

Copy link
Collaborator

@phisco phisco left a comment

Choose a reason for hiding this comment

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

Looking good now, thanks @jbw976!

@jbw976 jbw976 merged commit 51ffd1c into crossplane-contrib:main Jan 9, 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.

3 participants