Skip to content

Commit 2931cd1

Browse files
committed
v2ify the P&T guide
Eventually this needs to move out of the docs Signed-off-by: Nic Cope <[email protected]>
1 parent c8f80e5 commit 2931cd1

File tree

1 file changed

+35
-46
lines changed

1 file changed

+35
-46
lines changed

content/v2.0-preview/guides/function-patch-and-transform.md

Lines changed: 35 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ spec:
5151
resources:
5252
- name: storage-bucket
5353
base:
54-
apiVersion: s3.aws.upbound.io/v1beta1
54+
apiVersion: s3.aws.m.upbound.io/v1beta1
5555
kind: Bucket
5656
spec:
5757
forProvider:
@@ -132,14 +132,14 @@ kind: Resources
132132
resources:
133133
- name: storage-bucket
134134
base:
135-
apiVersion: s3.aws.upbound.io/v1beta1
135+
apiVersion: s3.aws.m.upbound.io/v1beta1
136136
kind: Bucket
137137
spec:
138138
forProvider:
139139
region: "us-east-2"
140140
- name: vm
141141
base:
142-
apiVersion: ec2.aws.upbound.io/v1beta1
142+
apiVersion: ec2.aws.m.upbound.io/v1beta1
143143
kind: Instance
144144
spec:
145145
forProvider:
@@ -161,12 +161,8 @@ the resource's name in the external system (like AWS).
161161
{{< /hint >}}
162162

163163
{{<hint "tip" >}}
164-
You can use Function Patch and Transform to template other kinds of Crossplane
165-
resources, like ProviderConfigs.
166-
167-
You can also template other kinds of composite resource (XR).
168-
169-
You can't template namespaced resources.
164+
You can use Function Patch and Transform to template any kind of Kubernetes
165+
resource.
170166
{{< /hint >}}
171167

172168
## Create a patch
@@ -192,7 +188,7 @@ kind: Resources
192188
resources:
193189
- name: storage-bucket
194190
base:
195-
apiVersion: s3.aws.upbound.io/v1beta1
191+
apiVersion: s3.aws.m.upbound.io/v1beta1
196192
kind: Bucket
197193
spec:
198194
forProvider:
@@ -228,24 +224,25 @@ Here are some example selectors from a composite resource object.
228224
```yaml {label="select",copy-lines="none"}
229225
$ kubectl get composite -o yaml
230226
apiVersion: example.org/v1alpha1
231-
kind: XExample
227+
kind: Example
232228
metadata:
233229
# Removed for brevity
234230
labels:
235231
crossplane.io/composite: my-example-978mh
236232
spec:
237233
desiredRegion: eu-north-1
238234
field1: field1-text
239-
resourceRefs:
240-
- apiVersion: s3.aws.upbound.io/v1beta1
241-
kind: Bucket
242-
name: my-example-978mh-r6z64
243-
- apiVersion: s3.aws.upbound.io/v1beta1
244-
kind: Bucket
245-
name: my-example-978mh-cnlhj
246-
- apiVersion: s3.aws.upbound.io/v1beta1
247-
kind: Bucket
248-
name: my-example-978mh-rv5nm
235+
crossplane:
236+
resourceRefs:
237+
- apiVersion: s3.aws.m.upbound.io/v1beta1
238+
kind: Bucket
239+
name: my-example-978mh-r6z64
240+
- apiVersion: s3.aws.m.upbound.io/v1beta1
241+
kind: Bucket
242+
name: my-example-978mh-cnlhj
243+
- apiVersion: s3.aws.m.upbound.io/v1beta1
244+
kind: Bucket
245+
name: my-example-978mh-rv5nm
249246
```
250247

251248
## Reuse a patch
@@ -336,7 +333,7 @@ kind: Resources
336333
resources:
337334
- name: bucket1
338335
base:
339-
apiVersion: s3.aws.upbound.io/v1beta1
336+
apiVersion: s3.aws.m.upbound.io/v1beta1
340337
kind: Bucket
341338
# Removed for brevity
342339
patches:
@@ -345,7 +342,7 @@ resources:
345342
toFieldPath: status.secondResource
346343
- name: bucket2
347344
base:
348-
apiVersion: s3.aws.upbound.io/v1beta1
345+
apiVersion: s3.aws.m.upbound.io/v1beta1
349346
kind: Bucket
350347
# Removed for brevity
351348
patches:
@@ -462,7 +459,7 @@ kind: Resources
462459
resources:
463460
- name: vpc
464461
base:
465-
apiVersion: ec2.aws.upbound.io/v1beta1
462+
apiVersion: ec2.aws.m.upbound.io/v1beta1
466463
kind: VPC
467464
spec:
468465
forProvider:
@@ -515,7 +512,7 @@ metadata:
515512
spec:
516513
compositeTypeRef:
517514
apiVersion: example.org/v1alpha1
518-
kind: xExample
515+
kind: Example
519516
environment:
520517
environmentConfigs:
521518
- ref:
@@ -531,14 +528,14 @@ spec:
531528
resources:
532529
- name: bucket1
533530
base:
534-
apiVersion: s3.aws.upbound.io/v1beta1
531+
apiVersion: s3.aws.m.upbound.io/v1beta1
535532
kind: Bucket
536533
spec:
537534
forProvider:
538535
region: us-east-2
539536
- name: bucket2
540537
base:
541-
apiVersion: s3.aws.upbound.io/v1beta1
538+
apiVersion: s3.aws.m.upbound.io/v1beta1
542539
kind: Bucket
543540
spec:
544541
forProvider:
@@ -551,7 +548,7 @@ spec:
551548
apiVersion: apiextensions.crossplane.io/v1
552549
kind: CompositeResourceDefinition
553550
metadata:
554-
name: xexamples.example.org
551+
name: examples.example.org
555552
spec:
556553
group: example.org
557554
names:
@@ -647,7 +644,7 @@ kind: Resources
647644
resources:
648645
- name: bucket1
649646
base:
650-
apiVersion: s3.aws.upbound.io/v1beta1
647+
apiVersion: s3.aws.m.upbound.io/v1beta1
651648
kind: Bucket
652649
spec:
653650
forProvider:
@@ -690,7 +687,7 @@ kind: Resources
690687
resources:
691688
- name: bucket1
692689
base:
693-
apiVersion: s3.aws.upbound.io/v1beta1
690+
apiVersion: s3.aws.m.upbound.io/v1beta1
694691
kind: Bucket
695692
spec:
696693
forProvider:
@@ -756,7 +753,7 @@ kind: Resources
756753
resources:
757754
- name: bucket1
758755
base:
759-
apiVersion: s3.aws.upbound.io/v1beta1
756+
apiVersion: s3.aws.m.upbound.io/v1beta1
760757
kind: Bucket
761758
spec:
762759
forProvider:
@@ -819,7 +816,7 @@ kind: Resources
819816
resources:
820817
- name: bucket1
821818
base:
822-
apiVersion: s3.aws.upbound.io/v1beta1
819+
apiVersion: s3.aws.m.upbound.io/v1beta1
823820
kind: Bucket
824821
spec:
825822
forProvider:
@@ -842,7 +839,7 @@ View the composite resource to verify the applied patch.
842839
$ kubectl describe composite
843840
Name: my-example-bjdjw
844841
API Version: example.org/v1alpha1
845-
Kind: xExample
842+
Kind: Example
846843
# Removed for brevity
847844
Status:
848845
# Removed for brevity
@@ -853,13 +850,6 @@ Status:
853850
### FromEnvironmentFieldPath
854851
<!-- vale Google.Headings = YES -->
855852

856-
{{<hint "important" >}}
857-
EnvironmentConfigs are an alpha feature. They aren't enabled by default.
858-
859-
For more information about using an EnvironmentConfig, read the
860-
[EnvironmentConfigs documentation]({{<ref "../composition/environment-configs">}}).
861-
{{< /hint >}}
862-
863853
The `FromEnvironmentFieldPath` patch takes values from the in-memory environment
864854
and applies them to the composed resource.
865855

@@ -877,7 +867,7 @@ kind: Resources
877867
resources:
878868
- name: bucket1
879869
base:
880-
apiVersion: s3.aws.upbound.io/v1beta1
870+
apiVersion: s3.aws.m.upbound.io/v1beta1
881871
kind: Bucket
882872
spec:
883873
forProvider:
@@ -927,7 +917,7 @@ kind: Resources
927917
resources:
928918
- name: bucket1
929919
base:
930-
apiVersion: s3.aws.upbound.io/v1beta1
920+
apiVersion: s3.aws.m.upbound.io/v1beta1
931921
kind: Bucket
932922
spec:
933923
forProvider:
@@ -982,7 +972,7 @@ kind: Resources
982972
resources:
983973
- name: bucket1
984974
base:
985-
apiVersion: s3.aws.upbound.io/v1beta1
975+
apiVersion: s3.aws.m.upbound.io/v1beta1
986976
kind: Bucket
987977
spec:
988978
forProvider:
@@ -1051,7 +1041,7 @@ kind: Resources
10511041
resources:
10521042
- name: bucket1
10531043
base:
1054-
apiVersion: s3.aws.upbound.io/v1beta1
1044+
apiVersion: s3.aws.m.upbound.io/v1beta1
10551045
kind: Bucket
10561046
spec:
10571047
forProvider:
@@ -1105,7 +1095,7 @@ kind: Resources
11051095
resources:
11061096
- name: bucket1
11071097
base:
1108-
apiVersion: s3.aws.upbound.io/v1beta1
1098+
apiVersion: s3.aws.m.upbound.io/v1beta1
11091099
kind: Bucket
11101100
spec:
11111101
forProvider:
@@ -1755,7 +1745,6 @@ only appears in the combined composite resource secret.
17551745
```yaml {label="conDeet",copy-lines="none"}
17561746
kind: Composition
17571747
spec:
1758-
writeConnectionSecretsToNamespace: other-namespace
17591748
mode: Pipeline
17601749
pipeline:
17611750
- step: patch-and-transform

0 commit comments

Comments
 (0)