You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Building compositions which creates master and replica databases instances can be challenging because masterInstanceName is only supported by passing the master name directly.
This could be solved by just patching the name to the field. But we have 2 problems with this approach:
masterInstanceName needs to be in the format <project-id>:<instance-name>. For example: mycoolproject123:example-db
Without the reference, there isn't a depends_on that will wait the master creation then create the replica, it will try to create both at the same time, which will lead to errors.
How could Crossplane help solve your problem?
Adding reference to other CloudSQLInstance in the field masterInstanceName
Workaround for this problem
I defined a field in XR status named masterName, and this field is populated by CombineToComposite in the master database patches. You can see this example below:
Note that you need to use policy: Required because if you don't, the replica instance will skip this patch while status.masterName isn't fullfilled, which will lead to two separate database instances (as if you've created two masters). By defining this policy, the replica creation will raise errors until the status.masterName is populated.
The text was updated successfully, but these errors were encountered:
What problem are you facing?
Building compositions which creates master and replica databases instances can be challenging because
masterInstanceName
is only supported by passing the master name directly.This could be solved by just patching the name to the field. But we have 2 problems with this approach:
masterInstanceName
needs to be in the format<project-id>:<instance-name>
. For example:mycoolproject123:example-db
depends_on
that will wait the master creation then create the replica, it will try to create both at the same time, which will lead to errors.How could Crossplane help solve your problem?
Adding reference to other CloudSQLInstance in the field
masterInstanceName
Workaround for this problem
I defined a field in XR status named
masterName
, and this field is populated byCombineToComposite
in the master database patches. You can see this example below:And then you can use
FromCompositeFieldPath
to populate themasterInstanceName
field:The text was updated successfully, but these errors were encountered: