-
Notifications
You must be signed in to change notification settings - Fork 31
[RHSTOR-7189] Implement Multus network isolation acknowledgment flow #2110
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.odf-multus-indent { | ||
margin-left: 1rem; | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -17,9 +17,16 @@ import { | |||||
WatchK8sResults, | ||||||
} from '@openshift-console/dynamic-plugin-sdk'; | ||||||
import { SelectOption } from '@patternfly/react-core/deprecated'; | ||||||
import { flatMap } from 'lodash-es'; | ||||||
import * as _ from 'lodash-es'; | ||||||
import { Checkbox, FormGroup } from '@patternfly/react-core'; | ||||||
import { | ||||||
Alert, | ||||||
AlertVariant, | ||||||
Checkbox, | ||||||
FormGroup, | ||||||
} from '@patternfly/react-core'; | ||||||
import { WizardState } from '../../reducer'; | ||||||
import './multus.scss'; | ||||||
|
||||||
type MultusWatchResourcesObject = { | ||||||
multus: NetworkAttachmentDefinitionKind[]; | ||||||
|
@@ -52,6 +59,8 @@ type MultusNetworkConfigurationComponentProps = { | |||||
clusterNetwork: NetworkAttachmentDefinitionKind; | ||||||
publicNetwork: NetworkAttachmentDefinitionKind; | ||||||
systemNamespace: WizardState['backingStorage']['systemNamespace']; | ||||||
isMultusAcknowledged: boolean; | ||||||
setIsMultusAcknowledged: (val: boolean) => void; | ||||||
}; | ||||||
|
||||||
const reduceResourceLoadAndErrorStatus = < | ||||||
|
@@ -80,35 +89,110 @@ export const MultusNetworkConfigurationComponent: React.FC< | |||||
publicNetwork, | ||||||
networkType, | ||||||
systemNamespace, | ||||||
isMultusAcknowledged, | ||||||
setIsMultusAcknowledged, | ||||||
}) => { | ||||||
const { t } = useCustomTranslation(); | ||||||
const handleMultusToggle = (_event: any, checked: any) => { | ||||||
setNetworkType(checked ? NetworkType.MULTUS : NetworkType.DEFAULT); | ||||||
if (!checked) { | ||||||
setIsMultusAcknowledged(false); | ||||||
} | ||||||
}; | ||||||
|
||||||
const handleAcknowledgementChange = (_event: any, checked: boolean) => { | ||||||
setIsMultusAcknowledged(checked); | ||||||
}; | ||||||
|
||||||
return ( | ||||||
<> | ||||||
<Checkbox | ||||||
isChecked={networkType === NetworkType.MULTUS} | ||||||
onChange={() => | ||||||
setNetworkType( | ||||||
networkType === NetworkType.DEFAULT | ||||||
? NetworkType.MULTUS | ||||||
: NetworkType.DEFAULT | ||||||
) | ||||||
} | ||||||
label={t('Isolate network using Multus')} | ||||||
description={t( | ||||||
'Multus allows a network seperation between the data operations and the control plane operations.' | ||||||
<div className="odf-multus-configuration"> | ||||||
{/* Network Section */} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
<h2 className="odf-section-header">{t('Network')}</h2> | ||||||
<Alert | ||||||
data-test="odf-default-network-alert" | ||||||
className="odf-alert odf-mb-md" | ||||||
title={t('Data Foundation will use the default pod network')} | ||||||
variant={AlertVariant.info} | ||||||
isInline | ||||||
> | ||||||
{t( | ||||||
'If you require a custom network configuration, you can modify the network settings after deployment.' | ||||||
)} | ||||||
id="multus-checkbox" | ||||||
/> | ||||||
{networkType === NetworkType.MULTUS && ( | ||||||
<MultusDropdown | ||||||
setNetwork={setNetwork} | ||||||
clusterNetwork={clusterNetwork} | ||||||
publicNetwork={publicNetwork} | ||||||
systemNamespace={systemNamespace} | ||||||
</Alert> | ||||||
|
||||||
{/* Isolate Network Section */} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems not necessary as the header text already explains it.
Suggested change
|
||||||
<h2 className="odf-section-header odf-mt-lg">{t('Isolate Network')}</h2> | ||||||
<div className="odf-indented-section"> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In clean code, intentional naming is about your domain (your business concepts, like "Multus"), not formatting details like "indentation".
Suggested change
|
||||||
<Checkbox | ||||||
isChecked={networkType === NetworkType.MULTUS} | ||||||
onChange={handleMultusToggle} | ||||||
label={t('Isolate network using Multus')} | ||||||
description={t( | ||||||
'Multus allows a network separation between the data operations and the control plane operations.' | ||||||
)} | ||||||
id="multus-checkbox" | ||||||
className="odf-mb-md" | ||||||
/> | ||||||
)} | ||||||
</> | ||||||
|
||||||
{networkType === NetworkType.MULTUS && ( | ||||||
<> | ||||||
<div className="odf-multus-indent pf-v5-u-mt-md"> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
<Alert | ||||||
variant={AlertVariant.warning} | ||||||
isInline | ||||||
title={t( | ||||||
'This will isolate network to attach additional clusters as external clients. Run Validation test before to proceed further.' | ||||||
)} | ||||||
> | ||||||
<p> | ||||||
{t( | ||||||
'Set up Multus by following relevant steps in KCS. Incorrectly setting up Multus might lead to:' | ||||||
)} | ||||||
</p> | ||||||
<ul> | ||||||
<li> | ||||||
{t( | ||||||
'Data unavailability or loss due to broken internal communication' | ||||||
)} | ||||||
</li> | ||||||
<li> | ||||||
{t( | ||||||
'Cluster health issues if network attachments are misconfigured' | ||||||
)} | ||||||
</li> | ||||||
<li> | ||||||
{t('PVC mounting failures for ODF-dependent workloads')} | ||||||
</li> | ||||||
</ul> | ||||||
</Alert> | ||||||
</div> | ||||||
|
||||||
<div className="odf-multus-indent"> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
<Checkbox | ||||||
isChecked={isMultusAcknowledged} | ||||||
label={t( | ||||||
'By checking this box, you acknowledge running the validation test' | ||||||
)} | ||||||
onChange={handleAcknowledgementChange} | ||||||
id="acknowledgment-checkbox" | ||||||
className="odf-mb-md" | ||||||
/> | ||||||
</div> | ||||||
|
||||||
{isMultusAcknowledged && ( | ||||||
<div className="odf-indented-section"> | ||||||
<MultusDropdown | ||||||
setNetwork={setNetwork} | ||||||
clusterNetwork={clusterNetwork} | ||||||
publicNetwork={publicNetwork} | ||||||
systemNamespace={systemNamespace} | ||||||
/> | ||||||
</div> | ||||||
)} | ||||||
</> | ||||||
)} | ||||||
</div> | ||||||
</div> | ||||||
); | ||||||
}; | ||||||
|
||||||
|
@@ -154,7 +238,7 @@ export const MultusDropdown: React.FC<MultusDropdownProps> = ({ | |||||
}); | ||||||
|
||||||
if (resourcesLoaded && !resourcesLoadError) { | ||||||
const devices = _.flatMap( | ||||||
const devices = flatMap( | ||||||
Object.values(networkResources), | ||||||
(res) => res.data | ||||||
); | ||||||
|
Uh oh!
There was an error while loading. Please reload this 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.
This is unnecessary as we're already importing
* as 'lodash-es'
in the following line.