diff --git a/examples/kms/cryptokey.yaml b/examples/kms/cryptokey.yaml new file mode 100644 index 000000000..5cb33e313 --- /dev/null +++ b/examples/kms/cryptokey.yaml @@ -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 diff --git a/examples/sql/testhooks/delete-user.sh b/examples/sql/testhooks/delete-user.sh new file mode 100755 index 000000000..12b71d0fa --- /dev/null +++ b/examples/sql/testhooks/delete-user.sh @@ -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 \ No newline at end of file diff --git a/examples/sql/user.yaml b/examples/sql/user.yaml index a72f2f3c0..a5d4e9699 100644 --- a/examples/sql/user.yaml +++ b/examples/sql/user.yaml @@ -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 @@ -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