While there are values in the values files for promotion of a replica to primary:
# -- Defines the name of this cluster. It is used to determine if this is a primary or a replica cluster, comparing it with primary. Leave empty by default.
self: ""
# -- Primary defines which Cluster is defined to be the primary in the distributed PostgreSQL cluster, based on the topology specified in externalClusters
primary: ""
# -- A demotion token generated by an external cluster used to check if the promotion requirements are met.
promotionToken: ""
When trying to set self = primary and add a promotionToken it errors because of a validating webhook and not being able to define self as an externalCluster:
Failed last sync attempt to [0.4.0 a2506789ed0aa93f9a01db538333b8ab38934f7f]: one or more objects failed to apply, reason: error when patching "/dev/shm/1893910228": admission webhook "vcluster.cnpg.io" denied the request: Cluster.cluster.cnpg.io "postgres-harbor-cluster" is invalid: [spec.replicaCluster.enabled: Invalid value: {"self":"postgres-harbor-cluster","primary":"postgres-harbor-cluster","source":"originCluster","enabled":true,"promotionToken":"eyJsYXRlc3RDaGVja3BvaW50VGltZWxpbmVJRCI6IjQiLCJyZWRvV2FsRmlsZSI6IjAwMDAwMDA0MDAwMDAxRkEwMDAwMDA0OSIsImRhdGFiYXNlU3lzdGVtSWRlbnRpZmllciI6Ijc2MTMwNTMzMDQwNDM0MjE3MTYiLCJsYXRlc3RDaGVja3BvaW50UkVET0xvY2F0aW9uIjoiMUZBLzQ5MDAwMDI4IiwidGltZU9mTGF0ZXN0Q2hlY2twb2ludCI6IkZyaSBNYXkgMjkgMTE6MTA6MTAgMjAyNiIsIm9wZXJhdG9yVmVyc2lvbiI6IjEuMjcuMyJ9"}: replica mode enabled is not compatible with the primary field, spec.replicaCluster.self: Invalid value: "postgres-harbor-cluster": External cluster postgres-harbor-cluster not found, spec.replicaCluster.primary: Invalid value: "postgres-harbor-cluster": External cluster postgres-harbor-cluster not found, spec.replicaCluster.token: Invalid value: "eyJsYXRlc3RDaGVja3BvaW50VGltZWxpbmVJRCI6IjQiLCJyZWRvV2FsRmlsZSI6IjAwMDAwMDA0MDAwMDAxRkEwMDAwMDA0OSIsImRhdGFiYXNlU3lzdGVtSWRlbnRpZmllciI6Ijc2MTMwNTMzMDQwNDM0MjE3MTYiLCJsYXRlc3RDaGVja3BvaW50UkVET0xvY2F0aW9uIjoiMUZBLzQ5MDAwMDI4IiwidGltZU9mTGF0ZXN0Q2hlY2twb2ludCI6IkZyaSBNYXkgMjkgMTE6MTA6MTAgMjAyNiIsIm9wZXJhdG9yVmVyc2lvbiI6IjEuMjcuMyJ9": promotionToken is only allowed for primary clusters] (retried 2 times).
While there are values in the values files for promotion of a replica to primary:
When trying to set self = primary and add a promotionToken it errors because of a validating webhook and not being able to define self as an externalCluster:
Failed last sync attempt to [0.4.0 a2506789ed0aa93f9a01db538333b8ab38934f7f]: one or more objects failed to apply, reason: error when patching "/dev/shm/1893910228": admission webhook "vcluster.cnpg.io" denied the request: Cluster.cluster.cnpg.io "postgres-harbor-cluster" is invalid: [spec.replicaCluster.enabled: Invalid value: {"self":"postgres-harbor-cluster","primary":"postgres-harbor-cluster","source":"originCluster","enabled":true,"promotionToken":"eyJsYXRlc3RDaGVja3BvaW50VGltZWxpbmVJRCI6IjQiLCJyZWRvV2FsRmlsZSI6IjAwMDAwMDA0MDAwMDAxRkEwMDAwMDA0OSIsImRhdGFiYXNlU3lzdGVtSWRlbnRpZmllciI6Ijc2MTMwNTMzMDQwNDM0MjE3MTYiLCJsYXRlc3RDaGVja3BvaW50UkVET0xvY2F0aW9uIjoiMUZBLzQ5MDAwMDI4IiwidGltZU9mTGF0ZXN0Q2hlY2twb2ludCI6IkZyaSBNYXkgMjkgMTE6MTA6MTAgMjAyNiIsIm9wZXJhdG9yVmVyc2lvbiI6IjEuMjcuMyJ9"}: replica mode enabled is not compatible with the primary field, spec.replicaCluster.self: Invalid value: "postgres-harbor-cluster": External cluster postgres-harbor-cluster not found, spec.replicaCluster.primary: Invalid value: "postgres-harbor-cluster": External cluster postgres-harbor-cluster not found, spec.replicaCluster.token: Invalid value: "eyJsYXRlc3RDaGVja3BvaW50VGltZWxpbmVJRCI6IjQiLCJyZWRvV2FsRmlsZSI6IjAwMDAwMDA0MDAwMDAxRkEwMDAwMDA0OSIsImRhdGFiYXNlU3lzdGVtSWRlbnRpZmllciI6Ijc2MTMwNTMzMDQwNDM0MjE3MTYiLCJsYXRlc3RDaGVja3BvaW50UkVET0xvY2F0aW9uIjoiMUZBLzQ5MDAwMDI4IiwidGltZU9mTGF0ZXN0Q2hlY2twb2ludCI6IkZyaSBNYXkgMjkgMTE6MTA6MTAgMjAyNiIsIm9wZXJhdG9yVmVyc2lvbiI6IjEuMjcuMyJ9": promotionToken is only allowed for primary clusters] (retried 2 times).