The C# SDK for writing composition functions.
- XRD to Model Generation
- Modify the xrd.yaml and models will be automatically generated
- CRD to Model Generation
- Add crd.yaml(s) to the project and models will be automatically generated
- Most Crossplane Providers already published KubernetesCRDModelGen
Group NuGet aws.upbound.io Link azapi.upbound.io Link azure.upbound.io Link azuread.upbound.io Link crossplane.io Link databricks.crossplane.io Link gcp.upbound.io Link helm.crossplane.io Link kubernetes.crossplane.io Link opentofu.upbound.io Link tf.upbound.io Link upbound.io Link vault.upbound.io Link
- Supports Crossplane v1.17 or greater
You can run your function locally and test it using crossplane render
with the example manifests.
https://releases.crossplane.io/stable/current/bin
Download the lastest .NET 9 SDK
dotnet debug
docker build -t function-sdk-csharp-sample -f src/Function.SDK.CSharp.Sample/Dockerfile src
docker run -it -p 9443:9443 function-sdk-csharp-sample
Then, in another terminal, call it with these example manifests
crossplane render example/xr.yaml example/composition.yaml example/functions.yaml
---
apiVersion: platform.example.com/v1alpha1
kind: XStorageBucket
metadata:
name: example
status:
conditions:
- lastTransitionTime: "2024-01-01T00:00:00Z"
message: 'Unready resources: account, container, and rg'
reason: Creating
status: "False"
type: Ready
---
apiVersion: storage.azure.upbound.io/v1beta1
kind: Account
metadata:
annotations:
crossplane.io/composition-resource-name: account
labels:
crossplane.io/composite: example
name: example
ownerReferences:
- apiVersion: platform.example.com/v1alpha1
blockOwnerDeletion: true
controller: true
kind: XStorageBucket
name: example
uid: ""
spec:
forProvider:
accountReplicationType: LRS
accountTier: Standard
blobProperties:
- versioningEnabled: true
infrastructureEncryptionEnabled: true
location: eastus
resourceGroupNameSelector:
matchLabels:
matchControllerRef: "True"
---
apiVersion: storage.azure.upbound.io/v1beta1
kind: Container
metadata:
annotations:
crossplane.io/composition-resource-name: container
generateName: example-
labels:
crossplane.io/composite: example
ownerReferences:
- apiVersion: platform.example.com/v1alpha1
blockOwnerDeletion: true
controller: true
kind: XStorageBucket
name: example
uid: ""
spec:
forProvider:
containerAccessType: public
storageAccountNameSelector:
matchLabels:
matchControllerRef: "True"
---
apiVersion: azure.upbound.io/v1beta1
kind: ResourceGroup
metadata:
annotations:
crossplane.io/composition-resource-name: rg
generateName: example-
labels:
crossplane.io/composite: example
ownerReferences:
- apiVersion: platform.example.com/v1alpha1
blockOwnerDeletion: true
controller: true
kind: XStorageBucket
name: example
uid: ""
spec:
forProvider:
location: eastus