Fixed an issue where the cloud deployment wizard creates the cluster with the

High Availability even if that option is not selected. Fixes #7608
pull/90/head
Khushboo Vashi 2022-08-14 07:14:10 +05:30 committed by Akshay Joshi
parent 1e94c3bd81
commit ae5254e8a9
11 changed files with 66 additions and 24 deletions

View File

@ -36,7 +36,8 @@ details.
* Use the *Region* field to select the region.
* Use the *Database version* field to specify the PostgreSQL version to deploy.
* Use the *Public IP range* field to specify the IP Address range for permitting the
inbound traffic. Leave it blank for 0.0.0.0/0
* Use the *Instance type* field to select the instance type.
@ -49,10 +50,7 @@ details.
* Use the *Volume properties* field to specify the storage capacity.
* Use the *Cloud type* field to specify the private or public network.
* Use the *Public IP range* field to specify the IP Address range for permitting the
inbound traffic. Leave it blank for 0.0.0.0/0
.. image:: images/cloud_biganimal_database.png
:alt: Cloud Deployment Provider
@ -74,6 +72,12 @@ Use the fields from the Database Details tab to specify the Instance details.
* Use the *Confirm password* field to repeat the password.
* Use the *High Availability* field to create the cluster with high availability, which creates a cluster
with one primary and up to two standby replicas in different availability zones.
* Use the *Number of standby replicas* field to specify the standby replicas.
.. image:: images/cloud_biganimal_review.png
:alt: Cloud Deployment Provider
:align: center

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

@ -33,3 +33,4 @@ Bug fixes
| `Issue #7573 <https://redmine.postgresql.org/issues/7573>`_ - Ensure that autocomplete does not appear when navigating code using arrow keys.
| `Issue #7586 <https://redmine.postgresql.org/issues/7586>`_ - Fixed an issue with rendering geometry when selecting a complete column.
| `Issue #7587 <https://redmine.postgresql.org/issues/7587>`_ - Ensure that the children of information_schema and pg_catalog node should be displayed.
| `Issue #7608 <https://redmine.postgresql.org/issues/7608>`_ - Fixed an issue where the cloud deployment wizard creates the cluster with the High Availability even if that option is not selected.

View File

@ -70,17 +70,18 @@ class BigAnimalProvider(AbsProvider):
parser_create_instance.add_argument('--public-ip', default='',
help='Public IP '
'(default: 127.0.0.1)')
parser_create_instance.add_argument('--high-availability',
parser_create_instance.add_argument('--cluster-arch',
required=True,
help='High Availability')
help='Cluster Architecture')
parser_create_instance.add_argument('--nodes',
required=True,
help='No of Nodes')
def cmd_create_instance(self, args):
""" Create a biganimal cluster """
try:
private_network = True if args.private_network == '1' else False
high_availability = True if args.high_availability == '1' else\
False
ip = args.public_ip if args.public_ip else '0.0.0.0/0'
IpRanges = []
@ -107,7 +108,8 @@ class BigAnimalProvider(AbsProvider):
'replicas': 3,
'volumePropertiesId': args.volume_properties,
'volumeTypeId': args.volume_type,
'zoneRedundantHa': high_availability,
'clusterArch': {'id': args.cluster_arch, 'nodes': int(
args.nodes)},
'pgConfigMap': [],
}

View File

@ -27,6 +27,10 @@ from pgadmin.utils.constants import MIMETYPE_APP_JSON
MODULE_NAME = 'biganimal'
SINGLE_CLUSTER_ARCH = 'single'
HA_CLUSTER_ARCH = 'ha' # High Availability
EHA_CLUSTER_ARCH = 'eha' # Extreme High Availability
class BigAnimalModule(PgAdminModule):
"""Cloud module to deploy on EDB BigAnimal"""
@ -285,10 +289,12 @@ class BigAnimalProvider():
if resp.status_code == 200 and resp.content:
pg_types_resp = json.loads(resp.content)
for value in pg_types_resp['pgTypesList']:
pg_types.append({
'label': value['name'],
'value': value['id']
})
# Extreme HA is in Beta, so avoid it
if len(value['supportedClusterArchitectureIds']) != 1:
pg_types.append({
'label': value['name'],
'value': value['id']
})
return pg_types
def get_postgres_versions(self):
@ -366,10 +372,15 @@ def deploy_on_biganimal(data):
_label = data['instance_details']['name']
_private_network = '1' if str(data['instance_details']['cloud_type']
) == 'private' else '0'
_high_availability = '1' if data['db_details']['high_availability']\
else '0'
_instance_size = data['instance_details']['instance_size'].split('||')[1]
cluster_arch = SINGLE_CLUSTER_ARCH
nodes = 1
if data['db_details']['high_availability']:
cluster_arch = HA_CLUSTER_ARCH
nodes = int(data['db_details']['replicas']) + nodes
args = [_cmd_script,
data['cloud'],
'create-instance',
@ -389,8 +400,10 @@ def deploy_on_biganimal(data):
str(_instance_size),
'--private-network',
_private_network,
'--high-availability',
_high_availability
'--cluster-arch',
cluster_arch,
'--nodes',
str(nodes)
]
if 'biganimal_public_ip' in data['instance_details']:

View File

@ -188,6 +188,7 @@ export function getBigAnimalSummary(cloud, bigAnimalInstanceData, bigAnimalDatab
createData('Database Type', bigAnimalDatabaseData.database_type),
createData('Database Version', bigAnimalDatabaseData.postgres_version),
createData('High Availability', bigAnimalDatabaseData.high_availability),
createData('No of Standby Replicas', bigAnimalDatabaseData.replicas),
];
return [rows1, rows2, rows3, rows4];
@ -211,6 +212,10 @@ export function validateBigAnimalStep3(cloudDBDetails, nodeInfo) {
isEmptyString(cloudDBDetails.database_type) || isEmptyString(cloudDBDetails.postgres_version)) {
isError = true;
}
if(cloudDBDetails.high_availability == true && (isEmptyString(cloudDBDetails.replicas) || cloudDBDetails.replicas <= 0)) {
isError = true;
}
if (isEmptyString(cloudDBDetails.gid)) cloudDBDetails.gid = nodeInfo['server_group']._id;
return isError;
}

View File

@ -467,6 +467,7 @@ class BigAnimalDatabaseSchema extends BaseUISchema {
database_type: '',
postgres_version: '',
high_availability: false,
replicas: 0,
...initValues
});
@ -487,7 +488,10 @@ class BigAnimalDatabaseSchema extends BaseUISchema {
setErrMsg('confirm_password', gettext('Password must be 12 characters or more.'));
return true;
}
if (data.high_availability == true && (isEmptyString(data.replicas) || data.replicas <= 0)) {
setErrMsg('replicas', gettext('Please select no. of stand by replicas.'));
return true;
}
return false;
}
@ -592,6 +596,7 @@ class BigAnimalHighAvailSchema extends BaseUISchema {
super({
oid: undefined,
high_availability: false,
replicas: 0,
...initValues
});
@ -610,13 +615,25 @@ class BigAnimalHighAvailSchema extends BaseUISchema {
{
id: 'high_availability_note', type: 'note',
mode: ['create'],
text: gettext('High availability clusters are configured with one primary and two '
+ 'replicas with synchronous streaming replication. Clusters are configured across availability zones in regions with availability zones.'),
text: gettext('High availability clusters are configured with one primary and up to two '
+ 'stand by replicas. Clusters are configured across availability zones in regions with availability zones.'),
},{
id: 'high_availability', label: gettext('High Availability'), type: 'switch',
mode: ['create'],
helpMessage: gettext('Turning on high availability means your number of CPUs will triple, as will your cost.'),
}
id: 'high_availability', label: gettext('High availability'), type: 'switch',
mode: ['create']
},{
id: 'replicas', label: gettext('Number of standby replicas'), type: 'select',
mode: ['create'], deps: ['high_availability'],
controlProps: { allowClear: false },
helpMessage: gettext('Adding standby replicas will increase your number of CPUs, as well as your cost.'),
options: [
{'label': gettext('1'), 'value': 1},
{'label': gettext('2'), 'value': 2},
], noEmpty: true,
disabled: (state) => {
if (state.high_availability == true) return false;
return true;
}
},
];
}
}