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 4279d34
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
38 changes: 37 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,41 @@ spec:
baz: qux
```

### Replay blocked deletion attempt

By default, the deletion of a `Usage` resource doesn't trigger the deletion of
the resource in use if there were a deletion attempt blocked by the `Usage`.
Replaying the blocked deletion is possible 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 useful when the used resource is part of 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 right after the using resource disappears instead of waiting
for the long exponential backoff durations 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 +256,7 @@ spec:
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: Usage
spec:
replayDeletion: true
of:
apiVersion: container.gcp.upbound.io/v1beta1
kind: Cluster
Expand Down
3 changes: 2 additions & 1 deletion utils/vale/styles/Crossplane/allowed-jargon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@ syscall
TLS
tolerations
VM
YAML
YAML
backoff

0 comments on commit 4279d34

Please sign in to comment.