-
Notifications
You must be signed in to change notification settings - Fork 31
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
refactoring (support multiple StorageSystems per ODF) #1106
refactoring (support multiple StorageSystems per ODF) #1106
Conversation
SanjalKatiyar
commented
Nov 23, 2023
•
edited
Loading
edited
- Removed OCS related flags from "features.ts" file.
- Added those flags as a part of redux store and created releated utils.
- Created Hook to read these flags.
- Updated Wizard to support multiple Ceph based clusters (only 1 internal + 1 external needed for now).
- Updated KMS resources creation utils (Secrets) so that CSI and OCS resources are de-coupled.
- Added a Namespace field to OCS wizard redux (used across entire wizard flow).
- Updated dashboards so that each StorageCluster should only show related components, not any/all (NooBaa/RGW).
- Updated StorageCluster dashboard Routes by adding Namespace as well.
- Updated all queries using "odf_system_" and "ceph_" metrics, relying on "managedBy" label for now (Block/File/Object).
- Updated StorageClass creation flow (ceph-rbd/fs) with a dropdown for corresponding StorageSystem selection.
- Updated "HealthOverview" (injected to OCP dashboard's Status card currently) to incorporate status of all Ceph clusters.
70d7ccc
to
1163588
Compare
20754a1
to
c71a477
Compare
86a81cc
to
36bebf9
Compare
36bebf9
to
fc03a5a
Compare
f6c8d86
to
fd93a4c
Compare
const OCS_INTERNAL_CR_NAME = 'ocs-storagecluster'; | ||
const OCS_EXTERNAL_CR_NAME = 'ocs-external-storagecluster'; |
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.
only keeping it here as this should not be used at any other place... for now name of the clusters are constant so passing them directly from this file during creation, later if needed, we should make it an user input...
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.
these constant values should not be used in any other flow, except wizard flow for cluster creation...
); | ||
const systemNamespace = getNamespace(storageSystem); | ||
const ocsHealthStatus = | ||
ocsHealthStatuses[systemName + systemNamespace]; |
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.
no separator symbol in between? just asking
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.
no need, as I don't want to separate them later into name and namespace...
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.
ok
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.
Lets use templates instead of +
return systems.reduce<SystemMetrics>((acc, curr) => { | ||
acc[curr.metadata.name] = { | ||
acc[getName(curr) + getNamespace(curr)] = { |
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 name + namespace key is used in multiple places, it is better to create one util function to form a key out of an argument with some separator symbol in between, so we can change this key format anytime. And we can easily figureout what are all the places need to be changed.
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.
ack
packages/odf/utils/odf.ts
Outdated
export const isMCGStandaloneCluster = (storageCluster: StorageClusterKind) => { | ||
return ( | ||
storageCluster?.spec?.multiCloudGateway?.reconcileStrategy === 'standalone' | ||
); | ||
}; |
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.
export const isMCGStandaloneCluster = (storageCluster: StorageClusterKind) => { | |
return ( | |
storageCluster?.spec?.multiCloudGateway?.reconcileStrategy === 'standalone' | |
); | |
}; | |
export const isMCGStandaloneCluster = (storageCluster: StorageClusterKind) => | |
storageCluster?.spec?.multiCloudGateway?.reconcileStrategy === 'standalone'; |
packages/odf/utils/odf.ts
Outdated
export const isExternalCluster = (storageCluster: StorageClusterKind) => { | ||
return !_.isEmpty(storageCluster?.spec?.externalStorage); | ||
}; |
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.
export const isExternalCluster = (storageCluster: StorageClusterKind) => { | |
return !_.isEmpty(storageCluster?.spec?.externalStorage); | |
}; | |
export const isExternalCluster = (storageCluster: StorageClusterKind) => | |
!_.isEmpty(storageCluster?.spec?.externalStorage); |
packages/odf/utils/odf.ts
Outdated
export const isClusterIgnored = (storageCluster: StorageClusterKind) => { | ||
return storageCluster?.status?.phase === 'Ignored'; | ||
}; |
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.
export const isClusterIgnored = (storageCluster: StorageClusterKind) => { | |
return storageCluster?.status?.phase === 'Ignored'; | |
}; | |
export const isClusterIgnored = (storageCluster: StorageClusterKind) => | |
storageCluster?.status?.phase === 'Ignored'; |
packages/odf/utils/odf.ts
Outdated
export const isNFSEnabled = (storageCluster: StorageClusterKind) => { | ||
return storageCluster?.spec?.nfs?.enable === true; | ||
}; |
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.
export const isNFSEnabled = (storageCluster: StorageClusterKind) => { | |
return storageCluster?.spec?.nfs?.enable === true; | |
}; | |
export const isNFSEnabled = (storageCluster: StorageClusterKind) => | |
storageCluster?.spec?.nfs?.enable === true; |
@@ -317,7 +322,7 @@ const CapacityCard: React.FC<CapacityCardProps> = ({ | |||
const isPercentage = !!item?.totalValue; | |||
return ( | |||
<CapacityCardRow | |||
key={item.name} | |||
key={item.name + item.namespace} |
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 here, better create util function to get the key with separator like name-namesapce
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 don't need a separator as I do not want to parse/separate name and namespace later... also util might not be of any use because at some components we already have access to name/namespace and we just need to combine them, other place they are the CR and some places like this one a custom object... so single util will not gonna work any way...
fd93a4c
to
2d46312
Compare
/test odf-console-e2e-aws |
1480d67
to
a37b1e1
Compare
LGTM |
CI un-blocked by: #1125 (PR#1125 is needed because of OCP react-router-dom updates, else components using imports will break). |
@@ -66,21 +62,24 @@ const CreateBlockPool: React.FC<CreateBlockPoolProps> = ({ | |||
const { t } = useCustomTranslation(); | |||
|
|||
const history = useHistory(); | |||
const { namespace: poolNs } = useParams<ODFSystemParams>(); |
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 { namespace: poolNs } = useParams<ODFSystemParams>(); | |
const { namespace } = useParams<ODFSystemParams>(); |
Lets just use namespace.
{ systemName, targetKind, clusterName, totalValue, usedValue, clusterURL }, | ||
{ | ||
systemName, | ||
namespace: systemNamespace, |
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 to rename the variable? IMO namespace is pretty clear to understand.
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 have 2 namespaces now: odfNamespace
(where ODF is installed) and systemNamespace
(where system is getting created), even though both are not used here still IMO it is good to rename things accordingly, it is harmless, rather a bit more intuitive :(
@@ -30,18 +29,15 @@ export const BlockPoolDetailsPage: React.FC<BlockPoolDetailsPageProps> = ({ | |||
|
|||
const { poolName } = match.params; | |||
const location = useLocation(); | |||
const { namespace: poolNs } = useParams<ODFSystemParams>(); |
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 { namespace: poolNs } = useParams<ODFSystemParams>(); | |
const { namespace } = useParams<ODFSystemParams>(); |
I think it is clear as it is.
@@ -226,13 +222,15 @@ const RowRenderer: React.FC<RowProps<StoragePoolKind, CustomData>> = ({ | |||
}) => { | |||
const { t } = useCustomTranslation(); | |||
|
|||
const { systemFlags } = useODFSystemFlagsSelector(); | |||
const isExternalSS = systemFlags[getNamespace(obj)]?.isExternalMode; |
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 isExternalSS = systemFlags[getNamespace(obj)]?.isExternalMode; | |
const isExternalStorageSystem = systemFlags[getNamespace(obj)]?.isExternalMode; |
}; | ||
}, [scs, ccs, coss, nss, allLoaded, anyError]); | ||
|
||
return useDeepCompareMemoize(payload); |
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.
return useDeepCompareMemoize(payload); | |
return useDeepCompareMemoize(payload, true); |
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.
that's intensional to minimise number of dispatches to the redux... payload
will not be too long or too deep object...
<div className="odf-topology__message-button"> | ||
<BlueInfoCircleIcon />{' '} | ||
{showMessage && | ||
t('This view is only supported for Internal mode cluster.')}{' '} |
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.
t('This view is only supported for Internal mode cluster.')}{' '} | |
t('This view is only supported for Internal mode cluster.')} |
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 need that extra space between this text and the show/hide button...
@@ -27,6 +27,16 @@ | |||
z-index: 2; | |||
} | |||
|
|||
.odf-topology__message-button { | |||
color: #393F44; |
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 PF variables.
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.
something which I copied from already existing class odf-topology__back-button
, just above this one... this is something which needs to be corrected once at all the places (probably is separate CSS based PR)...
hasOCS, | ||
// both internal and external exists | ||
haveMultipleClusters, |
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.
haveMultipleClusters, | |
hasMultipleClusters, |
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.
ok...
); | ||
const systemNamespace = getNamespace(storageSystem); | ||
const ocsHealthStatus = | ||
ocsHealthStatuses[systemName + systemNamespace]; |
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.
Lets use templates instead of +
const { namespace: clusterNs } = useParams<ODFSystemParams>(); | ||
const { systemFlags } = useODFSystemFlagsSelector(); | ||
const managedByOCS = systemFlags[clusterNs]?.ocsClusterName; | ||
|
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.
Lets use it as it is. Redux store is passed as a context so do we need multiple contexts?
bcafa7a
to
5b9fc91
Compare
/lgtm |
5b9fc91
to
617a945
Compare
Removed OCS related flags from "features.ts" file. Added those flags as a part of redux store and created releated utils. Created Hook to read these flags. Updated Wizard to support multiple Ceph based clusters (only 1 internal + 1 external needed for now). Updated KMS resources creation utils (Secrets) so that CSI and OCS resources are de-coupled. Added a Namespace field to OCS wizard redux (used across entire wizard flow). Updated dashboards so that each StorageCluster should only show related components, not any/all (NooBaa/RGW). Updated StorageCluster dashboard Routes by adding Namespace as well. Updated all queries using "odf_system_" and "ceph_" metrics, relying on "managedBy" label for now (Block/File/Object). Updated StorageClass creation flow (ceph-rbd/fs) with a dropdown for corresponding StorageSystem selection. Updated "HealthOverview" (injected to OCP dashboard's Status card currently) to incorporate status of all Ceph clusters.
617a945
to
5516bd9
Compare
/lgtm |
[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:
Approvers can indicate their approval by writing |
b8e0554
into
red-hat-storage:master