Skip to content

Commit

Permalink
Add pre-delete-hook to resourceshareaccepter.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
turkenf committed Aug 11, 2023
1 parent d4dd791 commit 98d9e72
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
11 changes: 6 additions & 5 deletions examples/ram/resourceshareaccepter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ metadata:
annotations:
meta.upbound.io/example-id: ram/v1beta1/resourceshareaccepter
labels:
testing.upbound.io/example-name: receiver_accept
testing.upbound.io/example-name: example
name: receiver-accept
spec:
forProvider:
region: us-west-1
shareArnSelector:
matchLabels:
testing.upbound.io/example-name: sender_invite
testing.upbound.io/example-name: example

---
apiVersion: ram.aws.upbound.io/v1beta1
Expand All @@ -20,7 +20,7 @@ metadata:
annotations:
meta.upbound.io/example-id: ram/v1beta1/resourceshareaccepter
labels:
testing.upbound.io/example-name: sender_invite
testing.upbound.io/example-name: example
name: sender-invite
spec:
providerConfigRef:
Expand All @@ -30,16 +30,17 @@ spec:
region: us-west-1
resourceShareArnSelector:
matchLabels:
testing.upbound.io/example-name: sender_share
testing.upbound.io/example-name: example

---
apiVersion: ram.aws.upbound.io/v1beta1
kind: ResourceShare
metadata:
annotations:
meta.upbound.io/example-id: ram/v1beta1/resourceshareaccepter
uptest.upbound.io/pre-delete-hook: testhooks/delete-resourceshareaccepter.sh
labels:
testing.upbound.io/example-name: sender_share
testing.upbound.io/example-name: example
name: sender-share
spec:
providerConfigRef:
Expand Down
7 changes: 7 additions & 0 deletions examples/ram/testhooks/pre-delete-principal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -aeuo pipefail

# Note(turkenf): We are getting "ResourceShare arn.... could not be found" error
# when deleted before the ResourceShare resource ResourceShareAccepter resource.
# This is a workaround for this problem to make automated tests to work.
${KUBECTL} delete resourceshareaccepter.ram.aws.upbound.io -l testing.upbound.io/example-name=example
9 changes: 9 additions & 0 deletions examples/ram/testhooks/pre-delete-resourceshare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -aeuo pipefail

# Note(turkenf): We are getting "ResourceShare arn.... could not be found" error
# when deleted before the ResourceShare resource ResourceShareAccepter resource.
# This is a workaround for this problem to make automated tests to work.
${KUBECTL} delete resourceshareaccepter.ram.aws.upbound.io -l testing.upbound.io/example-name=example

${KUBECTL} delete principalassociation.ram.aws.upbound.io -l testing.upbound.io/example-name=example

0 comments on commit 98d9e72

Please sign in to comment.