Skip to content

Commit

Permalink
Update to a Claims based flow
Browse files Browse the repository at this point in the history
Signed-off-by: Jared Watts <[email protected]>
  • Loading branch information
jbw976 committed Jul 1, 2024
1 parent 80f968f commit 44bd0de
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ kubectl apply -f composition.yaml

Now we are ready to create a compute instance:
```
kubectl apply -f xr.yaml
kubectl apply -f claim.yaml
```

Since we have provided an old non-current generation instance type, we expect the function to return an error and refuse to create the instance:
Expand All @@ -63,11 +63,11 @@ kubectl describe compute.example.crossplane.io/dev-instance

Let's update the instance type to a value that is current generation (`t3.micro`) and try again:
```
# edit xr.yaml to change instanceType to t3.micro, then:
kubectl apply -f xr.yaml
# edit claim.yaml to change instanceType to t3.micro, then:
kubectl apply -f claim.yaml
```

Now we should be using a current generation instance type, let's examine the XR again:
Now we should be using a current generation instance type, let's examine the claim again:
```
crossplane beta trace compute.example.crossplane.io/dev-instance -o wide
```
Expand All @@ -86,9 +86,9 @@ Now we have seen how to use credentials/secrets in your composition functions!

## Clean-up

Make sure to clean-up the EC2 instance by deleting the XR:
Make sure to clean-up the EC2 instance by deleting the claim:
```
kubectl delete -f xr.yaml
kubectl delete -f claim.yaml
kubectl get instance.ec2
```

Expand Down
6 changes: 6 additions & 0 deletions example/claim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: example.crossplane.io/v1alpha1
kind: Compute
metadata:
name: dev-instance
spec:
instanceType: t1.micro
2 changes: 1 addition & 1 deletion example/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
compositeTypeRef:
apiVersion: example.crossplane.io/v1alpha1
kind: Compute
kind: XCompute
mode: Pipeline
pipeline:
- step: create-resources
Expand Down
5 changes: 4 additions & 1 deletion example/definition.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
name: computes.example.crossplane.io
name: xcomputes.example.crossplane.io
spec:
group: example.crossplane.io
names:
kind: XCompute
plural: xcomputes
claimNames:
kind: Compute
plural: computes
versions:
Expand Down
2 changes: 1 addition & 1 deletion example/xr.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: example.crossplane.io/v1alpha1
kind: Compute
kind: XCompute
metadata:
name: dev-instance
spec:
Expand Down

0 comments on commit 44bd0de

Please sign in to comment.