Skip to content

Commit

Permalink
Merge pull request #171 from Peefy/filesystem-example
Browse files Browse the repository at this point in the history
feat: add filesytem note information
  • Loading branch information
Peefy authored Oct 16, 2024
2 parents abe5057 + c50a234 commit 24b19fc
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,46 @@ spec:
source: ./path/to/kcl/file.k
```
> Note: You can't run the FileSystem example using `crossplane render` because it loads templates from a ConfigMap in the cluster. You can create a `ConfigMap` with the templates using the following command.

```shell
kubectl create configmap templates --from-file=templates.k -n crossplane-system
```

This `ConfigMap` will be mounted to the function pod and the templates will be available in the `/templates` directory. See the following function config for details.

```yaml
apiVersion: pkg.crossplane.io/v1beta1
kind: Function
metadata:
name: function-kcl
spec:
package: xpkg.upbound.io/crossplane-contrib/function-kcl:latest
runtimeConfigRef:
name: mount-templates
---
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
name: mount-templates
spec:
deploymentTemplate:
spec:
selector: {}
template:
spec:
containers:
- name: package-runtime
volumeMounts:
- mountPath: /templates
name: templates
readOnly: true
volumes:
- name: templates
configMap:
name: templates
```

### Read the Function Requests and Values through the `option` Function

+ Read the [`ObservedCompositeResource`](https://docs.crossplane.io/latest/concepts/composition-functions/#observed-state) from `option("params").oxr`.
Expand Down

0 comments on commit 24b19fc

Please sign in to comment.