Skip to content

Commit

Permalink
Improve example manifest for some resources
Browse files Browse the repository at this point in the history
  • Loading branch information
turkenf committed Jan 23, 2023
1 parent 5918603 commit 597337c
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
31 changes: 31 additions & 0 deletions examples/kms/cryptokey.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: kms.gcp.upbound.io/v1beta1
kind: CryptoKey
metadata:
annotations:
meta.upbound.io/example-id: kms/v1beta1/cryptokey
upjet.upbound.io/manual-intervention: "By default, keys in Cloud KMS spend 24 hours in the Scheduled for destruction (soft deleted) state before the key material is logically deleted from the system"
labels:
testing.upbound.io/example-name: crypto-key
name: crypto-key-${Rand.RFC1123Subdomain}
spec:
forProvider:
keyRingSelector:
matchLabels:
testing.upbound.io/example-name: keyring
rotationPeriod: 100000s
# The minimum duration is 24 hours for all keys, except for import-only keys which have a minimum duration of 0
destroyScheduledDuration: 86400s
---

apiVersion: kms.gcp.upbound.io/v1beta1
kind: KeyRing
metadata:
annotations:
meta.upbound.io/example-id: kms/v1beta1/cryptokey
upjet.upbound.io/manual-intervention: "This resource is dependency of CryptoKey. This resource is skipping because parent resource was skipped."
labels:
testing.upbound.io/example-name: keyring
name: keyring-crypto-key-${Rand.RFC1123Subdomain}
spec:
forProvider:
location: global
7 changes: 7 additions & 0 deletions examples/sql/testhooks/delete-user.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 (Invalid request since instance is not running) exception if user for
# the instance got deleted before the user resource. This is a workaround for this
# problem to make automated tests to work.
${KUBECTL} delete user.sql.gcp.upbound.io -l testing.upbound.io/example-name=example_user
26 changes: 24 additions & 2 deletions examples/sql/user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: sql.gcp.upbound.io/v1beta1
kind: User
metadata:
annotations:
upjet.upbound.io/manual-intervention: "Depends on SQL instance to be successfully deleted"
meta.upbound.io/example-id: sql/v1beta1/user
labels:
testing.upbound.io/example-name: example_user
Expand All @@ -25,9 +24,32 @@ data:
kind: Secret
metadata:
annotations:
upjet.upbound.io/manual-intervention: "Depends on SQL instance to be successfully deleted"
meta.upbound.io/example-id: sql/v1beta1/user
labels:
testing.upbound.io/example-name: example_user
name: example-sql-user
namespace: upbound-system

---

apiVersion: sql.gcp.upbound.io/v1beta1
kind: DatabaseInstance
metadata:
annotations:
uptest.upbound.io/pre-delete-hook: testhooks/delete-user.sh
meta.upbound.io/example-id: sql/v1beta1/user
labels:
testing.upbound.io/example-name: example_instance
# ${Rand...} is not valid YAML and is used with automated testing
name: example-instance-${Rand.RFC1123Subdomain}
spec:
forProvider:
region: "us-central1"
databaseVersion: "MYSQL_5_7"
settings:
- tier: "db-f1-micro"
diskSize: 20
deletionProtection: false # allow crossplane to delete the instance automatically
writeConnectionSecretToRef:
name: example-sql-db-instance-secret
namespace: upbound-system

0 comments on commit 597337c

Please sign in to comment.