Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Usage replayDeletion #728

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 even if there were deletion attempts blocked by the `Usage`.
Replaying the blocked deletion is possible by setting the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "replaying" the way to get kubernetes to try and delete the resource again after the usage is removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usage protects by blocking the deletion of the used resource as long as there are using resources.

Unfortunately, Kubernetes garbage collection backoffs up to 15 mins and there seems to be no way to reset this backoff.

"replaying" is sending a delete request to the used resource when the Usage is gone iff there was a blocked delete request.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest an edit to be more explicit about that here, something like

Use {{}}replayDeletion: true{{}} to immediately create send a deletion request to Kubernetes instead of waiting for the Kubernetes backoff.

Feel free to reword, I'd just make it more obvious that "doing this makes deletion happen faster"

{{<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
plumbis marked this conversation as resolved.
Show resolved Hide resolved
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
38 changes: 37 additions & 1 deletion content/v1.14/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 even if there were deletion attempts 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
38 changes: 37 additions & 1 deletion content/v1.15/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 even if there were deletion attempts 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
Loading