Skip to content

Instantly share code, notes, and snippets.

@jbw976
Created September 27, 2023 14:44
Show Gist options
  • Save jbw976/ab0bd60dc84accbc9c69c3d279e4a543 to your computer and use it in GitHub Desktop.
Save jbw976/ab0bd60dc84accbc9c69c3d279e4a543 to your computer and use it in GitHub Desktop.
xrender testing
apiVersion: acme.com/v1
kind: AcmeDatabase
metadata:
name: acme-db-prod
spec:
storageGB: 15
writeConnectionSecretToRef:
name: acme-db-prod-conn
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: example
spec:
mode: Pipeline
pipeline:
- step: patch-and-transform
functionRef:
# This needs to match the name of the Function in functions.yaml
name: function-patch-and-transform
input:
apiVersion: pt.fn.crossplane.io/v1beta1
kind: Resources
resources:
- name: DBInstance
base:
apiVersion: sql.gcp.upbound.io/v1beta1
kind: DatabaseInstance
spec:
forProvider:
databaseVersion: POSTGRES_13
deletionProtection: false
region: us-west2
settings:
- diskSize: 20
tier: db-f1-micro
writeConnectionSecretToRef:
namespace: crossplane-system
patches:
- fromFieldPath: "metadata.uid"
toFieldPath: "spec.writeConnectionSecretToRef.name"
transforms:
- type: string
string:
fmt: "%s-postgresql"
- fromFieldPath: spec.storageGB
toFieldPath: spec.forProvider.settings[0].diskSize
connectionDetails:
- fromConnectionSecretKey: connectionName
- fromConnectionSecretKey: publicIP
- fromConnectionSecretKey: serverCACertificateCert
- type: FromValue
name: port
value: "5432"
apiVersion: pkg.crossplane.io/v1beta1
kind: Function
metadata:
name: function-patch-and-transform
spec:
package: xpkg.upbound.io/crossplane-contrib/function-patch-and-transform:v0.1.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment