Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Borrelli <[email protected]>
  • Loading branch information
stevendborrelli committed Nov 14, 2023
1 parent d36f0f1 commit de4e713
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
48 changes: 37 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ of individual resources.

## Installing this Function

The function can be installed as a Crossplane package, and runs in a [Composition Function](https://docs.crossplane.io/latest/concepts/composition-functions/). This feature requires a minium Crossplane version of 1.14.

```yaml
apiVersion: pkg.crossplane.io/v1beta1
kind: Function
Expand All @@ -21,7 +23,9 @@ spec:
## What this function does
This function enables condition rendering of the entire function or select resources.
This function enables conditional rendering of the entire function or select resources.
The language used for Conditionals is the [Common Expression Language (CEL)](https://github.com/google/cel-spec), which is widely used in the Kubernetes ecosystem.
### Conditionally Running the Function
Expand Down Expand Up @@ -168,24 +172,46 @@ Produces the following output, showing what resources Crossplane would compose:

```yaml
---
apiVersion: example.crossplane.io/v1
kind: XR
apiVersion: nop.example.org/v1alpha1
kind: XNopResource
metadata:
name: example-xr
name: test-resource
---
apiVersion: s3.aws.upbound.io/v1beta1
kind: Bucket
apiVersion: nop.crossplane.io/v1alpha1
kind: NopResource
metadata:
annotations:
crossplane.io/composition-resource-name: bucket
generateName: example-xr-
crossplane.io/composition-resource-name: test-resource
generateName: test-resource-
labels:
crossplane.io/composite: example-xr
crossplane.io/composite: test-resource
ownerReferences:
# Omitted for brevity
- apiVersion: nop.example.org/v1alpha1
blockOwnerDeletion: true
controller: true
kind: XNopResource
name: test-resource
uid: ""
spec:
forProvider:
region: us-east-2
conditionAfter:
- conditionStatus: "True"
conditionType: Ready
time: 5s
connectionDetails:
- name: username
value: fakeuser
- name: password
value: verysecurepassword
- name: endpoint
value: 127.0.0.1
fields:
arrayField:
- stringField: array
integerField: 42
objectField:
stringField: object
stringField: string
```

See the [composition functions documentation][docs-functions] to learn how to
Expand Down
2 changes: 0 additions & 2 deletions examples/conditional-rendering/functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ apiVersion: pkg.crossplane.io/v1beta1
kind: Function
metadata:
name: function-conditional-patch-and-transform
annotations:
render.crossplane.io/runtime: Development
spec:
package: xpkg.upbound.io/borrelli-org/function-conditional-patch-and-transform:v0.3.0
packagePullPolicy: Always
Binary file not shown.

0 comments on commit de4e713

Please sign in to comment.