Skip to content

Commit

Permalink
Merge pull request #1102 from alfonsomthd/perf-mode
Browse files Browse the repository at this point in the history
Create StorageSystem: add perfomance mode selector
  • Loading branch information
openshift-merge-bot[bot] authored Dec 2, 2023
2 parents 915b9c6 + 613b1e3 commit 0c5b4b3
Show file tree
Hide file tree
Showing 28 changed files with 943 additions and 104 deletions.
7 changes: 6 additions & 1 deletion cypress/support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ Cypress.Commands.add('install', () => {
'be.visible'
);
cy.get('button').contains('Next').click();
cy.get('input[type="checkbox"]').first().uncheck();
// @TODO: Do we still want to uncheck the already unchecked 'Taint nodes' checkbox?
// If yes, we should scroll down (needed after adding the performance profile selection)
// and then scroll up again to still be able to select nodes
// (or put this action after nodes' selection).
//cy.get('input[type="checkbox"]').first().uncheck();

cy.get('table').get('input[type="checkbox"]').first().check();
cy.get('button').contains('Next').click();
cy.get('button').contains('Next').click();
Expand Down
31 changes: 23 additions & 8 deletions locales/en/plugin__odf-console.json
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,13 @@
"Available raw capacity": "Available raw capacity",
"The available capacity is based on all attached disks associated with the selected StorageClass <3>{{storageClassName}}</3>": "The available capacity is based on all attached disks associated with the selected StorageClass <3>{{storageClassName}}</3>",
"Selected nodes": "Selected nodes",
"Configure performance": "Configure performance",
"CPUs required": "CPUs required",
"CPUs": "CPUs",
"Memory required": "Memory required",
"GiB": "GiB",
"Customize your Data Foundation cluster's performance by selecting a performance profile that meets your specific needs.": "Customize your Data Foundation cluster's performance by selecting a performance profile that meets your specific needs.",
"Select a performance mode from the list": "Select a performance mode from the list",
"Role": "Role",
"CPU": "CPU",
"Memory": "Memory",
Expand Down Expand Up @@ -745,10 +752,11 @@
"Capacity and nodes": "Capacity and nodes",
"Cluster capacity: {{capacity}}": "Cluster capacity: {{capacity}}",
"Selected nodes: {{nodeCount, number}} node_one": "Selected nodes: {{nodeCount, number}} node",
"Selected nodes: {{nodeCount, number}} node_other": "Selected nodes: {{nodeCount, number}} node",
"Selected nodes: {{nodeCount, number}} node_other": "Selected nodes: {{nodeCount, number}} nodes",
"CPU and memory: {{cpu, number}} CPU and {{memory}} memory": "CPU and memory: {{cpu, number}} CPU and {{memory}} memory",
"Performance profile: {{resourceProfile}}": "Performance profile: {{resourceProfile}}",
"Zone: {{zoneCount, number}} zone_one": "Zone: {{zoneCount, number}} zone",
"Zone: {{zoneCount, number}} zone_other": "Zone: {{zoneCount, number}} zone",
"Zone: {{zoneCount, number}} zone_other": "Zone: {{zoneCount, number}} zones",
"Arbiter zone: {{zone}}": "Arbiter zone: {{zone}}",
"Taint nodes: {{ocsTaintsStatus}}": "Taint nodes: {{ocsTaintsStatus}}",
"Replica-1 pool: {{singleReplicaPoolStatus}}": "Replica-1 pool: {{singleReplicaPoolStatus}}",
Expand Down Expand Up @@ -794,10 +802,10 @@
"Create StorageSystem": "Create StorageSystem",
"Create a StorageSystem to represent your Data Foundation system and all its required storage and computing resources.": "Create a StorageSystem to represent your Data Foundation system and all its required storage and computing resources.",
"{{nodeCount, number}} node_one": "{{nodeCount, number}} node",
"{{nodeCount, number}} node_other": "{{nodeCount, number}} node",
"selected ({{cpu}} CPU and {{memory}} on ": "selected ({{cpu}} CPU and {{memory}} on ",
"{{nodeCount, number}} node_other": "{{nodeCount, number}} nodes",
"selected ({{cpu}} CPUs and {{memory}} on ": "selected ({{cpu}} CPUs and {{memory}} on ",
"{{zoneCount, number}} zone_one": "{{zoneCount, number}} zone",
"{{zoneCount, number}} zone_other": "{{zoneCount, number}} zone",
"{{zoneCount, number}} zone_other": "{{zoneCount, number}} zones",
"Node Table": "Node Table",
"Connection name": "Connection name",
"An unique name for the key management service within the project. Name must only include alphanumeric characters, \"-\", \"_\" or \".\"": "An unique name for the key management service within the project. Name must only include alphanumeric characters, \"-\", \"_\" or \".\"",
Expand Down Expand Up @@ -946,8 +954,9 @@
"No StorageCluster found": "No StorageCluster found",
"Set up a storage cluster to view the topology": "Set up a storage cluster to view the topology",
"A minimal cluster deployment will be performed.": "A minimal cluster deployment will be performed.",
"The selected nodes do not match Data Foundation's StorageCluster requirement of an aggregated 30 CPUs and 72 GiB of RAM. If the selection cannot be modified a minimal cluster will be deployed.": "The selected nodes do not match Data Foundation's StorageCluster requirement of an aggregated 30 CPUs and 72 GiB of RAM. If the selection cannot be modified a minimal cluster will be deployed.",
"Back to nodes selection": "Back to nodes selection",
"Aggregate resource requirements for the selected performance profile not met.": "Aggregate resource requirements for the selected performance profile not met.",
"Select nodes with sufficient CPU and memory that meet the specified minimum requirements, and try again, or choose a different performance profile to proceed.": "Select nodes with sufficient CPU and memory that meet the specified minimum requirements, and try again, or choose a different performance profile to proceed.",
"Select a StorageClass to continue": "Select a StorageClass to continue",
"This is a required field. The StorageClass will be used to request storage from the underlying infrastructure to create the backing PersistentVolumes that will be used to provide the Data Foundation service.": "This is a required field. The StorageClass will be used to request storage from the underlying infrastructure to create the backing PersistentVolumes that will be used to provide the Data Foundation service.",
"Create new StorageClass": "Create new StorageClass",
Expand Down Expand Up @@ -982,6 +991,8 @@
"If you wish to use the Arbiter stretch cluster, a minimum of 4 nodes (2 different zones, 2 nodes per zone) and 1 additional zone with 1 node is required. All nodes must be pre-labeled with zones in order to be validated on cluster creation.": "If you wish to use the Arbiter stretch cluster, a minimum of 4 nodes (2 different zones, 2 nodes per zone) and 1 additional zone with 1 node is required. All nodes must be pre-labeled with zones in order to be validated on cluster creation.",
"Selected nodes are based on the StorageClass <1>{{scName}}</1> and with a recommended requirement of 14 CPU and 34 GiB RAM per node.": "Selected nodes are based on the StorageClass <1>{{scName}}</1> and with a recommended requirement of 14 CPU and 34 GiB RAM per node.",
"Selected nodes are based on the StorageClass <1>{{scName}}</1> and fulfill the stretch cluster requirements with a recommended requirement of 14 CPU and 34 GiB RAM per node.": "Selected nodes are based on the StorageClass <1>{{scName}}</1> and fulfill the stretch cluster requirements with a recommended requirement of 14 CPU and 34 GiB RAM per node.",
"<0>Performance profiles:</0><1><0>Balanced mode:</0> Optimized for a well-rounded blend of CPU and memory resources to support diverse workloads.</1><2><0>Lean mode:</0> Minimizes resource consumption by allocating fewer CPUs and less memory for resource-efficient operations.</2><3><0>Performance mode:</0> Tailored for high-performance, allocating ample CPUs and memory to ensure optimal execution of demanding workloads.</3>": "<0>Performance profiles:</0><1><0>Balanced mode:</0> Optimized for a well-rounded blend of CPU and memory resources to support diverse workloads.</1><2><0>Lean mode:</0> Minimizes resource consumption by allocating fewer CPUs and less memory for resource-efficient operations.</2><3><0>Performance mode:</0> Tailored for high-performance, allocating ample CPUs and memory to ensure optimal execution of demanding workloads.</3>",
"The number of CPUs and memory resources needed to optimize your Data Foundation cluster for enhanced performance is determined by taking into account the cluster's specific environment, size and various other factors.": "The number of CPUs and memory resources needed to optimize your Data Foundation cluster for enhanced performance is determined by taking into account the cluster's specific environment, size and various other factors.",
"Backing Store": "Backing Store",
"Bucket Class": "Bucket Class",
"Namespace Store": "Namespace Store",
Expand Down Expand Up @@ -1019,6 +1030,10 @@
"Attach OBC to a Deployment": "Attach OBC to a Deployment",
"Deployment Name": "Deployment Name",
"Attach": "Attach",
"and": "and",
"GiB RAM": "GiB RAM",
"Configure Performance": "Configure Performance",
"Save changes": "Save changes",
"hr": "hr",
"min": "min",
"Select at least 2 Backing Store resources": "Select at least 2 Backing Store resources",
Expand Down Expand Up @@ -1139,7 +1154,6 @@
"Receive bandwidth": "Receive bandwidth",
"Node details": "Node details",
"Instance type": "Instance type",
"Rack": "Rack",
"External ID": "External ID",
"Node addresses": "Node addresses",
"Machine": "Machine",
Expand Down Expand Up @@ -1186,5 +1200,6 @@
"Cannot change resource name (original: \"{{name}}\", updated: \"{{newName}}\").": "Cannot change resource name (original: \"{{name}}\", updated: \"{{newName}}\").",
"Cannot change resource namespace (original: \"{{namespace}}\", updated: \"{{newNamespace}}\").": "Cannot change resource namespace (original: \"{{namespace}}\", updated: \"{{newNamespace}}\").",
"Cannot change resource kind (original: \"{{original}}\", updated: \"{{updated}}\").": "Cannot change resource kind (original: \"{{original}}\", updated: \"{{updated}}\").",
"Cannot change API group (original: \"{{apiGroup}}\", updated: \"{{newAPIGroup}}\").": "Cannot change API group (original: \"{{apiGroup}}\", updated: \"{{newAPIGroup}}\")."
"Cannot change API group (original: \"{{apiGroup}}\", updated: \"{{newAPIGroup}}\").": "Cannot change API group (original: \"{{apiGroup}}\", updated: \"{{newAPIGroup}}\").",
"Rack": "Rack"
}
33 changes: 30 additions & 3 deletions packages/odf/components/actions/csv-actions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { useMemo } from 'react';
import AddSSCapacityModal from '@odf/core/modals/add-capacity/add-capacity-modal';
import ConfigureSSPerformanceModal from '@odf/core/modals/configure-performance/configure-performance-modal';
import { ODFStorageSystem } from '@odf/shared/models';
import { StorageSystemKind } from '@odf/shared/types';
import {
Expand All @@ -14,7 +16,6 @@ import {
useModal,
} from '@openshift-console/dynamic-plugin-sdk';
import { LaunchModal } from '@openshift-console/dynamic-plugin-sdk/lib/app/modal-support/ModalProvider';
import AddSSCapacityModal from '../../modals/add-capacity/add-capacity-modal';

export const useCsvActions = ({
resource,
Expand All @@ -31,7 +32,16 @@ export const useCsvActions = ({
() =>
referenceForModel(k8sModel) === referenceForModel(ODFStorageSystem) &&
isOCSStorageSystem(resource as StorageSystemKind)
? [AddCapacityStorageSystem(resource as StorageSystemKind, launchModal)]
? [
AddCapacityStorageSystem(
resource as StorageSystemKind,
launchModal
),
ConfigurePerformanceStorageSystem(
resource as StorageSystemKind,
launchModal
),
]
: [],

[k8sModel, resource, launchModal]
Expand All @@ -40,7 +50,7 @@ export const useCsvActions = ({
return useMemo(() => [actions, !inFlight, undefined], [actions, inFlight]);
};

export const AddCapacityStorageSystem = (
const AddCapacityStorageSystem = (
resource: StorageSystemKind,
launchModal: LaunchModal
): Action => {
Expand All @@ -56,3 +66,20 @@ export const AddCapacityStorageSystem = (
},
};
};

const ConfigurePerformanceStorageSystem = (
resource: StorageSystemKind,
launchModal: LaunchModal
): Action => {
return {
id: 'configure-performance-storage-system',
label: 'Configure performance',
insertAfter: 'add-capacity-storage-system',
cta: () => {
launchModal(ConfigureSSPerformanceModal as any, {
extraProps: { resource },
isOpen: true,
});
},
};
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { BucketClassType, ValidationType } from '@odf/core/types';
import { LoadingInline } from '@odf/shared/generic/Loading';
import { getName } from '@odf/shared/selectors';
import { useCustomTranslation } from '@odf/shared/useCustomTranslationHook';
Expand All @@ -20,12 +21,10 @@ import {
TextContent,
} from '@patternfly/react-core';
import { NamespacePolicyType } from '../../../constants';
import { BucketClassType } from '../../../types';
import { convertTime, getTimeUnitString } from '../../../utils';
import {
VALIDATIONS,
ValidationMessage,
ValidationType,
} from '../../utils/common-odf-install-el';
import { StoreCard } from '../review-utils';
import { State } from '../state';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const createSteps = (
storageClass={storageClass}
volumeSetName={createLocalVolumeSet.volumeSetName}
nodes={nodes}
resourceProfile={capacityAndNodes.resourceProfile}
/>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
attachDevicesWithArbiter,
} from '@odf/core/constants';
import { pvResource, nodeResource } from '@odf/core/resources';
import { NodesPerZoneMap } from '@odf/core/types';
import { NodesPerZoneMap, ResourceProfile } from '@odf/core/types';
import { getSCAvailablePVs, getAssociatedNodes } from '@odf/core/utils';
import { calcPVsCapacity } from '@odf/core/utils';
import { FieldLevelHelp } from '@odf/shared/generic/FieldLevelHelp';
Expand All @@ -29,6 +29,7 @@ import { K8sResourceKind, NodeKind } from '@odf/shared/types';
import { useCustomTranslation } from '@odf/shared/useCustomTranslationHook';
import { humanizeBinaryBytes } from '@odf/shared/utils';
import { useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk';
import * as _ from 'lodash-es';
import { Trans } from 'react-i18next';
import {
Checkbox,
Expand All @@ -47,10 +48,23 @@ import { ValidationMessage } from '../../../utils/common-odf-install-el';
import { ErrorHandler } from '../../error-handler';
import { WizardDispatch, WizardNodeState, WizardState } from '../../reducer';
import { SelectNodesTable } from '../../select-nodes-table/select-nodes-table';
import ConfigurePerformance, {
PerformanceHeaderText,
ProfileRequirementsText,
} from './configure-performance';
import { SelectedNodesTable } from './selected-nodes-table';
import { StretchCluster } from './stretch-cluster';
import './capacity-and-nodes.scss';

const onResourceProfileChange = _.curry(
(dispatch: WizardDispatch, newProfile: ResourceProfile): void => {
dispatch({
type: 'wizard/setResourceProfile',
payload: newProfile,
});
}
);

const SelectNodesText: React.FC<SelectNodesTextProps> = React.memo(
({ text }) => {
const { t } = useCustomTranslation();
Expand Down Expand Up @@ -142,6 +156,7 @@ type SelectCapacityAndNodesProps = {
nodes: WizardState['nodes'];
enableTaint: WizardState['capacityAndNodes']['enableTaint'];
enableSingleReplicaPool: WizardState['capacityAndNodes']['enableSingleReplicaPool'];
resourceProfile: WizardState['capacityAndNodes']['resourceProfile'];
};

const SelectCapacityAndNodes: React.FC<SelectCapacityAndNodesProps> = ({
Expand All @@ -150,6 +165,7 @@ const SelectCapacityAndNodes: React.FC<SelectCapacityAndNodesProps> = ({
nodes,
enableTaint,
enableSingleReplicaPool,
resourceProfile,
}) => {
const { t } = useCustomTranslation();

Expand All @@ -166,6 +182,10 @@ const SelectCapacityAndNodes: React.FC<SelectCapacityAndNodesProps> = ({
},
[dispatch]
);
const onProfileChange = React.useCallback(
(profile) => onResourceProfileChange(dispatch)(profile),
[dispatch]
);

const replicas = getReplicasFromSelectedNodes(nodes);

Expand Down Expand Up @@ -219,6 +239,13 @@ const SelectCapacityAndNodes: React.FC<SelectCapacityAndNodesProps> = ({
<SelectNodesTable nodes={nodes} onRowSelected={onRowSelected} />
</GridItem>
</Grid>
<ConfigurePerformance
onResourceProfileChange={onProfileChange}
resourceProfile={resourceProfile}
headerText={PerformanceHeaderText}
profileRequirementsText={ProfileRequirementsText}
selectedNodes={nodes}
/>
<EnableTaintNodes dispatch={dispatch} enableTaint={enableTaint} />
<EnableSingleReplicaPool
dispatch={dispatch}
Expand All @@ -237,6 +264,7 @@ const SelectedCapacityAndNodes: React.FC<SelectedCapacityAndNodesProps> = ({
dispatch,
nodes,
enableSingleReplicaPool,
resourceProfile,
}) => {
const { t } = useCustomTranslation();
const [pv, pvLoaded, pvLoadError] =
Expand Down Expand Up @@ -313,6 +341,10 @@ const SelectedCapacityAndNodes: React.FC<SelectedCapacityAndNodesProps> = ({
}),
[dispatch]
);
const onProfileChange = React.useCallback(
(profile) => onResourceProfileChange(dispatch)(profile),
[dispatch]
);

return (
<ErrorHandler
Expand Down Expand Up @@ -381,6 +413,13 @@ const SelectedCapacityAndNodes: React.FC<SelectedCapacityAndNodesProps> = ({
<SelectedNodesTable data={nodes} />
</GridItem>
</Grid>
<ConfigurePerformance
onResourceProfileChange={onProfileChange}
resourceProfile={resourceProfile}
headerText={PerformanceHeaderText}
profileRequirementsText={ProfileRequirementsText}
selectedNodes={nodes}
/>
<EnableTaintNodes dispatch={dispatch} enableTaint={enableTaint} />
<EnableSingleReplicaPool
dispatch={dispatch}
Expand All @@ -400,6 +439,7 @@ type SelectedCapacityAndNodesProps = {
arbiterLocation: WizardState['capacityAndNodes']['arbiterLocation'];
dispatch: WizardDispatch;
nodes: WizardNodeState[];
resourceProfile: WizardState['capacityAndNodes']['resourceProfile'];
};

export const CapacityAndNodes: React.FC<CapacityAndNodesProps> = ({
Expand All @@ -408,6 +448,7 @@ export const CapacityAndNodes: React.FC<CapacityAndNodesProps> = ({
storageClass,
volumeSetName,
nodes,
resourceProfile,
}) => {
const {
capacity,
Expand All @@ -421,7 +462,8 @@ export const CapacityAndNodes: React.FC<CapacityAndNodesProps> = ({
const validations = capacityAndNodesValidate(
nodes,
enableArbiter,
isNoProvisioner
isNoProvisioner,
resourceProfile
);

return (
Expand All @@ -436,6 +478,7 @@ export const CapacityAndNodes: React.FC<CapacityAndNodesProps> = ({
nodes={nodes}
capacity={capacity}
enableSingleReplicaPool={enableSingleReplicaPool}
resourceProfile={resourceProfile}
/>
) : (
<SelectCapacityAndNodes
Expand All @@ -444,6 +487,7 @@ export const CapacityAndNodes: React.FC<CapacityAndNodesProps> = ({
capacity={capacity}
nodes={nodes}
enableSingleReplicaPool={enableSingleReplicaPool}
resourceProfile={resourceProfile}
/>
)}
{!!validations.length &&
Expand All @@ -459,6 +503,7 @@ type CapacityAndNodesProps = {
state: WizardState['capacityAndNodes'];
storageClass: WizardState['storageClass'];
nodes: WizardState['nodes'];
resourceProfile: WizardState['capacityAndNodes']['resourceProfile'];
volumeSetName: WizardState['createLocalVolumeSet']['volumeSetName'];
dispatch: WizardDispatch;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.odf-configure-performance__selector {
width: 18rem;
}
Loading

0 comments on commit 0c5b4b3

Please sign in to comment.