Composition
SQL
The following resources are composed to implement the referenced Composite Resource Definition (XRD).
ResourceGroup
Server
FirewallRule
ProviderConfig
Database
kind: Composition
apiVersion: apiextensions.crossplane.io/v1
metadata:
name: azure-postgresql-official
creationTimestamp: null
labels:
db: postgresql
provider: azure-official
spec:
compositeTypeRef:
apiVersion: devopstoolkitseries.com/v1alpha1
kind: SQL
patchSets:
- name: metadata
patches:
- fromFieldPath: metadata.labels
resources:
- name: resourcegroup
base:
apiVersion: azure.upbound.io/v1beta1
kind: ResourceGroup
spec:
forProvider:
location: eastus
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
- fromFieldPath: spec.id
toFieldPath: spec.forProvider.name
- name: server
base:
apiVersion: dbforpostgresql.azure.upbound.io/v1beta1
kind: Server
spec:
forProvider:
administratorLogin: postgres
administratorLoginPasswordSecretRef:
key: password
autoGrowEnabled: true
location: eastus
publicNetworkAccessEnabled: true
resourceGroupNameSelector:
matchControllerRef: true
skuName: B_Gen5_2
sslEnforcementEnabled: false
sslMinimalTlsVersionEnforced: TLSEnforcementDisabled
storageMb: 5120
writeConnectionSecretToRef:
namespace: crossplane-system
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
- fromFieldPath: spec.id
toFieldPath: spec.writeConnectionSecretToRef.name
- fromFieldPath: spec.claimRef.namespace
toFieldPath: spec.writeConnectionSecretToRef.namespace
- fromFieldPath: spec.parameters.version
toFieldPath: spec.forProvider.version
- fromFieldPath: spec.parameters.size
toFieldPath: spec.forProvider.skuName
transforms:
- type: map
map:
large: GP_Gen5_8
medium: GP_Gen5_2
small: B_Gen5_1
- fromFieldPath: spec.parameters.version
toFieldPath: spec.forProvider.engineVersion
- fromFieldPath: spec.id
toFieldPath: spec.forProvider.administratorLoginPasswordSecretRef.name
transforms:
- type: string
string:
fmt: "%s-password"
- fromFieldPath: spec.claimRef.namespace
toFieldPath: spec.forProvider.administratorLoginPasswordSecretRef.namespace
connectionDetails:
- fromConnectionSecretKey: username
- fromConnectionSecretKey: password
- fromConnectionSecretKey: endpoint
- fromConnectionSecretKey: port
- name: firewall-rule
base:
apiVersion: dbforpostgresql.azure.upbound.io/v1beta1
kind: FirewallRule
spec:
forProvider:
endIpAddress: 255.255.255.255
resourceGroupNameSelector:
matchControllerRef: true
serverNameSelector:
matchControllerRef: true
startIpAddress: 0.0.0.0
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
- name: sql-config
base:
apiVersion: postgresql.sql.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
name: default
spec:
credentials:
connectionSecretRef:
namespace: crossplane-system
source: PostgreSQLConnectionSecret
sslMode: require
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
- fromFieldPath: spec.id
toFieldPath: spec.credentials.connectionSecretRef.name
- fromFieldPath: spec.claimRef.namespace
toFieldPath: spec.credentials.connectionSecretRef.namespace
readinessChecks:
- type: None
- name: sql-db
base:
apiVersion: postgresql.sql.crossplane.io/v1alpha1
kind: Database
spec:
forProvider: {}
patches:
- fromFieldPath: spec.id
toFieldPath: metadata.name
- fromFieldPath: spec.id
toFieldPath: spec.providerConfigRef.name
readinessChecks:
- type: None
writeConnectionSecretsToNamespace: crossplane-system