-
Notifications
You must be signed in to change notification settings - Fork 33
StoragePool creation changes for new 2 Nodes + 1 Arbiter cluster #2154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
StoragePool creation changes for new 2 Nodes + 1 Arbiter cluster #2154
Conversation
if (state.isTwoNodeOneArbiterCluster) { | ||
return replica === '2'; | ||
} else if (state.isArbiterCluster) { | ||
return replica === '4'; | ||
} else { | ||
return replica !== '4'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other way of writting the same looks like below,
(state.isTwoNodeOneArbiterCluster && replica === '2') ||
(state.isArbiterCluster && !state.isTwoNodeOneArbiterCluster && replica === '4') ||
(!state.isArbiterCluster && !state.isTwoNodeOneArbiterCluster && replica !== '4')
A simple if
condition seemed to be much readable and understandable code.
Please let me know your thoughts
7970644
to
259e6c7
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aruniiird The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
259e6c7
to
cd0d893
Compare
...orage-system/create-storage-system-steps/capacity-and-nodes-step/capacity-and-nodes-step.tsx
Outdated
Show resolved
Hide resolved
<p className="pf-v5-u-pt-sm"> | ||
<strong>{t('Note:')} </strong> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p className="pf-v5-u-pt-sm"> | |
<strong>{t('Note:')} </strong> | |
<p className="pf-v5-u-pt-sm pf-v5-u-font-weight-bold"> | |
{t('Note:')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not my change, I just enclosed it under a condition.
We don't have to show this Note/Text if it is a TNA cluster.
I think <strong>
tag is only for the Note:
section (of the message), rest of the message should come in normal way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use a PF class.
}; | ||
}; | ||
|
||
export type PoolSpecType = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of creating a new type, please complete the missing spec in https://github.com/alfonsomthd/odf-console/blob/master/packages/ocs/types.ts#L13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW the Type
siffix for types is redundant (not necessary).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not yet addressed
cd0d893
to
72d3d9b
Compare
2ada5c3
to
c1f916f
Compare
When we detect a 2 Nodes + 1 Arbiter cluster, we should only show, '2-way Replication' in 'Data protection policy' list How is '2 Nodes + 1 Arbiter' cluster detected? There is an entry in 'Infrastructure' CR's `controlPlaneTopology` status, value should be `HighlyAvailableArbiter`. Added changes for 'StorageSystem' creation steps. Signed-off-by: Arun Kumar Mohan <[email protected]>
c1f916f
to
d6f2525
Compare
@@ -83,6 +87,12 @@ export const StoragePoolStatus: React.FC<StoragePoolStatusProps> = ({ | |||
); | |||
}; | |||
|
|||
export const isTwoNodePlusArbiterTopology = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either move it to packages/shared/src/utils/common.ts
(preferred) or remove the export
as it is used in the same file.
{isTwoNodesOneArbiterClusterEnabled && ( | ||
<GridItem span={10}> | ||
<Alert | ||
title="2-Nodes and 1-Arbiter setup detected" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title="2-Nodes and 1-Arbiter setup detected" | |
title={t('2-Nodes and 1-Arbiter setup detected')} |
<GridItem span={10}> | ||
<Alert | ||
title="2-Nodes and 1-Arbiter setup detected" | ||
variant="warning" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variant="warning" | |
variant={AlertVariant.warning} |
const rolesArr = roles as string[]; | ||
const isArbiter = rolesArr.some((r) => r === 'arbiter'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const rolesArr = roles as string[]; | |
const isArbiter = rolesArr.some((r) => r === 'arbiter'); | |
const isArbiter = (roles as WizardNodeState['roles']).some((r) => r === 'arbiter'); |
@@ -63,6 +67,11 @@ const SelectedNodesTableRow = ({ obj, activeColumnIDs }) => { | |||
resourceModel={NodeModel} | |||
resourceName={name} | |||
/> | |||
{isArbiter && ( | |||
<Label color="green" variant="filled"> | |||
Arbiter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arbiter | |
{t('Arbiter')} |
@@ -95,6 +96,7 @@ const ConfirmationModal: React.FC<ConfirmationModalProps> = ({ | |||
stepIdReached, | |||
ns, | |||
nodes, | |||
isThisTwoNodesOneArbiterCluster, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isThisTwoNodesOneArbiterCluster, | |
isTwoNodesOneArbiterCluster, |
@@ -346,6 +361,7 @@ export const CreateLocalVolumeSet: React.FC<CreateLocalVolumeSetProps> = ({ | |||
setErrorMessage={setLvsError} | |||
storageClassName={storageClass.name} | |||
stepIdReached={stepIdReached} | |||
isThisTwoNodesOneArbiterCluster={isTwoNodesOneArbiterCluster} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isThisTwoNodesOneArbiterCluster={isTwoNodesOneArbiterCluster} | |
isTwoNodesOneArbiterCluster={isTwoNodesOneArbiterCluster} |
const minNodes = isTwoNodesOneArbiterClusterDetected | ||
? MINIMUM_NODES_FOR_TNA_CLUSTER | ||
: MINIMUM_NODES; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this logic repeated several times: you can create a shared util (DRY principle).
// if it is a TNA cluster, set replica count to 2 | ||
const deviceSetReplica: number = isTwoNodesOneArbiterClusterEnabled | ||
? 2 | ||
: getDeviceSetReplica(stretchClusterChecked, flexibleScaling, nodes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this logic should be inside getDeviceSetReplica
to avoid potential errors when this function is called in other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments.
@aruniiird: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Couple of things:
|
When we detect a 2 Nodes + 1 Arbiter cluster, we should only show, '2-way Replication' in 'Data protection policy' list
How is '2 Nodes + 1 Arbiter' cluster detected?
There is an entry in 'Infrastructure' CR's
controlPlaneTopology
status, value should beHighlyAvailableArbiter
.