Skip to content

Commit

Permalink
Add reason to the Usage API
Browse files Browse the repository at this point in the history
Signed-off-by: Hasan Turken <[email protected]>
  • Loading branch information
turkenh committed Jul 17, 2023
1 parent 825f084 commit 1271e77
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions design/one-pager-generic-usage-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,20 @@ kind: Usage
metadata:
name: release-uses-cluster
spec:
# Reason is optional when this Usage defines a "Dependency" type relationship,
# i.e. when the `spec.by` field is defined.
# It is required when the Usage is meant to be used for "Protection" purposes,
# i.e. when the `spec.by` is NOT defined.
reason: "Release uses Cluster"
# Reference to the resource that is being used.
of:
apiVersion: eks.upbound.io/v1beta1
kind: Cluster
resourceRef:
name: my-cluster
# Reference to the resource that is using the other resource.
# This field is optional and can be omitted when the Usage is meant to be used
# for "Protection" purposes.
by:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
Expand Down Expand Up @@ -144,6 +153,22 @@ spec:
baz: qux
```

Another use case for `Usage` is to protect a resource from being deleted without
necessarily being used by another resource. For example, a `Usage` that will
prevent the deletion of a database instance could be defined as follows:

```yaml
apiVersion: crossplane.io/v1
kind: Usage
spec:
reason: "Production Database - should never be deleted"
of:
apiVersion: rds.aws.upbound.io/v1beta1
kind: Instance
resourceRef:
name: my-cluster
```

### Implementation

The implementation of this feature will be done in two parts:
Expand Down

0 comments on commit 1271e77

Please sign in to comment.