Define a custom API (XBucket) and a Composition that creates an S3 Bucket when a user creates an XR. Uses function-patch-and-transform.
- Crossplane installed
- provider-aws-s3 installed and healthy
- function-patch-and-transform installed
- ClusterProviderConfig with AWS credentials (see 02-provider-config-aws)
- XRD (defines the API)
- Composition (implements it with a function pipeline)
- XR (instance of the API)
kubectl apply -f xrd.yaml
kubectl apply -f composition.yaml
kubectl apply -f xr.yamlOr apply the directory (order may matter; apply XRD first):
kubectl apply -f xrd.yaml -f composition.yaml -f xr.yamlkubectl get xbucket
kubectl get bucket -n default
kubectl describe xbucket my-bucket -n defaultIf you have the Crossplane CLI and Docker:
crossplane render xr.yaml composition.yaml functions.yaml(You need a functions.yaml that declares the function-patch-and-transform Function so the CLI knows which image to run.)
kubectl delete -f xr.yaml
kubectl delete -f composition.yaml
kubectl delete -f xrd.yaml