Skip to content

Commit 36999a7

Browse files
committed
Use spec.crossplane in all examples
Signed-off-by: Nic Cope <[email protected]>
1 parent 2b766dc commit 36999a7

File tree

2 files changed

+60
-58
lines changed

2 files changed

+60
-58
lines changed

content/v2.0-preview/composition/composite-resources.md

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ documentation.
157157
### Composition selection
158158

159159
Select a specific Composition for a composite resource to use with
160-
{{<hover label="compref" line="6">}}compositionRef{{</hover>}}
160+
{{<hover label="compref" line="7">}}compositionRef{{</hover>}}
161161

162162
{{<hint "important">}}
163163
The selected Composition must allow the composite resource to use it with a
@@ -173,14 +173,15 @@ metadata:
173173
namespace: default
174174
name: my-composite-resource
175175
spec:
176-
compositionRef:
177-
name: my-other-composition
176+
crossplane:
177+
compositionRef:
178+
name: my-other-composition
178179
# Removed for brevity
179180
```
180181

181182
A composite resource can also select a Composition based on labels instead of
182183
the exact name with a
183-
{{<hover label="complabel" line="6">}}compositionSelector{{</hover>}}.
184+
{{<hover label="complabel" line="7">}}compositionSelector{{</hover>}}.
184185

185186
Inside the {{<hover label="complabel" line="7">}}matchLabels{{</hover>}} section
186187
provide one or more Composition labels to match.
@@ -192,10 +193,11 @@ metadata:
192193
namespace: default
193194
name: my-composite-resource
194195
spec:
195-
compositionSelector:
196-
matchLabels:
197-
environment: production
198-
# Removed for brevity
196+
crossplane:
197+
compositionSelector:
198+
matchLabels:
199+
environment: production
200+
# Removed for brevity
199201
```
200202

201203
### Composition revision policy
@@ -204,16 +206,16 @@ Crossplane tracks changes to Compositions as
204206
[Composition revisions]({{<ref "composition-revisions">}}) .
205207

206208
A composite resource can use
207-
a {{<hover label="comprev" line="6">}}compositionUpdatePolicy{{</hover>}} to
209+
a {{<hover label="comprev" line="7">}}compositionUpdatePolicy{{</hover>}} to
208210
manually or automatically reference newer Composition revisions.
209211

210212
The default
211-
{{<hover label="comprev" line="6">}}compositionUpdatePolicy{{</hover>}} is
213+
{{<hover label="comprev" line="7">}}compositionUpdatePolicy{{</hover>}} is
212214
"Automatic." Composite resources automatically use the latest Composition
213215
revision.
214216

215217
Change the policy to
216-
{{<hover label="comprev" line="6">}}Manual{{</hover>}} to prevent composite
218+
{{<hover label="comprev" line="7">}}Manual{{</hover>}} to prevent composite
217219
resources from automatically upgrading.
218220

219221
```yaml {label="comprev",copy-lines="none"}
@@ -223,8 +225,9 @@ metadata:
223225
namespace: default
224226
name: my-composite-resource
225227
spec:
226-
compositionUpdatePolicy: Manual
227-
# Removed for brevity
228+
crossplane:
229+
compositionUpdatePolicy: Manual
230+
# Removed for brevity
228231
```
229232

230233
### Composition revision selection
@@ -235,7 +238,7 @@ A composite resource can
235238
select a specific Composition revision.
236239

237240

238-
Use {{<hover label="comprevref" line="6">}}compositionRevisionRef{{</hover>}} to
241+
Use {{<hover label="comprevref" line="7">}}compositionRevisionRef{{</hover>}} to
239242
select a specific Composition revision by name.
240243

241244
For example, to select a specific Composition revision use the name of the
@@ -248,10 +251,11 @@ metadata:
248251
namespace: default
249252
name: my-composite-resource
250253
spec:
251-
compositionUpdatePolicy: Manual
252-
compositionRevisionRef:
253-
name: my-composition-b5aa1eb
254-
# Removed for brevity
254+
crossplane:
255+
compositionUpdatePolicy: Manual
256+
compositionRevisionRef:
257+
name: my-composition-b5aa1eb
258+
# Removed for brevity
255259
```
256260

257261
{{<hint "note" >}}
@@ -268,7 +272,7 @@ my-composition-b5aa1eb 2 xmydatabases example.org/v1alpha1
268272

269273
A Composite resource can also select Composition revisions based on labels
270274
instead of the exact name with a
271-
{{<hover label="comprevsel" line="6">}}compositionRevisionSelector{{</hover>}}.
275+
{{<hover label="comprevsel" line="7">}}compositionRevisionSelector{{</hover>}}.
272276

273277
Inside the {{<hover label="comprevsel" line="7">}}matchLabels{{</hover>}}
274278
section provide one or more Composition revision labels to match.
@@ -281,10 +285,11 @@ metadata:
281285
namespace: default
282286
name: my-composite-resource
283287
spec:
284-
compositionRevisionSelector:
285-
matchLabels:
286-
channel: dev
287-
# Removed for brevity
288+
crossplane:
289+
compositionRevisionSelector:
290+
matchLabels:
291+
channel: dev
292+
# Removed for brevity
288293
```
289294

290295
### Pausing composite resources

content/v2.0-preview/composition/composition-revisions.md

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ some XRs to previous `Composition` settings without rolling back all XRs.
4242
When Composition Revisions are enabled three things happen:
4343

4444
1. Crossplane creates a `CompositionRevision` for each `Composition` update.
45-
1. Composite Resources gain a `spec.compositionRevisionRef` field that specifies
45+
1. Composite Resources gain a `spec.crossplane.compositionRevisionRef` field that specifies
4646
which `CompositionRevision` they use.
47-
1. Composite Resources gain a `spec.compositionUpdatePolicy` field that
47+
1. Composite Resources gain a `spec.crossplane.compositionUpdatePolicy` field that
4848
specifies how they should be updated to new Composition Revisions.
4949

5050
Each time you edit a `Composition` Crossplane will automatically create a
@@ -91,15 +91,13 @@ kind: PlatformDB
9191
metadata:
9292
name: example
9393
spec:
94-
parameters:
95-
storageGB: 20
96-
# The Manual policy specifies that you don't want this XR to update to the
97-
# latest CompositionRevision automatically.
98-
compositionUpdatePolicy: Manual
99-
compositionRef:
100-
name: example
101-
writeConnectionSecretToRef:
102-
name: db-conn
94+
storageGB: 20
95+
crossplane:
96+
# The Manual policy specifies that you don't want this XR to update to the
97+
# latest CompositionRevision automatically.
98+
compositionUpdatePolicy: Manual
99+
compositionRef:
100+
name: example
103101
```
104102
105103
Crossplane sets an XR's `compositionRevisionRef` automatically at creation time
@@ -113,16 +111,14 @@ kind: PlatformDB
113111
metadata:
114112
name: example
115113
spec:
116-
parameters:
117-
storageGB: 20
118-
compositionUpdatePolicy: Manual
119-
compositionRef:
120-
name: example
121-
# Update the referenced CompositionRevision if and when you are ready.
122-
compositionRevisionRef:
123-
name: example-18pdg
124-
writeConnectionSecretToRef:
125-
name: db-conn
114+
storageGB: 20
115+
crossplane:
116+
compositionUpdatePolicy: Manual
117+
compositionRef:
118+
name: example
119+
# Update the referenced CompositionRevision if and when you are ready.
120+
compositionRevisionRef:
121+
name: example-18pdg
126122
```
127123

128124
## Complete example
@@ -160,7 +156,6 @@ metadata:
160156
channel: dev
161157
name: myvpcs.aws.example.upbound.io
162158
spec:
163-
writeConnectionSecretsToNamespace: crossplane-system
164159
compositeTypeRef:
165160
apiVersion: aws.example.upbound.io/v1alpha1
166161
kind: MyVPC
@@ -259,9 +254,10 @@ metadata:
259254
name: vpc-man
260255
spec:
261256
id: vpc-man
262-
compositionUpdatePolicy: Manual
263-
compositionRevisionRef:
264-
name: myvpcs.aws.example.upbound.io-ad265bc
257+
crossplane:
258+
compositionUpdatePolicy: Manual
259+
compositionRevisionRef:
260+
name: myvpcs.aws.example.upbound.io-ad265bc
265261
```
266262

267263
Expected Output:
@@ -278,9 +274,10 @@ metadata:
278274
name: vpc-dev
279275
spec:
280276
id: vpc-dev
281-
compositionRevisionSelector:
282-
matchLabels:
283-
channel: dev
277+
crossplane:
278+
compositionRevisionSelector:
279+
matchLabels:
280+
channel: dev
284281
```
285282
Expected Output:
286283
```shell
@@ -295,9 +292,10 @@ metadata:
295292
name: vpc-staging
296293
spec:
297294
id: vpc-staging
298-
compositionRevisionSelector:
299-
matchLabels:
300-
channel: staging
295+
crossplane:
296+
compositionRevisionSelector:
297+
matchLabels:
298+
channel: staging
301299
```
302300

303301
Expected Output:
@@ -308,7 +306,7 @@ myvpc.aws.example.upbound.io/vpc-staging created
308306
Verify the Composite Resource with the label `channel: staging` doesn't have a `REVISION`.
309307
All other XRs have a `REVISION` matching the created Composition Revision.
310308
```shell
311-
kubectl get composite -o="custom-columns=NAME:.metadata.name,SYNCED:.status.conditions[0].status,REVISION:.spec.compositionRevisionRef.name,POLICY:.spec.compositionUpdatePolicy,MATCHLABEL:.spec.compositionRevisionSelector.matchLabels"
309+
kubectl get composite -o="custom-columns=NAME:.metadata.name,SYNCED:.status.conditions[0].status,REVISION:.spec.crossplane.compositionRevisionRef.name,POLICY:.spec.crossplane.compositionUpdatePolicy,MATCHLABEL:.spec.crossplane.compositionRevisionSelector.matchLabels"
312310
```
313311
Expected Output:
314312
```shell
@@ -352,7 +350,7 @@ Verify that Crossplane assigns the Composite Resources `vpc-auto` and `vpc-stagi
352350
XRs `vpc-man` and `vpc-dev` are still assigned to the original `revision:1`:
353351

354352
```shell
355-
kubectl get composite -o="custom-columns=NAME:.metadata.name,SYNCED:.status.conditions[0].status,REVISION:.spec.compositionRevisionRef.name,POLICY:.spec.compositionUpdatePolicy,MATCHLABEL:.spec.compositionRevisionSelector.matchLabels"
353+
kubectl get composite -o="custom-columns=NAME:.metadata.name,SYNCED:.status.conditions[0].status,REVISION:.spec.crossplane.compositionRevisionRef.name,POLICY:.spec.crossplane.compositionUpdatePolicy,MATCHLABEL:.spec.crossplane.compositionRevisionSelector.matchLabels"
356354
```
357355
Expected Output:
358356
```shell
@@ -380,7 +378,6 @@ metadata:
380378
channel: dev
381379
name: myvpcs.aws.example.upbound.io
382380
spec:
383-
writeConnectionSecretsToNamespace: crossplane-system
384381
compositeTypeRef:
385382
apiVersion: aws.example.upbound.io/v1alpha1
386383
kind: MyVPC
@@ -431,7 +428,7 @@ Verify Crossplane assigns the Composite Resources `vpc-auto` and `vpc-dev` to Co
431428
`vpc-staging` is assigned to `revision:2`, and `vpc-man` is still assigned to the original `revision:1`:
432429

433430
```shell
434-
kubectl get composite -o="custom-columns=NAME:.metadata.name,SYNCED:.status.conditions[0].status,REVISION:.spec.compositionRevisionRef.name,POLICY:.spec.compositionUpdatePolicy,MATCHLABEL:.spec.compositionRevisionSelector.matchLabels"
431+
kubectl get composite -o="custom-columns=NAME:.metadata.name,SYNCED:.status.conditions[0].status,REVISION:.spec.crossplane.compositionRevisionRef.name,POLICY:.spec.crossplane.compositionUpdatePolicy,MATCHLABEL:.spec.crossplane.compositionRevisionSelector.matchLabels"
435432
```
436433
Expected Output:
437434
```shell

0 commit comments

Comments
 (0)