The following resources are composed to implement the referenced Composite Resource Definition (XRD).
ProviderConfig
Release
kind: Composition
apiVersion: apiextensions.crossplane.io/v1
metadata:
name: local-k8s-postgresql
creationTimestamp: null
labels:
db: postgresql
provider: local-k8s
spec:
compositeTypeRef:
apiVersion: devopstoolkitseries.com/v1alpha1
kind: SQL
patchSets:
- name: metadata
patches:
- fromFieldPath: metadata.annotations
toFieldPath: metadata.annotations
- fromFieldPath: spec.id
toFieldPath: metadata.name
resources:
- name: helm
base:
apiVersion: helm.crossplane.io/v1beta1
kind: ProviderConfig
spec:
credentials:
source: InjectedIdentity
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
readinessChecks:
- type: None
- name: server
base:
apiVersion: helm.crossplane.io/v1beta1
kind: Release
spec:
forProvider:
chart:
name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 12.1.2
set:
- name: auth.postgresPassword
value: postgres
- name: global.persistence.enabled
value: "false"
- name: primary.initdb.scripts.00_init_script\.sh
value: |
export PGPASSWORD=$POSTGRES_PASSWORD
psql -U postgres -c 'CREATE DATABASE "cncf-demo";'
rollbackLimit: 3
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
transforms:
- type: string
string:
fmt: "%s-postgresql"
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
- fromFieldPath: spec.claimRef.namespace
toFieldPath: spec.forProvider.namespace
connectionDetails:
- name: username
type: FromValue
value: postgres
- name: password
type: FromValue
value: postgres
- name: endpoint
type: FromFieldPath
fromFieldPath: metadata.name
- name: port
type: FromValue
value: "5432"
writeConnectionSecretsToNamespace: crossplane-system