-
Notifications
You must be signed in to change notification settings - Fork 667
OCS installation changes for baremetal infra #5016
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
OCS installation changes for baremetal infra #5016
Conversation
|
A screenshot and description might help. |
7fa73e6 to
d79991a
Compare
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.
What if new PV's comes in while being on a page?
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.
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.
Seems like you have pasted wrong link here @cloudbehl
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.
getPVStorageClass function on line 23.
The GitHub seems buggy in this case.
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.
use optional chaining
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.
Can you reduce the complexity?
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.
Also, use optional chaining.
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.
We should show Not available
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.
if we are not able to get the capacity then ideally it should be not available
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
frontend/public/module/k8s/types.ts
Outdated
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.
why this change? We should use StorageClassKind object?
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.
Shouldn't catch be after then?
| .catch(() => []) | |
| .catch(() => []) |
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.
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.
| {isNoProvisionerSC && ( | |
| {isNoProvisionerSC ? () : ()} |
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.
| .catch(() => []) |
This catch is 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.
use classNames
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.
| if (_.isEqual(provisioner, 'kubernetes.io/no-provisioner')) { | |
| if (provisioner === 'kubernetes.io/no-provisioner') { |
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.
is there any reason of using this over _.isEqual
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.
Any reason we are using '0 TiB' as the initial value? Why TiB?
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.
| setPVsAvailableCapacity(humanizeBinaryBytes(calcPVsCapacity(pvs)).string); | |
| const availableCapacity = humanizeBinaryBytes(calcPVsCapacity(pvs)).string; | |
| setPVsAvailableCapacity(availableCapacity); |
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.
| 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.
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.
| (provisioner: string) => !_.get(sc, 'provisioner').includes(provisioner), | |
| (provisioner: string) => ! sc?.provisioner?.includes(provisioner), |
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 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.
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.
handleStorageClass is called on onChange method and it accepts 2 params. Look carefully.
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.
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.
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.
It has been changed with this PR. See this - https://github.com/openshift/console/pull/5016/files#diff-10211f95caf12c0c4e086214ec83e140R326
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 will cause problems with the existing code.
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.
same as above
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.
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.
Consider another approach for getting this information. Changing storageClass data from string to K8sCommon should do the trick.
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.
Why do you think another approach is required here?
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.
d79991a to
90befa9
Compare
ff705bc to
0adb062
Compare
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 [pvsAvailableCapacity, setPVsAvailableCapacity] = React.useState<string | number>( | |
| const [pvsAvailableCapacity, setPVsAvailableCapacity] = React.useState<React.ReatText>( |
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 [pvsAvailableCapacity, setPVsAvailableCapacity] = React.useState<string | number>( | |
| const [pvsAvailableCapacity, setPVsAvailableCapacity] = React.useState<React.ReactText>( |
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 [storageClass, setStorageClass] = React.useState(null); | |
| const [storageClass, setStorageClass] = React.useState<K8sResourceCommon>(null); |
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.
| storageClass?.provisioner === noProvisioner | |
| ? '' | |
| : 'ceph-add-capacity_sc-dropdown__margin', | |
| {'ceph-add-capacity_sc-dropdown__margin': storageClass?.provisioner === noProvisioner} |
...packages/ceph-storage-plugin/src/components/modals/add-capacity-modal/add-capacity-modal.tsx
Outdated
Show resolved
Hide resolved
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.
for watching, I guess we can declare this resource where it is being used. Is this used for the useK8sWatchResource hook?
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 used at two places and this separate file is being created for defining resources. Hence, its preferable to define here.
21b3f14 to
cf6273f
Compare
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.
| .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.
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 for the modifier. But we don't need to have it nested since we are already following BEM structure
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 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/
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 know that. I am just referring to Sam's comment here - #3927 (comment)
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.
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.
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 am curious. Can this field ever be not present in a StorageClassResource @cloudbehl ?
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.
It will be present always. I will remove it.
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.
| storageClass?.provisioner === NO_PROVISIONER | |
| ? '' | |
| : 'ceph-add-capacity_sc-dropdown__margin', | |
| )} | |
| {'ceph-add-capacity_sc-dropdown--margin': storageClass?.provisioner === NO_PROVISIONER}, | |
| )} |
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.
What about this text ? we must modify this too.
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.
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.
Why not leverage the enum you created here ?
| pvsData.filter((pv) => getPVStorageClass(pv) === sc && pv.status?.phase === 'Available'); | |
| pvsData.filter((pv) => getPVStorageClass(pv) === sc && pv.status?.phase === pvsCapacityState.Available); |
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.
pvsCapacityState is for storing capacity states, not for pvs status. These are two different things.
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 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.
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.
We must follow BEM convention
| .ceph-add-capacity_sc-dropdown__margin { | |
| .ceph-add-capacity__sc-dropdown--margin { |
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.
Move this up along with other hooks.
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 its just a string, any reason for using React.ReactText ?
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.
it can be both, a number and string
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.
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>
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 feel, this approach looks much cleaner as we can avoid these conditional elements.
...packages/ceph-storage-plugin/src/components/modals/add-capacity-modal/add-capacity-modal.tsx
Outdated
Show resolved
Hide resolved
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.
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.
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. We can take this up in a follow up PR.
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.
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'
}
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.
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
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.
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.
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 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.
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.
Any reason for using lodash ?
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.
correct this too
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.
what needs to corrected here?
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.
ceph-add-capacity__sc-dropdown , as per the convention.
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.
Dont you need to put loading boxes instead of text ?
22bde29 to
31c83d3
Compare
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.
Note: ? is required as initially storageclass is not being set.
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.
Here and at few other places too. Feel free to check.
31c83d3 to
a6cd590
Compare
|
/retest Please review the full test history for this PR and help us cut down flakes. |
4 similar comments
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
9eca200 to
2526bf8
Compare
2526bf8 to
169e785
Compare
|
/retest |
|
/test e2e-gcp-console |
169e785 to
219d509
Compare
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 isBound = (pvc: K8sResourceKind) => _.get(pvc, 'status.phase') === status.BOUND; | |
| const isBound = (pvc: K8sResourceKind) => pvc.status.phase === status.BOUND; |
219d509 to
351d269
Compare
|
/lgtm |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/test e2e-gcp-console |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest |
1 similar comment
|
/retest |
|
/hold |
|
/hold cancel |
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) -

