Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const createSteps = (
nodes,
createLocalVolumeSet,
connectionDetails,
optionalSettings,
} = state;
const { systemNamespace, externalStorage, deployment } = backingStorage;
const { encryption, kms } = securityAndNetwork;
Expand Down Expand Up @@ -73,6 +74,7 @@ export const createSteps = (
nodes={nodes}
systemNamespace={systemNamespace}
isTNFEnabled={isTNFEnabled}
enableNFS={optionalSettings.enableNFS}
/>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ export const CapacityAndNodes: React.FC<CapacityAndNodesProps> = ({
systemNamespace,
infraType,
isTNFEnabled,
enableNFS,
}) => {
const {
capacity,
Expand Down Expand Up @@ -473,7 +474,13 @@ export const CapacityAndNodes: React.FC<CapacityAndNodesProps> = ({

const validations = isTNFEnabled
? []
: capacityAndNodesValidate(nodes, state, isNoProvisioner, osdAmount);
: capacityAndNodesValidate(
nodes,
state,
isNoProvisioner,
osdAmount,
enableNFS
);
const onProfileChange = React.useCallback(
(profile) => onResourceProfileChange(dispatch)(profile),
[dispatch]
Expand Down Expand Up @@ -528,6 +535,7 @@ export const CapacityAndNodes: React.FC<CapacityAndNodesProps> = ({
selectedNodes={nodes}
osdAmount={osdAmount}
isTNFEnabled={isTNFEnabled}
enableNFS={enableNFS}
/>
<EnableTaintNodes
dispatch={dispatch}
Expand Down Expand Up @@ -573,4 +581,5 @@ type CapacityAndNodesProps = {
infraType: InfraProviders;
systemNamespace: WizardState['backingStorage']['systemNamespace'];
isTNFEnabled: boolean;
enableNFS: boolean;
};
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ const selectOptions = (
t: TFunction,
forceLean: boolean,
osdAmount: number,
architecture?: string
architecture?: string,
enableNFS?: boolean
) =>
Object.entries(ResourceProfile).map((value: [string, ResourceProfile]) => {
const displayName = t('{{mode}} mode', { mode: value[0] });
let profile = value[1];
const { minCpu, minMem } = getResourceProfileRequirements(
profile,
osdAmount,
architecture
architecture,
enableNFS
);
const description = `CPUs required: ${minCpu}, Memory required: ${minMem} GiB`;
const isDisabled =
Expand Down Expand Up @@ -69,16 +71,18 @@ type ProfileRequirementsTextProps = {
selectedProfile: ResourceProfile;
osdAmount: number;
architecture?: string;
enableNFS?: boolean;
};

export const ProfileRequirementsText: React.FC<
ProfileRequirementsTextProps
> = ({ selectedProfile, osdAmount, architecture }) => {
> = ({ selectedProfile, osdAmount, architecture, enableNFS }) => {
const { t } = useCustomTranslation();
const { minCpu, minMem } = getResourceProfileRequirements(
selectedProfile,
osdAmount,
architecture
architecture,
enableNFS
);
return (
<Content>
Expand Down Expand Up @@ -126,6 +130,7 @@ type ConfigurePerformanceProps = {
selectedNodes: WizardNodeState[];
osdAmount?: number;
isTNFEnabled?: boolean;
enableNFS?: boolean;
};

const ConfigurePerformance: React.FC<ConfigurePerformanceProps> = ({
Expand All @@ -136,6 +141,7 @@ const ConfigurePerformance: React.FC<ConfigurePerformanceProps> = ({
selectedNodes,
osdAmount,
isTNFEnabled,
enableNFS,
}) => {
const { t } = useCustomTranslation();
const [availableNodes, availableNodesLoaded, availableNodesLoadError] =
Expand All @@ -156,7 +162,8 @@ const ConfigurePerformance: React.FC<ConfigurePerformanceProps> = ({
allCpu,
allMem,
osdAmount,
architecture
architecture,
enableNFS
)
) {
forceLean = true;
Expand All @@ -174,7 +181,8 @@ const ConfigurePerformance: React.FC<ConfigurePerformanceProps> = ({
getTotalCpu(selectedNodes),
getTotalMemoryInGiB(selectedNodes),
osdAmount,
architecture
architecture,
enableNFS
)
: true;
const validated =
Expand All @@ -199,7 +207,13 @@ const ConfigurePerformance: React.FC<ConfigurePerformanceProps> = ({
selectedKey={resourceProfile}
id="resource-profile"
className="odf-configure-performance__selector pf-v6-u-mb-md"
selectOptions={selectOptions(t, forceLean, osdAmount, architecture)}
selectOptions={selectOptions(
t,
forceLean,
osdAmount,
architecture,
enableNFS
)}
onChange={onResourceProfileChange}
validated={validated}
isDisabled={isTNFEnabled}
Expand All @@ -209,6 +223,7 @@ const ConfigurePerformance: React.FC<ConfigurePerformanceProps> = ({
selectedProfile={resourceProfile}
osdAmount={osdAmount}
architecture={architecture}
enableNFS={enableNFS}
/>
)}
</div>
Expand Down
3 changes: 2 additions & 1 deletion packages/odf/components/create-storage-system/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ const canJumpToNextStep = (
getTotalCpu(nodes),
getTotalMemoryInGiB(nodes),
osdAmount,
architecture
architecture,
optionalSettings.enableNFS
) &&
isValidCapacityAutoScalingConfig(
capacityAndNodes.capacityAutoScaling.enable,
Expand Down
9 changes: 6 additions & 3 deletions packages/odf/components/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ export const capacityAndNodesValidate = (
nodes: WizardNodeState[],
state: WizardState['capacityAndNodes'],
isNoProvSC: boolean,
osdAmount: number
osdAmount: number,
enableNFS?: boolean
): ValidationType[] => {
const validations = [];
const {
Expand All @@ -189,7 +190,8 @@ export const capacityAndNodesValidate = (
totalCpu,
totalMemory,
osdAmount,
architecture
architecture,
enableNFS
)
) {
validations.push(ValidationType.RESOURCE_PROFILE);
Expand All @@ -200,7 +202,8 @@ export const capacityAndNodesValidate = (
totalCpu,
totalMemory,
osdAmount,
architecture
architecture,
enableNFS
)
) {
validations.push(ValidationType.MINIMAL);
Expand Down
15 changes: 15 additions & 0 deletions packages/odf/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,21 @@ export const S390X_CPU_ADJUSTMENTS = {
},
};

/**
* NFS resource requirements to be added when NFS is enabled
*/
export const NFS_RESOURCE_REQUIREMENTS = {
minCpu: 6,
minMem: 16, // GiB
};

/**
* s390x specific NFS CPU requirements
*/
export const NFS_S390X_CPU_REQUIREMENT = {
minCpu: 3,
};

export enum DefaultRequestSize {
BAREMETAL = '1',
NON_BAREMETAL = '2Ti',
Expand Down
22 changes: 19 additions & 3 deletions packages/odf/utils/ocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import {
HOSTNAME_LABEL_KEY,
LABEL_OPERATOR,
MINIMUM_NODES,
NFS_RESOURCE_REQUIREMENTS,
NFS_S390X_CPU_REQUIREMENT,
ocsTaint,
RESOURCE_PROFILE_REQUIREMENTS_MAP,
S390X_CPU_ADJUSTMENTS,
Expand Down Expand Up @@ -131,7 +133,8 @@ export const getNodeArchitectureFromState = (
export const getResourceProfileRequirements = (
profile: ResourceProfile,
osdAmount: number,
architecture?: string
architecture?: string,
enableNFS?: boolean
): { minCpu: number; minMem: number } => {
let { minCpu, minMem, osd } = RESOURCE_PROFILE_REQUIREMENTS_MAP[profile];

Expand All @@ -148,6 +151,16 @@ export const getResourceProfileRequirements = (
cpu += Math.ceil(extraOsds * osd.cpu);
mem += Math.ceil(extraOsds * osd.mem);
}

if (enableNFS) {
if (architecture === ARCHITECTURE_S390X) {
cpu += NFS_S390X_CPU_REQUIREMENT.minCpu;
} else {
cpu += NFS_RESOURCE_REQUIREMENTS.minCpu;
}
mem += NFS_RESOURCE_REQUIREMENTS.minMem;
}

return { minCpu: cpu, minMem: mem };
};

Expand All @@ -158,19 +171,22 @@ export const getResourceProfileRequirements = (
* @param memory The amount of selected nodes' memory in GiB.
* @param osdAmount The amount of OSD pods.
* @param architecture The node architecture.
* @param enableNFS Whether NFS is enabled.
* @returns boolean
*/
export const isResourceProfileAllowed = (
profile: ResourceProfile,
cpu: number,
memory: number,
osdAmount: number,
architecture?: string
architecture?: string,
enableNFS?: boolean
): boolean => {
const { minCpu, minMem } = getResourceProfileRequirements(
profile,
osdAmount,
architecture
architecture,
enableNFS
);

return cpu >= minCpu && memory >= minMem;
Expand Down
Loading