Fix bug when selecting storage type for AWS (#1759)

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
Daniel Valdivia
2022-03-23 21:01:14 -07:00
committed by GitHub
parent f582d83afc
commit bb22a1d62a
2 changed files with 31 additions and 20 deletions

View File

@@ -62,7 +62,7 @@ export const resourcesConfigurations = {
export const AWSConfigurations: IntegrationConfiguration[] = [
{
typeSelection: "performance",
storageClass: "performance-c6gn-16xlarge",
storageClass: "performance-optimized",
CPU: 64,
memory: 128,
driveSize: { driveSize: "32", sizeUnit: "Gi" },
@@ -71,7 +71,7 @@ export const AWSConfigurations: IntegrationConfiguration[] = [
},
{
typeSelection: "capacity",
storageClass: "capacity-c6gn-16xlarge",
storageClass: "capacity-optimized",
CPU: 64,
memory: 128,
driveSize: { driveSize: "16", sizeUnit: "Ti" },

View File

@@ -31,6 +31,8 @@ export const addTenantSetStorageTypeReducer = (
let size = state.createTenant.fields.tenantSize.volumeSize;
let sizeFactor = state.createTenant.fields.tenantSize.sizeFactor;
let volumeSize = state.createTenant.fields.tenantSize.volumeSize;
let selectedStorageClass =
state.createTenant.fields.nameTenant.selectedStorageClass;
// for the aws marketplace integration we have some constraints
// on the minimum cluster size
@@ -60,27 +62,35 @@ export const addTenantSetStorageTypeReducer = (
const mainSelection = configs.find(
(item) => item.typeSelection === action.storageType
);
if (mainSelection !== undefined && mainSelection.minimumVolumeSize) {
const minimumSize = getBytesNumber(
mainSelection.minimumVolumeSize?.driveSize,
mainSelection.minimumVolumeSize?.sizeUnit,
true
);
if (mainSelection !== undefined) {
// store the selected storage class
selectedStorageClass = mainSelection.storageClass;
if (mainSelection.minimumVolumeSize) {
const minimumSize = getBytesNumber(
mainSelection.minimumVolumeSize?.driveSize,
mainSelection.minimumVolumeSize?.sizeUnit,
true
);
const drivesPerServer =
state.createTenant.fields.tenantSize.drivesPerServer;
const nodes = state.createTenant.fields.tenantSize.drivesPerServer;
const drivesPerServer =
state.createTenant.fields.tenantSize.drivesPerServer;
const nodes = state.createTenant.fields.tenantSize.drivesPerServer;
const currentSize = getBytesNumber(size.toString(), sizeFactor, true);
if (currentSize < minimumSize) {
size = minimumSize.toString(10);
const totalSize =
parseInt(nodes) *
parseInt(drivesPerServer) *
parseInt(mainSelection.minimumVolumeSize.driveSize);
const currentSize = getBytesNumber(
size.toString(),
sizeFactor,
true
);
if (currentSize < minimumSize) {
size = minimumSize.toString(10);
const totalSize =
parseInt(nodes) *
parseInt(drivesPerServer) *
parseInt(mainSelection.minimumVolumeSize.driveSize);
volumeSize = totalSize.toString(10);
sizeFactor = mainSelection.minimumVolumeSize.sizeUnit;
volumeSize = totalSize.toString(10);
sizeFactor = mainSelection.minimumVolumeSize.sizeUnit;
}
}
}
}
@@ -96,6 +106,7 @@ export const addTenantSetStorageTypeReducer = (
nameTenant: {
...state.createTenant.fields.nameTenant,
selectedStorageType: action.storageType,
selectedStorageClass: selectedStorageClass,
},
tenantSize: {
...state.createTenant.fields.tenantSize,