Cluster cloning fails when scripts include references to configMaps
Summary
The web console implements cloning configurations for a SGCluster.
Even though the cloning process works fine, there might be cases on which the cluster to clone contains references to configMaps, which causes the request to fail because of extra information included in the payload.
The reason why this fails is because the request includes both, the reference to the configMap and the script associated to it. The later shouldn't be included on the payload.
"spec":{
...
"initialData":{
"scripts":[
{
"name":"map",
"database":"db",
"scriptFrom":{
"configMapScript":"CREATE USER pguser2 WITH PASSWORD 'pguser2';",
"configMapKeyRef":{
"key":"script-key",
"name":"script-configmap"
}
}
}
]
}
...
},
Steps to reproduce
- Enter the web console
- Create any cluster with script references to configMaps
- Clone the created cluster
- An error like the one on the image above will appear
Expected Behaviour
The cloning should work fine even when referencing configMaps
Possible Solution
Remove the additional configMapScript
property from the payload
Environment
- StackGres version:
1.2.0