@@ -58,7 +58,7 @@ A [composite resource]({{<ref "./composite-resources">}}) or XR is a custom API.
5858You use two Crossplane types to create a new custom API:
5959
6060* A [Composite Resource Definition]({{<ref "./composite-resource-definitions">}})
61- (XRD) - Defines the XR's schema.
61+ (XRD) - Defines the XR's schema.
6262* A Composition - This page. Configures how the XR creates other resources.
6363{{</expand >}}
6464
@@ -659,11 +659,11 @@ A function can change:
659659* The `status` of the composite resource.
660660* The `metadata` and `spec` of any composed resource.
661661
662- A function can also change the connection details and readiness of the composite
663- resource. A function indicates that the composite resource is ready by telling
664- Crossplane whether its composed resources are ready. When the function pipeline
665- tells Crossplane that all composed resources are ready, Crossplane marks the
666- composite resource as ready.
662+ A function can also change the readiness of the composite resource. A function
663+ indicates that the composite resource is ready by telling Crossplane whether its
664+ composed resources are ready. When the function pipeline tells Crossplane that
665+ all composed resources are ready, Crossplane marks the composite resource as
666+ ready.
667667
668668A function can't change :
669669
@@ -812,20 +812,20 @@ spec:
812812 kind: Script
813813 script: |
814814 from crossplane.function import request
815-
815+
816816 def compose(req, rsp):
817817 observed_xr = req.observed.composite.resource
818-
818+
819819 # Access the required ConfigMap using the helper function
820820 config_map = request.get_required_resource(req, "app-config")
821-
821+
822822 if not config_map:
823823 # Fallback image if ConfigMap not found
824824 image = "nginx:latest"
825825 else:
826826 # Read image from ConfigMap data
827827 image = config_map.get("data", {}).get("image", "nginx:latest")
828-
828+
829829 # Create deployment with the configured image
830830 rsp.desired.resources["deployment"].resource.update({
831831 "apiVersion": "apps/v1",
@@ -877,33 +877,33 @@ spec:
877877 kind: Script
878878 script: |
879879 from crossplane.function import request, response
880-
880+
881881 def compose(req, rsp):
882882 observed_xr = req.observed.composite.resource
883-
883+
884884 # Always request the ConfigMap to ensure stable requirements
885885 config_name = observed_xr["spec"].get("configName", "default-config")
886886 namespace = observed_xr["metadata"].get("namespace", "default")
887-
887+
888888 response.require_resources(
889- rsp,
889+ rsp,
890890 name="dynamic-config",
891891 api_version="v1",
892892 kind="ConfigMap",
893893 match_name=config_name,
894894 namespace=namespace
895895 )
896-
896+
897897 # Check if we have the required ConfigMap
898898 config_map = request.get_required_resource(req, "dynamic-config")
899-
899+
900900 if not config_map:
901901 # ConfigMap not found yet - Crossplane will call us again
902902 return
903-
903+
904904 # ConfigMap found - use the image data to create deployment
905905 image = config_map.get("data", {}).get("image", "nginx:latest")
906-
906+
907907 rsp.desired.resources["deployment"].resource.update({
908908 "apiVersion": "apps/v1",
909909 "kind": "Deployment",
@@ -955,12 +955,12 @@ context.
955955# ## Function response cache
956956
957957{{<hint "note" >}}
958- Function response caching is an alpha feature. Enable it by setting the
958+ Function response caching is an alpha feature. Enable it by setting the
959959` --enable-function-response-cache` feature flag.
960960{{< /hint >}}
961961
962- Crossplane can cache function responses to improve performance by reducing
963- repeated function calls. When enabled, Crossplane caches responses from
962+ Crossplane can cache function responses to improve performance by reducing
963+ repeated function calls. When enabled, Crossplane caches responses from
964964composition functions that include a time to live (TTL) value.
965965
966966The cache works by :
@@ -981,5 +981,5 @@ Control the cache behavior with these Crossplane pod arguments:
981981- `--xfn-cache-max-ttl` - Maximum cache duration (default : 24 hours)
982982
983983The cache stores files in the `/cache/xfn/` directory in the Crossplane pod.
984- For better performance, consider using an in-memory cache by mounting an
984+ For better performance, consider using an in-memory cache by mounting an
985985emptyDir volume with `medium : Memory`.
0 commit comments