11apiVersion : apiextensions.crossplane.io/v1
22kind : Composition
33metadata :
4- name : xpostgresqlinstances .gcp.platform.upbound.io
4+ name : xsqlinstances .gcp.platform.upbound.io
55 labels :
66 provider : gcp
77spec :
@@ -94,31 +94,76 @@ spec:
9494 string :
9595 fmt : " %suser-%.8s" # mysql has a limit of 32 chars for users thus we need to limit the length
9696 toFieldPath : metadata.annotations[crossplane.io/external-name]
97+ - type : CombineFromComposite
98+ combine :
99+ variables :
100+ - fromFieldPath : metadata.uid
101+ - fromFieldPath : spec.parameters.engine
102+ strategy : string
103+ string :
104+ fmt : " %s-gcp-%s-user"
105+ toFieldPath : spec.writeConnectionSecretToRef.name
106+ - fromFieldPath : spec.writeConnectionSecretToRef.namespace
107+ toFieldPath : spec.writeConnectionSecretToRef.namespace
108+ connectionDetails :
109+ - name : username
110+ type : FromFieldPath
111+ fromFieldPath : metadata.annotations[crossplane.io/external-name]
112+ - name : password
113+ type : FromConnectionSecretKey
114+ fromConnectionSecretKey : attribute.password
115+ - name : UpboundDatabase
116+ base :
117+ apiVersion : sql.gcp.upbound.io/v1beta1
118+ kind : Database
119+ spec :
120+ forProvider :
121+ instanceSelector :
122+ matchControllerRef : true
123+ patches :
124+ - type : PatchSet
125+ patchSetName : providerConfigRef
126+ - type : PatchSet
127+ patchSetName : deletionPolicy
128+ - type : FromCompositeFieldPath
129+ fromFieldPath : metadata.name
130+ toFieldPath : metadata.annotations[crossplane.io/external-name]
131+ transforms :
132+ - type : match
133+ match :
134+ fallbackValue : null
135+ patterns :
136+ - regexp : .*
137+ result : upbound
138+ type : regexp
97139 - name : DBInstance
98140 base :
99141 apiVersion : sql.gcp.upbound.io/v1beta1
100142 kind : DatabaseInstance
101143 spec :
102144 forProvider :
103- databaseVersion : POSTGRES_13
104145 deletionProtection : false
105146 settings :
106147 - diskSize : 20
107148 tier : db-f1-micro
149+ ipConfiguration :
150+ - ipv4Enabled : false
108151 patches :
109152 - type : PatchSet
110153 patchSetName : providerConfigRef
111154 - type : PatchSet
112155 patchSetName : deletionPolicy
113156 - type : PatchSet
114157 patchSetName : region
115- - fromFieldPath : metadata.uid
158+ - type : CombineFromComposite
159+ combine :
160+ variables :
161+ - fromFieldPath : metadata.uid
162+ - fromFieldPath : spec.parameters.engine
163+ strategy : string
164+ string :
165+ fmt : " %s-gcp-%s"
116166 toFieldPath : spec.writeConnectionSecretToRef.name
117- transforms :
118- - type : string
119- string :
120- type : Format
121- fmt : " %s-gcp-postgresql"
122167 - fromFieldPath : spec.writeConnectionSecretToRef.namespace
123168 toFieldPath : spec.writeConnectionSecretToRef.namespace
124169 - fromFieldPath : spec.parameters.storageGB
@@ -140,7 +185,7 @@ spec:
140185 type : Convert
141186 convert : " ToUpper"
142187 connectionDetails :
143- - name : privateIP
188+ - name : host
144189 type : FromConnectionSecretKey
145190 fromConnectionSecretKey : privateIP
146191 - name : serverCACertificateCert
0 commit comments