Skip to content

Commit 3462331

Browse files
committed
incorporate PR feedback for get started with managed resources page
Signed-off-by: Jared Watts <[email protected]>
1 parent f78a611 commit 3462331

File tree

1 file changed

+48
-67
lines changed

1 file changed

+48
-67
lines changed

content/v2.0-preview/get-started/get-started-with-managed-resources.md

Lines changed: 48 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ weight: 200
66
Connect Crossplane to AWS to create and manage cloud resources from Kubernetes
77
with [provider-upjet-aws](https://github.com/crossplane-contrib/provider-upjet-aws).
88

9+
A _managed resource_ is anything Crossplane creates and manages outside of the
10+
control plane.
11+
12+
This guide creates an AWS S3 bucket with Crossplane. The S3 bucket is a _managed resource_.
913

1014
## Prerequisites
1115
This quickstart requires:
@@ -15,50 +19,25 @@ This quickstart requires:
1519
* An AWS account with permissions to create an S3 storage bucket
1620
* AWS [access keys](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-creds)
1721

18-
## About Managed Resources in Crossplane v2
19-
A _managed resource_ is anything Crossplane creates and manages outside of the
20-
Kubernetes cluster.
21-
22-
This guide creates an AWS S3 bucket with Crossplane.
23-
24-
The S3 bucket is a _managed resource_.
25-
26-
Crossplane v2 allows you to compose namespaced resources. To better support this
27-
new ability, managed resources (MRs) are now namespaced in Providers that have
28-
been updated for Crossplane v2.
29-
30-
To support backwards compatibility while users are adopting Crossplane v2, each
31-
provider will offer the legacy cluster scoped MRs in addition to the new
32-
namespaced MRs.
33-
34-
For example, when the AWS provider that has been upated to support Crossplane v2
35-
is installed during this guide, you will see two CRDs for each type of managed
36-
resource:
37-
38-
1. A legacy cluster scoped MR in the `*.aws.upbound.io` API group
39-
1. A namespaced MR in the `*.aws.m.upbound.io` API group
40-
41-
{{< hint type="tip" >}}
42-
More about namespaced managed resources can be read in the [Crossplane v2 proposal](https://github.com/crossplane/crossplane/pull/6255).
43-
{{< /hint >}}
44-
4522
## Install the AWS provider
46-
4723
Install the AWS S3 provider into the Kubernetes cluster with a Kubernetes
4824
configuration file.
4925

5026
```yaml {label="provider",copy-lines="all"}
51-
cat <<EOF | kubectl apply -f -
5227
apiVersion: pkg.crossplane.io/v1
5328
kind: Provider
5429
metadata:
5530
name: provider-aws-s3
5631
spec:
5732
package: xpkg.crossplane.io/crossplane-contrib/provider-aws-s3:v1.22.0-crossplane-v2-preview.0
58-
EOF
5933
```
6034
61-
The Crossplane {{< hover label="provider" line="3" >}}Provider{{</hover>}}
35+
Save this to a file called `provider.yaml`, then apply it with:
36+
```shell {label="kube-apply-provider",copy-lines="all"}
37+
kubectl apply -f provider.yaml
38+
```
39+
40+
The Crossplane {{< hover label="provider" line="2" >}}Provider{{</hover>}}
6241
installs the Kubernetes _Custom Resource Definitions_ (CRDs) representing AWS S3
6342
services. These CRDs allow you to create AWS resources directly inside
6443
Kubernetes.
@@ -81,7 +60,7 @@ Providers.
8160
You can view the new CRDs with `kubectl get crds`.
8261
Every CRD maps to a unique AWS service Crossplane can provision and manage.
8362

84-
{{< hint type="tip" >}}
63+
{{< hint "tip" >}}
8564
See details about all the supported CRDs in the
8665
[provider examples](https://github.com/crossplane-contrib/provider-upjet-aws/tree/main/examples).
8766
{{< /hint >}}
@@ -96,7 +75,7 @@ then configure the Provider to use it.
9675
### Generate an AWS key-pair file
9776
For basic user authentication, use an AWS Access keys key-pair file.
9877

99-
{{< hint type="tip" >}}
78+
{{< hint "tip" >}}
10079
The [AWS documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-creds)
10180
provides information on how to generate AWS Access keys.
10281
{{< /hint >}}
@@ -113,7 +92,7 @@ aws_secret_access_key = $@<aws_secret_key>$@
11392

11493
Save this text file as `aws-credentials.txt`.
11594

116-
{{< hint type="note" >}}
95+
{{< hint "note" >}}
11796
The [Authentication](https://docs.upbound.io/providers/provider-aws/authentication/) section of the AWS Provider documentation describes other authentication methods.
11897
{{< /hint >}}
11998

@@ -135,14 +114,10 @@ generic aws-secret \
135114
```
136115

137116
## Create a ProviderConfig
138-
A {{< hover label="providerconfig" line="3">}}ProviderConfig{{</ hover >}}
139-
customizes the settings of the AWS Provider.
117+
A {{< hover label="providerconfig" line="2">}}ProviderConfig{{</ hover >}}
118+
customizes the settings of the AWS Provider:
140119

141-
Apply the
142-
{{< hover label="providerconfig" line="3">}}ProviderConfig{{</ hover >}}
143-
with the this Kubernetes configuration file:
144120
```yaml {label="providerconfig",copy-lines="all"}
145-
cat <<EOF | kubectl apply -f -
146121
apiVersion: aws.upbound.io/v1beta1
147122
kind: ProviderConfig
148123
metadata:
@@ -154,73 +129,79 @@ spec:
154129
namespace: crossplane-system
155130
name: aws-secret
156131
key: creds
157-
EOF
158132
```
159133

160-
This attaches the AWS credentials, saved as a Kubernetes secret, as a
161-
{{< hover label="providerconfig" line="9">}}secretRef{{</ hover>}}.
162-
163-
## Create a namespace
164-
Before we can create our namespaced S3 bucket managed resource, we must create a
165-
namespace for it.
134+
Save this to a file called `providerconfig.yaml`, then apply it with:
166135

167-
```shell {label="kube-create-namespace",copy-lines="all"}
168-
kubectl create namespace crossplane-aws-app
136+
```shell {label="kube-apply-providerconfig",copy-lines="all"}
137+
kubectl apply -f providerconfig.yaml
169138
```
170139

140+
This attaches the AWS credentials, saved as a Kubernetes secret, as a
141+
{{< hover label="providerconfig" line="8">}}secretRef{{</ hover>}}.
142+
171143
## Create a managed resource
172-
{{< hint type="note" >}}
144+
{{< hint "note" >}}
173145
AWS S3 bucket names must be globally unique. To generate a unique name the example uses a random hash.
174146
Any unique name is acceptable.
175147
{{< /hint >}}
176148

177-
```yaml {label="xr"}
178-
cat <<EOF | kubectl create -f -
149+
```yaml {label="bucket"}
179150
apiVersion: s3.aws.m.upbound.io/v1beta1
180151
kind: Bucket
181152
metadata:
182-
namespace: crossplane-aws-app
153+
namespace: default
183154
generateName: crossplane-bucket-
184155
spec:
185156
forProvider:
186157
region: us-east-2
187158
providerConfigRef:
188159
name: default
189-
EOF
190160
```
191161

192-
The {{< hover label="xr" line="6">}}metadata.generateName{{< /hover >}} gives a
193-
pattern that the provider will use to create a unique name for the bucket in S3.
162+
Save this to a file called `bucket.yaml`, then apply it with:
163+
164+
```shell {label="kube-create-bucket",copy-lines="all"}
165+
kubectl create -f bucket.yaml
166+
```
167+
168+
The {{< hover label="bucket" line="5">}}metadata.generateName{{< /hover >}} gives a
169+
pattern that Kubernetes will use to create a unique name for the bucket in S3.
194170
The generated name will look like `crossplane-bucket-<hash>`.
195171

196-
Use `kubectl -n crossplane-aws-app get buckets.s3.aws.m.upbound.io` to verify Crossplane created the bucket.
172+
Use `kubectl -n default get buckets.s3.aws.m.upbound.io` to verify Crossplane created the bucket.
197173

198-
{{< hint type="tip" >}}
174+
{{< hint "tip" >}}
199175
Crossplane created the bucket when the values `READY` and `SYNCED` are `True`.
200176
This may take up to 5 minutes.
201177
{{< /hint >}}
202178

203179
```shell {copy-lines="1"}
204-
kubectl -n crossplane-aws-app get buckets.s3.aws.m.upbound.io
180+
kubectl -n default get buckets.s3.aws.m.upbound.io
205181
NAME SYNCED READY EXTERNAL-NAME AGE
206182
crossplane-bucket-7tfcj True True crossplane-bucket-7tfcj 3m4s
207183
```
208184

209185
## Delete the managed resource
210-
Before shutting down your Kubernetes cluster, delete the S3 bucket that was just created.
211-
212-
Use `kubectl -n crossplane-aws-app delete buckets.s3.aws.m.upbound.io <bucketname>` to remove the bucket.
186+
When you are finished with your S3 bucket, use `kubectl -n default
187+
delete buckets.s3.aws.m.upbound.io <bucketname>` to remove the bucket.
213188

214189
```shell {copy-lines="1"}
215-
kubectl -n crossplane-aws-app delete buckets.s3.aws.m.upbound.io crossplane-bucket-7tfcj
190+
kubectl -n default delete buckets.s3.aws.m.upbound.io crossplane-bucket-7tfcj
216191
bucket.s3.aws.m.upbound.io "crossplane-bucket-7tfcj" deleted
217192
```
218193

194+
{{< hint "important" >}}
195+
Make sure to delete the S3 bucket before uninstalling the provider or shutting
196+
down your control plane. If those are no longer running, they can't clean up any
197+
managed resources and you would need to do so manually.
198+
{{< /hint >}}
199+
219200
## Composing managed resources
220-
Crossplane v2 allows you to compose **any type of resource** into custom APIs
221-
for your users, which includes managed resources. Enjoy the freedom that
222-
Crossplane v2 gives you to compose the diverse set of resources your
223-
applications need for their unique environments, scenarios, and requirements.
201+
Crossplane allows you to compose **any type of resource** into custom APIs for
202+
your users, which includes managed resources. Enjoy the freedom that Crossplane
203+
gives you to compose the diverse set of resources your applications need for
204+
their unique environments, scenarios, and requirements.
224205

225206
Follow [Get Started with Composition]({{<ref "../get-started/get-started-with-composition">}})
226207
to learn more about how composition works.

0 commit comments

Comments
 (0)