Skip to content

Commit

Permalink
Merge pull request openshift#9940 from vbnrh/lso-alert-text-fix
Browse files Browse the repository at this point in the history
Bug 1997461: Fixes LSO alert for StorageSystem installation

Signed-off-by: Afreen Rahman <afrahman@redhat.com>
  • Loading branch information
openshift-merge-robot authored and Afreen Rahman committed Sep 1, 2021
2 parents 4b57912 + 8d3df28 commit 37ec1bc
Show file tree
Hide file tree
Showing 13 changed files with 238 additions and 166 deletions.
Expand Up @@ -203,7 +203,7 @@
"Disks limit will set the maximum number of PVs to create on a node. If the field is empty we will create PVs for all available disks on the matching nodes.": "Disks limit will set the maximum number of PVs to create on a node. If the field is empty we will create PVs for all available disks on the matching nodes.",
"All": "All",
"Local Storage Operator not installed": "Local Storage Operator not installed",
"Before we can create a StorageCluster, the Local Storage Operator needs to be installed. When installation is finished come back to OpenShift Container Storage to create a StorageCluster.<1><0>Install</0></1>": "Before we can create a StorageCluster, the Local Storage Operator needs to be installed. When installation is finished come back to OpenShift Container Storage to create a StorageCluster.<1><0>Install</0></1>",
"Before we can create a StorageSystem, the Local Storage Operator needs to be installed. When installation is finished come back to OpenShift Data Foundation to create a StorageSystem.<1><0>Install</0></1>": "Before we can create a StorageSystem, the Local Storage Operator needs to be installed. When installation is finished come back to OpenShift Data Foundation to create a StorageSystem.<1><0>Install</0></1>",
"Checking Local Storage Operator installation": "Checking Local Storage Operator installation",
"Discovering disks on all hosts. This may take a few minutes.": "Discovering disks on all hosts. This may take a few minutes.",
"Minimum Node Requirement": "Minimum Node Requirement",
Expand Down
Expand Up @@ -5,7 +5,7 @@ import { Form, FormSelect, FormSelectOption, FormSelectProps, Radio } from '@pat
import { useFlag } from '@console/shared/src';
import { StorageClassDropdown } from '@console/internal/components/utils/storage-class-dropdown';
import { ListKind, StorageClassResourceKind } from '@console/internal/module/k8s';
import { StorageClassModel } from '@console/internal/models';
import { InfrastructureModel, StorageClassModel } from '@console/internal/models';
import { useK8sGet } from '@console/internal/components/utils/k8s-get-hook';
import { AdvancedSection } from './advanced-section';
import { SUPPORTED_EXTERNAL_STORAGE } from '../../external-storage';
Expand All @@ -23,6 +23,8 @@ import { NO_PROVISIONER } from '../../../../constants';
import './backing-storage-step.scss';
import { GUARDED_FEATURES } from '../../../../features';

const RHCS_SUPPORTED_INFRA = ['BareMetal', 'None', 'VSphere', 'OpenStack', 'oVirt', 'IBMCloud'];

const ExternalSystemSelection: React.FC<ExternalSystemSelectionProps> = ({
dispatch,
stepIdReached,
Expand Down Expand Up @@ -113,18 +115,21 @@ export const BackingStorage: React.FC<BackingStorageProps> = ({
const [sc, scLoaded, scLoadError] = useK8sGet<ListKind<StorageClassResourceKind>>(
StorageClassModel,
);
const [infra, infraLoaded, infraLoadError] = useK8sGet<any>(InfrastructureModel, 'cluster');
const isMCGStandalone = useFlag(GUARDED_FEATURES.ODF_MCG_STANDALONE);

const formattedSS: StorageSystemSet = formatStorageSystemList(storageSystems);

const hasOCS: boolean = formattedSS.has(STORAGE_CLUSTER_SYSTEM_KIND);

const allowedExternalStorage: ExternalStorage[] = SUPPORTED_EXTERNAL_STORAGE.filter(
({ model }) => {
const kind = getStorageSystemKind(model);
return !formattedSS.has(kind);
},
);
const infraType = infra?.spec?.platformSpec?.type;
const enableRhcs = RHCS_SUPPORTED_INFRA.includes(infraType);

const allowedExternalStorage: ExternalStorage[] =
!enableRhcs || hasOCS
? SUPPORTED_EXTERNAL_STORAGE.filter(
({ model }) => getStorageSystemKind(model) !== STORAGE_CLUSTER_SYSTEM_KIND,
)
: SUPPORTED_EXTERNAL_STORAGE;

const { type, externalStorage, deployment, isAdvancedOpen } = state;

Expand All @@ -135,28 +140,38 @@ export const BackingStorage: React.FC<BackingStorageProps> = ({
*/
if (hasOCS && allowedExternalStorage.length) {
dispatch({ type: 'backingStorage/setType', payload: BackingStorageType.EXTERNAL });
if (!storageClass.name)
dispatch({
type: 'wizard/setStorageClass',
payload: {
name: '',
provisioner: '',
},
});
}
}, [dispatch, allowedExternalStorage.length, hasOCS]);
}, [dispatch, allowedExternalStorage.length, hasOCS, storageClass.name]);

React.useEffect(() => {
/*
* Allow pre selecting the "create new storage class" option instead of the "existing" option
* if no storage classes present. This is true for a baremetal platform.
*/
if (sc?.items?.length === 0 && deployment === DeploymentType.FULL) {
if (
sc?.items?.length === 0 &&
deployment === DeploymentType.FULL &&
type !== BackingStorageType.EXTERNAL
) {
dispatch({ type: 'backingStorage/setType', payload: BackingStorageType.LOCAL_DEVICES });
if (!storageClass.name)
dispatch({
type: 'wizard/setStorageClass',
payload: {
name: '',
provisioner: NO_PROVISIONER,
},
});
}
}, [deployment, dispatch, sc]);

React.useEffect(() => {
/* Update storage class state when existing storage class is not selected. */
if (type === BackingStorageType.LOCAL_DEVICES || type === BackingStorageType.EXTERNAL) {
dispatch({
type: 'wizard/setStorageClass',
payload: { name: '', provisioner: NO_PROVISIONER },
});
}
}, [dispatch, type]);
}, [deployment, dispatch, sc, storageClass.name, type]);

const showExternalStorageSelection =
type === BackingStorageType.EXTERNAL && allowedExternalStorage.length;
Expand All @@ -165,18 +180,31 @@ export const BackingStorage: React.FC<BackingStorageProps> = ({
const RADIO_GROUP_NAME = 'backing-storage-radio-group';

const onRadioSelect = (_, event) => {
dispatch({ type: 'backingStorage/setType', payload: event.target.value });
if (stepIdReached !== 1) {
/*
* Reset the wizard when user has selected a new deployment flow
* and has not visited any step other than first step.
*/
dispatch({ type: 'wizard/setInitialState' });
}
/* Update storage class state when existing storage class is not selected. */
if (type === BackingStorageType.LOCAL_DEVICES) {
dispatch({
type: 'wizard/setStorageClass',
payload: {
name: '',
provisioner: NO_PROVISIONER,
},
});
}
dispatch({ type: 'backingStorage/setType', payload: event.target.value });
};

return (
<ErrorHandler error={error || scLoadError} loaded={loaded && scLoaded}>
<ErrorHandler
error={error || scLoadError || infraLoadError}
loaded={loaded && scLoaded && infraLoaded}
>
<Form>
<Radio
label={t('ceph-storage-plugin~Use an existing storage class')}
Expand Down
Expand Up @@ -91,9 +91,8 @@ export const LSOInstallAlert = () => {
isInline
>
<Trans t={t} ns="ceph-storage-plugin">
Before we can create a StorageCluster, the Local Storage Operator needs to be installed.
When installation is finished come back to OpenShift Container Storage to create a
StorageCluster.
Before we can create a StorageSystem, the Local Storage Operator needs to be installed. When
installation is finished come back to OpenShift Data Foundation to create a StorageSystem.
<div className="ceph-ocs-install__lso-alert__button">
<Button type="button" variant="primary" onClick={goToLSOInstallationPage}>
Install
Expand Down
@@ -1,4 +1,5 @@
import * as React from 'react';
import * as _ from 'lodash';
import { useTranslation } from 'react-i18next';
import { TextContent, Text, TextVariants, List, ListItem } from '@patternfly/react-core';
import { useFlag } from '@console/shared/src';
Expand Down Expand Up @@ -35,13 +36,17 @@ export const ReviewAndCreate: React.FC<ReviewAndCreateProps> = ({ state }) => {
securityAndNetwork,
createLocalVolumeSet,
backingStorage,
connectionDetails,
createStorageClass,
nodes,
} = state;
const { capacity, arbiterLocation, enableArbiter } = capacityAndNodes;
const { encryption, kms, networkType } = securityAndNetwork;
const { deployment, externalStorage, type } = backingStorage;

const isMCG = deployment === DeploymentType.MCG;
const isRhcs = !_.isEmpty(connectionDetails);
const isNonRhcsExternal = !_.isEmpty(createStorageClass);

const isNoProvisioner = storageClass.provisioner === NO_PROVISIONER;
const formattedCapacity = !isNoProvisioner
Expand All @@ -65,7 +70,7 @@ export const ReviewAndCreate: React.FC<ReviewAndCreateProps> = ({ state }) => {
return (
<>
<ReviewItem title={t('ceph-storage-plugin~Backing storage')}>
{!isMCG && (
{!isMCG && !isRhcs && (
<ListItem>
{t('ceph-storage-plugin~StorageClass: {{name}}', {
name: storageClass.name || createLocalVolumeSet.volumeSetName,
Expand All @@ -85,7 +90,7 @@ export const ReviewAndCreate: React.FC<ReviewAndCreateProps> = ({ state }) => {
</ListItem>
)}
</ReviewItem>
{!isMCG && (
{!isMCG && !isRhcs && !isNonRhcsExternal && (
<ReviewItem title={t('ceph-storage-plugin~Capacity and nodes')}>
<ListItem>
{t('ceph-storage-plugin~Cluster capacity: {{capacity}}', {
Expand Down Expand Up @@ -119,36 +124,38 @@ export const ReviewAndCreate: React.FC<ReviewAndCreateProps> = ({ state }) => {
)}
</ReviewItem>
)}
{isMCG ? (
<ReviewItem title={t('ceph-storage-plugin~Security')}>
<ListItem>{t('ceph-storage-plugin~Encryption: Enabled')}</ListItem>
<ListItem>
{t('ceph-storage-plugin~External key management service: {{kmsStatus}}', {
kmsStatus,
})}
</ListItem>
</ReviewItem>
) : (
<ReviewItem title={t('ceph-storage-plugin~Security and network')}>
<ListItem>
{t('ceph-storage-plugin~Encryption: {{encryptionStatus}}', { encryptionStatus })}
</ListItem>
{hasEncryption && (
{!isRhcs &&
!isNonRhcsExternal &&
(isMCG ? (
<ReviewItem title={t('ceph-storage-plugin~Security')}>
<ListItem>{t('ceph-storage-plugin~Encryption: Enabled')}</ListItem>
<ListItem>
{t('ceph-storage-plugin~External key management service: {{kmsStatus}}', {
kmsStatus,
})}
</ListItem>
)}
{isMultusSupported && (
</ReviewItem>
) : (
<ReviewItem title={t('ceph-storage-plugin~Security and network')}>
<ListItem>
{t('ceph-storage-plugin~Network: {{networkType}}', {
networkType: NetworkTypeLabels[networkType],
})}
{t('ceph-storage-plugin~Encryption: {{encryptionStatus}}', { encryptionStatus })}
</ListItem>
)}
</ReviewItem>
)}
{hasEncryption && (
<ListItem>
{t('ceph-storage-plugin~External key management service: {{kmsStatus}}', {
kmsStatus,
})}
</ListItem>
)}
{isMultusSupported && (
<ListItem>
{t('ceph-storage-plugin~Network: {{networkType}}', {
networkType: NetworkTypeLabels[networkType],
})}
</ListItem>
)}
</ReviewItem>
))}
</>
);
};
Expand Down
Expand Up @@ -7,5 +7,5 @@
}

.odf-connection-details__helper-text {
padding-top: 0.2rem;
padding-top: var(--pf-global--spacer--xs);
}

0 comments on commit 37ec1bc

Please sign in to comment.