Skip to content

Conversation

@gnehapk
Copy link
Contributor

@gnehapk gnehapk commented Apr 13, 2020

With OCS Baremetal cluster support in picture, following changes are required in ocs installation and add-capacity view -
For no-provisioner storage class(created by LSO flow), requested capacity should not be shown as dynamically provision of storage is not possible

Views look like below(for baremetal infra) -
ocs-install-baremetal
add-capacity

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 13, 2020
@openshift-ci-robot openshift-ci-robot added component/ceph Related to ceph-storage-plugin component/core Related to console core functionality labels Apr 13, 2020
@afreen23
Copy link

A screenshot and description might help.

@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 13, 2020
Comment on lines 64 to 73
Copy link
Contributor

Choose a reason for hiding this comment

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

What if new PV's comes in while being on a page?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like you have pasted wrong link here @cloudbehl

Copy link
Contributor

Choose a reason for hiding this comment

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

getPVStorageClass function on line 23.

The GitHub seems buggy in this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

use optional chaining

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you reduce the complexity?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, use optional chaining.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should show Not available

Copy link
Contributor

Choose a reason for hiding this comment

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

if we are not able to get the capacity then ideally it should be not available

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack

Copy link
Contributor

Choose a reason for hiding this comment

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

why this change? We should use StorageClassKind object?

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't catch be after then?

Suggested change
.catch(() => [])
.catch(() => [])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not necessary

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
{isNoProvisionerSC && (
{isNoProvisionerSC ? () : ()}

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
.catch(() => [])

This catch is not necessary.

Comment on lines 112 to 115
Copy link
Contributor

Choose a reason for hiding this comment

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

use classNames

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
if (_.isEqual(provisioner, 'kubernetes.io/no-provisioner')) {
if (provisioner === 'kubernetes.io/no-provisioner') {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is there any reason of using this over _.isEqual

Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason we are using '0 TiB' as the initial value? Why TiB?

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
setPVsAvailableCapacity(humanizeBinaryBytes(calcPVsCapacity(pvs)).string);
const availableCapacity = humanizeBinaryBytes(calcPVsCapacity(pvs)).string;
setPVsAvailableCapacity(availableCapacity);

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
if (_.isEqual(provisioner, 'kubernetes.io/no-provisioner')) {
if ( provisioner === 'kubernetes.io/no-provisioner')) {

This is the second place I am seeing this being used. Consider putting no-provisioner in the consts file.

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
(provisioner: string) => !_.get(sc, 'provisioner').includes(provisioner),
(provisioner: string) => ! sc?.provisioner?.includes(provisioner),

Comment on lines 36 to 37
Copy link
Contributor

Choose a reason for hiding this comment

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

This would cause problems in the node-list page where you're directly applying this to the setState and it only expects one argument and not two.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

handleStorageClass is called on onChange method and it accepts 2 params. Look carefully.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please look at https://github.com/openshift/console/blob/master/frontend/packages/ceph-storage-plugin/src/components/ocs-install/node-list.tsx#L329
It's directly connected to the dispatcher which takes only 1 prop. This is an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

This will cause problems with the existing code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Consider another approach for getting this information. Changing storageClass data from string to K8sCommon should do the trick.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do you think another approach is required here?

Copy link
Contributor

Choose a reason for hiding this comment

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 14, 2020
@gnehapk gnehapk force-pushed the baremetal-flows branch 2 times, most recently from ff705bc to 0adb062 Compare April 14, 2020 15:01
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
const [pvsAvailableCapacity, setPVsAvailableCapacity] = React.useState<string | number>(
const [pvsAvailableCapacity, setPVsAvailableCapacity] = React.useState<React.ReatText>(

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
const [pvsAvailableCapacity, setPVsAvailableCapacity] = React.useState<string | number>(
const [pvsAvailableCapacity, setPVsAvailableCapacity] = React.useState<React.ReactText>(

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
const [storageClass, setStorageClass] = React.useState(null);
const [storageClass, setStorageClass] = React.useState<K8sResourceCommon>(null);

Comment on lines 122 to 124
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
storageClass?.provisioner === noProvisioner
? ''
: 'ceph-add-capacity_sc-dropdown__margin',
{'ceph-add-capacity_sc-dropdown__margin': storageClass?.provisioner === noProvisioner}

Comment on lines 12 to 18
Copy link
Contributor

Choose a reason for hiding this comment

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

for watching, I guess we can declare this resource where it is being used. Is this used for the useK8sWatchResource hook?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is used at two places and this separate file is being created for defining resources. Hence, its preferable to define here.

@gnehapk gnehapk force-pushed the baremetal-flows branch 2 times, most recently from 21b3f14 to cf6273f Compare April 15, 2020 10:43
@gnehapk gnehapk changed the title [WIP] OCS installation changes for baremetal infra OCS installation changes for baremetal infra Apr 15, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 15, 2020
Comment on lines 33 to 38
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
.ceph-add-capacity_sc-dropdown {
width: 16rem;
}
.ceph-add-capacity_sc-dropdown__margin {
margin-bottom: 1rem;
}
.ceph-add-capacity_sc-dropdown {
width: 16rem;
&--margin {
margin-bottom: 1rem;
}
}

A modifier makes more sense to me here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack for the modifier. But we don't need to have it nested since we are already following BEM structure

Copy link
Contributor

Choose a reason for hiding this comment

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

This compiles down to .cpeh-add-capacity__sc-dropdown--margin and .ceph-add-capcity__sc-dropdown. BEM is a naming conventiion. &-- helps us manage the modifier easily.
https://css-tricks.com/using-sass-control-scope-bem-naming/

Copy link
Contributor Author

@gnehapk gnehapk Apr 15, 2020

Choose a reason for hiding this comment

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

I know that. I am just referring to Sam's comment here - #3927 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

His comment and this is really different. I am not asking you to nest two classes. I am suggesting define a modifier block in a different manner.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am curious. Can this field ever be not present in a StorageClassResource @cloudbehl ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will be present always. I will remove it.

Comment on lines 122 to 125
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
storageClass?.provisioner === NO_PROVISIONER
? ''
: 'ceph-add-capacity_sc-dropdown__margin',
)}
{'ceph-add-capacity_sc-dropdown--margin': storageClass?.provisioner === NO_PROVISIONER},
)}

Choose a reason for hiding this comment

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

What about this text ? we must modify this too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Why not leverage the enum you created here ?

Suggested change
pvsData.filter((pv) => getPVStorageClass(pv) === sc && pv.status?.phase === 'Available');
pvsData.filter((pv) => getPVStorageClass(pv) === sc && pv.status?.phase === pvsCapacityState.Available);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pvsCapacityState is for storing capacity states, not for pvs status. These are two different things.

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 could have created an enum for pvs state, but it doesn't make sense create it just one state Available used at only one place.

Choose a reason for hiding this comment

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

We must follow BEM convention

Suggested change
.ceph-add-capacity_sc-dropdown__margin {
.ceph-add-capacity__sc-dropdown--margin {

Choose a reason for hiding this comment

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

Move this up along with other hooks.

Choose a reason for hiding this comment

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

I see its just a string, any reason for using React.ReactText ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it can be both, a number and string

Choose a reason for hiding this comment

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

IMO we can keep it as number only and for other states add elements conditionally.

Not available: <div className="text-muted">Not Available</div>
Loading: <div className="skeleton-text"></div>

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 feel, this approach looks much cleaner as we can avoid these conditional elements.

Comment on lines 129 to 137

Choose a reason for hiding this comment

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

May be you can consider moving this to a separate component, so that PVs will be fetched only in case of baremetal.
Also its required at two places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack. We can take this up in a follow up PR.

Copy link

@afreen23 afreen23 Apr 15, 2020

Choose a reason for hiding this comment

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

Can you create an enum/obj of osd sizes in osd-size-dropdown.tsx and then use those values. I see we need these values often now.

something like this:

const SUPPORTED_OSD = {
  'Small' ='512Gi',
  'Medium'='2Ti',
  'Large' = '4Ti',
  'Baremetal' = '1'
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is already an enum OSD_CAPACITY_SIZES for these supported sizes. Make sense to create jsut for default osd sizes i.e. 2Ti and 1

Choose a reason for hiding this comment

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

Okay but we can modify that too, lets keep all supported configuration at one place.
We can use these enums in that too and that way we only need to change at one place, when changes are required.

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 structure is different and I don't think its a good idea to mix for two different things. I have already created defaultRequestSize enum for handling the default request size.

Copy link

@afreen23 afreen23 Apr 15, 2020

Choose a reason for hiding this comment

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

Any reason for using lodash ?

Choose a reason for hiding this comment

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

correct this too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what needs to corrected here?

Choose a reason for hiding this comment

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

ceph-add-capacity__sc-dropdown , as per the convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack

Choose a reason for hiding this comment

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

Dont you need to put loading boxes instead of text ?

@gnehapk gnehapk force-pushed the baremetal-flows branch 3 times, most recently from 22bde29 to 31c83d3 Compare April 16, 2020 06:46
Copy link
Contributor Author

@gnehapk gnehapk Apr 16, 2020

Choose a reason for hiding this comment

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

Note: ? is required as initially storageclass is not being set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here and at few other places too. Feel free to check.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

4 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Apr 17, 2020
@cloudbehl
Copy link
Contributor

/retest

@gnehapk
Copy link
Contributor Author

gnehapk commented Apr 17, 2020

/test e2e-gcp-console

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
const isBound = (pvc: K8sResourceKind) => _.get(pvc, 'status.phase') === status.BOUND;
const isBound = (pvc: K8sResourceKind) => pvc.status.phase === status.BOUND;

@cloudbehl
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 17, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afreen23, bipuladh, cloudbehl, gnehapk

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

The pull request process is described here

Details Needs approval from an approver in each of these files:

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

@gnehapk
Copy link
Contributor Author

gnehapk commented Apr 17, 2020

/test e2e-gcp-console

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@gnehapk
Copy link
Contributor Author

gnehapk commented Apr 17, 2020

/retest

1 similar comment
@a2batic
Copy link
Contributor

a2batic commented Apr 17, 2020

/retest

@spadgett
Copy link
Member

/hold
for #5100

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 17, 2020
@spadgett
Copy link
Member

/hold cancel
/retest

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 17, 2020
@openshift-merge-robot openshift-merge-robot merged commit df9cfad into openshift:master Apr 18, 2020
@spadgett spadgett added this to the v4.5 milestone Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/ceph Related to ceph-storage-plugin component/core Related to console core functionality lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants