Skip to content
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

[RHSTOR-5140] Adds Ceph mon count update for 5 zones #1117

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

bipuladh
Copy link
Contributor

@bipuladh bipuladh commented Dec 6, 2023

Adds support for updating Ceph Mon count for 5 zones
Screenshot:
Screenshot from 2023-12-11 12-51-33

@openshift-ci openshift-ci bot added the approved label Dec 6, 2023
@bipuladh bipuladh changed the title Adds Alert modal for 5 zone Monitor update [WIP] Adds Alert modal for 5 zone Monitor update Dec 6, 2023
@bipuladh bipuladh changed the title [WIP] Adds Alert modal for 5 zone Monitor update [RHSTOR-5140] Adds Ceph mon count update for 5 zones Dec 11, 2023
@bipuladh bipuladh force-pushed the multi-mons branch 2 times, most recently from 2da5945 to 9ccc69f Compare December 11, 2023 07:16
const [errorMessage, setErrorMessage] = React.useState('');
const [inProgress, setProgress] = React.useState(false);

//Todo(bipuladh): Update it to use information from the alert
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for adding such a strange suggestion on the PR, but I am adding comments prefixed with term // ToDo (epic 4422) so that it will be easier to search for all such instances later and make updates related to multiple storagecluster epic...

Suggested change
//Todo(bipuladh): Update it to use information from the alert
// ToDo (epic 4422) (bipuladh): Update it to use information from the alert

direction={{ default: 'column' }}
spaceItems={{ default: 'spaceItemsNone' }}
>
<FlexItem>{t('Failure domains: 5')}</FlexItem>
Copy link
Collaborator

@SanjalKatiyar SanjalKatiyar Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just asking, should we determine the count from the rack/zone labels and then display, instead of exact value ?? assuming there can be more than 5 racks/FD as well (as per epic's title)...

spaceItems={{ default: 'spaceItemsNone' }}
>
<FlexItem>{t('Failure domains: 5')}</FlexItem>
<FlexItem>{t('Monitor count: 3')}</FlexItem>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, just asking, should we read it from StorageCluster CR ?? we are already polling for it...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the alert will only be raised for scenarios when mon count is 3. so this is safe.

setProgress(false);
})
.catch((err) => {
setErrorMessage(err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to add setProgress(false); for error case?

Comment on lines 82 to 93
<Trans t={t as any} ns="plugin__odf-console">
To enhance system resilience, align Ceph monitors with the
available node failure zones.
</Trans>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why tag here? can't we use a t function?

Copy link
Contributor Author

@bipuladh bipuladh Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same thing. Used it here because the sentence is a bit long.

Copy link
Contributor

@GowthamShanmugam GowthamShanmugam Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it is the same, But I prefer to use the t function rather than <Trans> So we can change the ns anytime. In case of refactoring, it will be easy to change the ns. I use <Trans" only when I have any HTML tags in between.

It just an optional suggestion

</Text>
</FlexItem>
</Flex>
{errorMessage && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{errorMessage && (
{!!errorMessage && (

</Flex>
{errorMessage && (
<Alert isInline variant="danger" title={t('An error occurred')}>
{(errorMessage as any)?.message || errorMessage}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to create one common util function to fetch error messages in a shared folder. but it is just an optional suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can take it up in a different PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack

@bipuladh bipuladh force-pushed the multi-mons branch 2 times, most recently from bbd3835 to 06c94ec Compare December 11, 2023 08:50
useSafeK8sGet(StorageClusterModel, null, odfNamespace);
const [nodes, nodesLoaded, nodesLoadError] = useK8sList<NodeKind>(NodeModel);
const failureDomains =
nodesLoaded && !nodesLoadError ? groupNodesByZones(nodes)?.length : [];
Copy link
Collaborator

@SanjalKatiyar SanjalKatiyar Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not for this PR, but make sense to rename the function later...

Suggested change
nodesLoaded && !nodesLoadError ? groupNodesByZones(nodes)?.length : [];
nodesLoaded && !nodesLoadError ? groupNodesByFailureDomain(nodes)?.length : [];

Copy link
Collaborator

@SanjalKatiyar SanjalKatiyar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@agarwal-mudit
Copy link
Member

/retest

1 similar comment
@agarwal-mudit
Copy link
Member

/retest

@SanjalKatiyar
Copy link
Collaborator

SanjalKatiyar commented Dec 11, 2023

CI un-blocked by: #1125 (PR#1125 is needed because of OCP react-router-dom updates, else components using imports will break).

@SanjalKatiyar
Copy link
Collaborator

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Dec 12, 2023
Copy link
Contributor

openshift-ci bot commented Dec 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bipuladh, SanjalKatiyar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [SanjalKatiyar,bipuladh]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 79af2c7 into red-hat-storage:master Dec 12, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants