Skip to content

Commit

Permalink
Document Usage replayDeletion
Browse files Browse the repository at this point in the history
Signed-off-by: Hasan Turken <[email protected]>
  • Loading branch information
turkenh committed Mar 9, 2024
1 parent 937b498 commit 5e0bf0e
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion content/master/concepts/usages.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ with Helm.
## Create a usage
<!-- vale Google.Headings = YES -->
<!-- vale write-good.Passive = NO -->
A {{<hover label="protect" line="2">}}Usage{{</hover>}}
{{<hover label="protect" line="5">}}spec{{</hover>}} has a mandatory
{{<hover label="protect" line="6">}}of{{</hover>}} field for defining the resource
in use or protected. The
{{<hover label="protect" line="11">}}reason{{</hover>}} field defines the reason
for protection and the {{<hover label="order" line="11">}}by{{</hover>}} field
<!-- vale write-good.Passive = NO -->
defines the using resource. Both fields are optional, but at least one of them
must be provided.
<!-- vale write-good.Passive = YES -->
Expand Down Expand Up @@ -189,6 +189,42 @@ spec:
baz: qux
```

### Replay deletion after the Usage is deleted

By default, the deletion of a `Usage` resource doesn't trigger the deletion of
the resource in use which was attempted to be deleted. However, it is possible
to configure the `Usage` resource to replay the deletion of the resource in use
right after the `Usage` resource is deleted. This is achieved by setting the
{{<hover label="replay" line="6">}}replayDeletion{{</hover>}} field to `true`.

```yaml {label="replay"}
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
metadata:
name: release-uses-cluster
spec:
replayDeletion: true
of:
apiVersion: eks.upbound.io/v1beta1
kind: Cluster
resourceRef:
name: my-cluster
by:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
resourceRef:
name: my-prometheus-chart
```

{{<hint "tip" >}}

Replay deletion is particularly useful when the used resource is owned
by a composition. This configuration radically decreases time for the
deletion of the used resource, hence the composite owning it, by replaying
the deletion of the used resource immediately instead of waiting for the
long exponential backoff period of the Kubernetes garbage collector.
{{< /hint >}}

## Usage in a Composition

A typical use case for Usages is to define a deletion ordering between the
Expand Down Expand Up @@ -221,6 +257,7 @@ spec:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
replayDeletion: true
of:
apiVersion: container.gcp.upbound.io/v1beta1
kind: Cluster
Expand Down

0 comments on commit 5e0bf0e

Please sign in to comment.