You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,6 +167,44 @@ spec:
167
167
name: templates
168
168
```
169
169
170
+
### Use as a Base Image
171
+
172
+
This function can also be used as a base image to build complex functions in KCL. To do this, add your KCL code to the image and set the `FUNCTION_KCL_DEFAULT_SOURCE` environment variable to the path where you put your code.
173
+
174
+
For example, if you have the following in `main.k`:
You can use the following Dockerfile to build a function that runs the code above and does not require any input:
198
+
199
+
```dockerfile
200
+
FROM xpkg.upbound.io/crossplane-contrib/function-kcl:latest
201
+
202
+
ADD main.k /src/main.k
203
+
ENV FUNCTION_KCL_DEFAULT_SOURCE=/src/main.k
204
+
```
205
+
206
+
You may also wish to replace the `/package.yaml` metadata file to give your new function a unique name and remove or replace the input CRD.
207
+
170
208
### Read the Function Requests and Values through the `option` Function
171
209
172
210
+ Read the [`ObservedCompositeResource`](https://docs.crossplane.io/latest/concepts/composition-functions/#observed-state) from `option("params").oxr`.
0 commit comments