@@ -85,75 +85,6 @@ NAME SYNCED READY COMPOSITION AGE
8585my-composite-resource True True my-composition 4s
8686```
8787
88- ### Naming external resources
89- By default, managed resources created by a composite resource have the name of
90- the composite resource, followed by a random suffix.
91-
92- <!-- vale Google.FirstPerson = NO -->
93- <!-- vale Crossplane.Spelling = NO -->
94- For example, a composite resource named "my-composite-resource" creates external
95- resources named "my-composite-resource-fqvkw."
96- <!-- vale Google.FirstPerson = YES -->
97- <!-- vale Crossplane.Spelling = YES -->
98-
99- Resource names can be deterministic by applying an
100- {{<hover label =" annotation " line =" 5 " >}}annotation{{</hover >}} to the composite
101- resource.
102-
103- ``` yaml {label="annotation",copy-lines="none"}
104- apiVersion : example.org/v1alpha1
105- kind : MyDatabase
106- metadata :
107- namespace : default
108- name : my-composite-resource
109- annotations :
110- crossplane.io/external-name : my-custom-name
111- # Removed for brevity
112- ```
113-
114- Inside the Composition, use a
115- {{<hover label =" comp " line =" 10 " >}}patch{{</hover >}}
116- to apply the external-name to the resources.
117-
118- The {{<hover label =" comp " line =" 11 " >}}fromFieldPath{{</hover >}} patch copies the
119- {{<hover label =" comp " line =" 11 " >}}metadata.annotations{{</hover >}} field from
120- the composite resource to the
121- {{<hover label =" comp " line =" 12 " >}}metadata.annotations{{</hover >}} inside the
122- managed resource.
123-
124- {{<hint "note" >}}
125- If a managed resource has the ` crossplane.io/external-name ` annotation
126- Crossplane uses the annotation value to name the external resource.
127- {{</hint >}}
128-
129- ``` yaml {label="comp",copy-lines="none"}
130- apiVersion : apiextensions.crossplane.io/v1
131- kind : Composition
132- metadata :
133- name : my-composition
134- spec :
135- mode : Pipeline
136- pipeline :
137- - step : patch-and-transform
138- functionRef :
139- name : function-patch-and-transform
140- input :
141- apiVersion : pt.fn.crossplane.io/v1beta1
142- kind : Resources
143- resources :
144- - name : database
145- base :
146- # Removed for brevity
147- patches :
148- - fromFieldPath : metadata.annotations
149- toFieldPath : metadata.annotations
150- ` ` `
151-
152- For more information on using ` function-patch-and-transform` to patch
153- resources refer to the
154- [Function Patch and Transform]({{<ref "../guides/function-patch-and-transform">}})
155- documentation.
156-
15788### Composition selection
15889
15990Select a specific Composition for a composite resource to use with
0 commit comments