Skip to content
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

CNV-34895: Adding storage checkups #1598

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions console-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@
"component": {
"$codeRef": "CheckupsNetworkForm"
},
"path": ["/k8s/ns/:ns/checkups/network/form", "/k8s/all-namespaces/checkups/network/form"]
"path": ["/k8s/ns/:ns/checkups/network/form"]
},
"type": "console.page/route"
},
Expand All @@ -560,7 +560,19 @@
"component": {
"$codeRef": "CheckupsStorageForm"
},
"path": ["/k8s/ns/:ns/checkups/storage", "/k8s/all-namespaces/checkups/storage"]
"path": ["/k8s/ns/:ns/checkups/storage/form"]
},
"type": "console.page/route"
},
{
"flags": {
"required": ["KUBEVIRT"]
},
"properties": {
"component": {
"$codeRef": "CheckupsStorageDetailsPage"
},
"path": ["/k8s/ns/:ns/checkups/storage/:vmName"]
},
"type": "console.page/route"
},
Expand Down
22 changes: 22 additions & 0 deletions locales/en/plugin__kubevirt-plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@
"Collapse": "Collapse",
"Column management": "Column management",
"Complete time": "Complete time",
"Completion time": "Completion time",
"Completion timeout": "Completion timeout",
"CompletionTimeoutPerGiB is the maximum number of seconds per GiB a migration is allowed to take. If a live-migration takes longer to migrate than this value multiplied by the size of the VMI, the migration will be cancelled, unless AllowPostCopy is true. Defaults to 800. ": "CompletionTimeoutPerGiB is the maximum number of seconds per GiB a migration is allowed to take. If a live-migration takes longer to migrate than this value multiplied by the size of the VMI, the migration will be cancelled, unless AllowPostCopy is true. Defaults to 800. ",
"Compute-intensive applications": "Compute-intensive applications",
Expand Down Expand Up @@ -354,6 +355,7 @@
"Default {{resourceKind}} columns": "Default {{resourceKind}} columns",
"Default column list": "Default column list",
"Default InstanceType": "Default InstanceType",
"Default storage class": "Default storage class",
"Default templates": "Default templates",
"Default value for this parameter": "Default value for this parameter",
"Default value type": "Default value type",
Expand Down Expand Up @@ -523,6 +525,7 @@
"Go to catalog": "Go to catalog",
"Go to Catalog": "Go to Catalog",
"Go to the Virtualization Settings tab to enable this feature": "Go to the Virtualization Settings tab to enable this feature",
"Golden image not up to date": "Golden image not up to date",
"GPU devices": "GPU devices",
"GPU devices ({{gpusCount}})": "GPU devices ({{gpusCount}})",
"Guest agent is not installed on VirtualMachine": "Guest agent is not installed on VirtualMachine",
Expand All @@ -548,6 +551,7 @@
"Hot plug is enabled only for \"Disk\" type": "Hot plug is enabled only for \"Disk\" type",
"Hot plug is enabled only for \"SCSI\" interface": "Hot plug is enabled only for \"SCSI\" interface",
"Hot-Plug is a Technology Preview Feature": "Hot-Plug is a Technology Preview Feature",
"How much time before the check will try to close itself": "How much time before the check will try to close itself",
"HP series": "HP series",
"If no nodes are specified, random nodes are selected.": "If no nodes are specified, random nodes are selected.",
"If the measured latency exceeds this value, the checkup fails.": "If the measured latency exceeds this value, the checkup fails.",
Expand All @@ -560,6 +564,7 @@
"Increment": "Increment",
"Indications": "Indications",
"Info": "Info",
"Install permissions": "Install permissions",
"installation iso of Microsoft Windows 10 ": "installation iso of Microsoft Windows 10 ",
"Installed version": "Installed version",
"InstanceType": "InstanceType",
Expand Down Expand Up @@ -912,6 +917,7 @@
"Remove from list": "Remove from list",
"Remove from list will mark this volume as non-bootable. The volume will still be available in the cluster.": "Remove from list will mark this volume as non-bootable. The volume will still be available in the cluster.",
"Remove from list?": "Remove from list?",
"Remove permissions": "Remove permissions",
"Removing Resources": "Removing Resources",
"Requested of ": "Requested of ",
"Required": "Required",
Expand Down Expand Up @@ -940,6 +946,7 @@
"Run": "Run",
"Run checkup": "Run checkup",
"Run network latency checkup": "Run network latency checkup",
"Run storage checkup": "Run storage checkup",
"Running": "Running",
"Running migrations": "Running migrations",
"S series": "S series",
Expand Down Expand Up @@ -1061,16 +1068,23 @@
"Status conditions": "Status conditions",
"Stop": "Stop",
"Storage": "Storage",
"Storage checkup": "Storage checkup",
"Storage checkup details": "Storage checkup details",
"Storage checkup validating storage is working correctly for VirtualMachines using the kiagnose engine.": "Storage checkup validating storage is working correctly for VirtualMachines using the kiagnose engine.",
"Storage class": "Storage class",
"Storage Class": "Storage Class",
"Storage class with empty claimPropertySets": "Storage class with empty claimPropertySets",
"Storage IOPS": "Storage IOPS",
"Storage IOPS total read / write": "Storage IOPS total read / write",
"Storage missing VolumeSnapshotClass": "Storage missing VolumeSnapshotClass",
"Storage operator": "Storage operator",
"Storage requirements": "Storage requirements",
"Storage throughput": "Storage throughput",
"Storage total read / write": "Storage total read / write",
"Storage used": "Storage used",
"Storage with ReadWriteMany": "Storage with ReadWriteMany",
"StorageClass": "StorageClass",
"StorageProfiles with spec claimPropertySets": "StorageProfiles with spec claimPropertySets",
"Store the key in a project secret.": "Store the key in a project secret.",
"Succeeded": "Succeeded",
"Success": "Success",
Expand Down Expand Up @@ -1148,6 +1162,8 @@
"Time of login": "Time of login",
"Time range": "Time range",
"Time zone": "Time zone",
"Timeout": "Timeout",
"Timeout (minutes)": "Timeout (minutes)",
"To edit this template, contact your administrator.": "To edit this template, contact your administrator.",
"To gain unlimited bandwidth, set to 0": "To gain unlimited bandwidth, set to 0",
"To get started, install permissions and then run a checkup": "To get started, install permissions and then run a checkup",
Expand Down Expand Up @@ -1256,18 +1272,24 @@
"Virtualization Alerts donut chart": "Virtualization Alerts donut chart",
"Virtualization dashboard": "Virtualization dashboard",
"VirtualMachine": "VirtualMachine",
"VirtualMachine boot from golden image": "VirtualMachine boot from golden image",
"VirtualMachine boot order": "VirtualMachine boot order",
"VirtualMachine details": "VirtualMachine details",
"VirtualMachine hotplug volume": "VirtualMachine hotplug volume",
"VirtualMachine is currently {{ status }}": "VirtualMachine is currently {{ status }}",
"VirtualMachine is not running": "VirtualMachine is not running",
"VirtualMachine is not running.": "VirtualMachine is not running.",
"VirtualMachine labels": "VirtualMachine labels",
"VirtualMachine live migration": "VirtualMachine live migration",
"VirtualMachine name": "VirtualMachine name",
"VirtualMachine name can not be empty.": "VirtualMachine name can not be empty.",
"VirtualMachine statuses": "VirtualMachine statuses",
"VirtualMachine Templates": "VirtualMachine Templates",
"VirtualMachine updated successfully": "VirtualMachine updated successfully",
"VirtualMachine volume clone": "VirtualMachine volume clone",
"VirtualMachine will attempt to boot from disks by order of apearance in YAML file": "VirtualMachine will attempt to boot from disks by order of apearance in YAML file",
"VirtualMachine with non-virt RBD StorageClass": "VirtualMachine with non-virt RBD StorageClass",
"VirtualMachine with unset EFS StorageClass": "VirtualMachine with unset EFS StorageClass",
"VirtualMachineClusterInstancetypes": "VirtualMachineClusterInstancetypes",
"VirtualMachineClusterPreferences": "VirtualMachineClusterPreferences",
"VirtualMachineInstance": "VirtualMachineInstance",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"Checkups": "./views/checkups/Checkups.tsx",
"CheckupsNetworkDetailsPage": "./views/checkups/network/details/CheckupsNetworkDetailsPage.tsx",
"CheckupsNetworkForm": "./views/checkups/network/components/form/CheckupsNetworkForm.tsx",
"CheckupsStorageForm": "./views/checkups/storage/CheckupsStorageForm.tsx",
"CheckupsStorageDetailsPage": "./views/checkups/storage/details/CheckupsStorageDetailsPage.tsx",
"CheckupsStorageForm": "./views/checkups/storage/components/form/CheckupsStorageForm.tsx",
"ClusterInstancetypeList": "./views/instancetypes/list/ClusterInstancetypeList.tsx",
"ClusterOverviewPage": "./views/clusteroverview/ClusterOverviewPage.tsx",
"ClusterPreferenceList": "./views/preferences/list/ClusterPreferenceList.tsx",
Expand Down
21 changes: 16 additions & 5 deletions src/views/checkups/Checkups.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
import React, { FC, useState } from 'react';
import React, { FC, useEffect, useState } from 'react';
import { RouteComponentProps } from 'react-router-dom';

import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation';
import { ListPageHeader } from '@openshift-console/dynamic-plugin-sdk';
import { Tab, Tabs, TabTitleText } from '@patternfly/react-core';
import { createURL } from '@virtualmachines/details/tabs/overview/utils/utils';

import CheckupsNetworkList from './network/list/CheckupsNetworkList';
import CheckupsStorageList from './storage/list/CheckupsStorageList';
import { trimLastHistoryPath } from './utils/utils';
import CheckupsRunButton from './CheckupsRunButton';

import './checkups.scss';

const CheckupsList: FC<RouteComponentProps> = (props) => {
const CheckupsList: FC<RouteComponentProps> = ({ history }) => {
const { t } = useKubevirtTranslation();
const [activeTabKey, setActiveTabKey] = useState<number | string>(0);
const [activeTabKey, setActiveTabKey] = useState<number | string>(
history?.location?.pathname.endsWith('storage') ? 1 : 0,
);

useEffect(() => {
history.push(
createURL(activeTabKey === 0 ? 'network' : 'storage', trimLastHistoryPath(history)),
);
}, [activeTabKey, history, history?.location?.pathname]);

return (
<>
<ListPageHeader title={t('Checkups')}>
<CheckupsRunButton {...props} />
<CheckupsRunButton history={history} />
</ListPageHeader>
Comment on lines +18 to +31
Copy link
Member

Choose a reason for hiding this comment

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

Seems like network and storage can be defined as parameters in the path.
So that you can grab them using match.params from the RouteComponentProps props

Like /k8s/ns/:ns/checkups/:type/form. Would we insert other types of Checkups in the future?

Copy link
Member Author

Choose a reason for hiding this comment

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

no plans for more right now.
it wont really give me anything adding :type as params, as each one is a different component, and console-extention is managing the lins and component according to links, except Checkups.tsx which function a bit as a router because of the tabs which I don't have a way around it.

<Tabs
onSelect={(_, tabIndex: number | string) => {
Expand All @@ -29,7 +40,7 @@ const CheckupsList: FC<RouteComponentProps> = (props) => {
<CheckupsNetworkList />
</Tab>
<Tab eventKey={1} title={<TabTitleText>{t('Storage')}</TabTitleText>}>
Place holder
<CheckupsStorageList />
</Tab>
</Tabs>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTransla
import { VirtualizedTable } from '@openshift-console/dynamic-plugin-sdk';
import { Bullseye, Title } from '@patternfly/react-core';

import useCheckupsNetworkDetailsPageHistoryColumns from './hooks/useCheckupsNetworkDetailsPageHistoryColumns';
import CheckupsNetworkDetailsPageHistoryRow from './CheckupsNetworkDetailsPageHistoryRow';
import useCheckupsNetworkDetailsPageHistoryColumns from './network/details/hooks/useCheckupsNetworkDetailsPageHistoryColumns';
import CheckupsNetworkDetailsPageHistoryRow from './CheckupsDetailsPageHistoryRow';

type CheckupsNetworkDetailsPageHistoryProps = {
error: Error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Timestamp,
} from '@openshift-console/dynamic-plugin-sdk';

import CheckupsNetworkStatusIcon from '../components/CheckupsNetworkStatusIcon';
import CheckupsNetworkStatusIcon from './CheckupsNetworkStatusIcon';

const CheckupsNetworkDetailsPageHistoryRow: FC<
RowProps<IoK8sApiBatchV1Job, { job: IoK8sApiBatchV1Job }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTransla
import { NO_DATA_DASH } from '@kubevirt-utils/resources/vm/utils/constants';
import { CheckCircleIcon, ExclamationCircleIcon, SyncAltIcon } from '@patternfly/react-icons';

import { getConfigMapStatus, getJobStatus, NetworkCheckupsStatus } from '../utils/utils';
import { getConfigMapStatus, getJobStatus, NetworkCheckupsStatus } from './utils/utils';

import './checkups-network-status.icon.scss';
import './checkups.scss';

type CheckupsNetworkStatusIconProps = {
configMap?: IoK8sApiCoreV1ConfigMap;
Expand Down
37 changes: 30 additions & 7 deletions src/views/checkups/CheckupsRunButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,49 @@ import { ListPageCreateDropdown, useActiveNamespace } from '@openshift-console/d
import { Button, ButtonVariant } from '@patternfly/react-core';
import { createURL } from '@virtualmachines/details/tabs/overview/utils/utils';

const CheckupsRunButton: FC<RouteComponentProps> = ({ history }) => {
import useCheckupsNetworkPermissions from './network/hooks/useCheckupsNetworkPermissions';
import { useCheckupsStoragePermissions } from './storage/components/hooks/useCheckupsStoragePermissions';
import { trimLastHistoryPath } from './utils/utils';

const CheckupsRunButton: FC<{ history: RouteComponentProps['history'] }> = ({ history }) => {
const [namespace] = useActiveNamespace();
const { t } = useKubevirtTranslation();
const { isPermitted: isCreateNetworkPermitted } = useCheckupsNetworkPermissions();
const { isPermitted: isCreateStoragePermitted } = useCheckupsStoragePermissions();

const createItems = {
network: t('Network latency'),
storage: t('Storage'),
network: (
<div
className={classNames({ 'CheckupsRunButton--item__disabled': !isCreateNetworkPermitted })}
>
{t('Network latency')}
</div>
),
storage: (
<div
className={classNames({ 'CheckupsRunButton--item__disabled': !isCreateStoragePermitted })}
>
{t('Storage')}
</div>
),
};

const onCreate = useCallback(
(type: string) => {
const { pathname } = history?.location;
switch (type) {
case 'network':
return history.push(createURL('network/form', pathname));
return (
isCreateNetworkPermitted &&
history.push(createURL('network/form', trimLastHistoryPath(history)))
);
case 'storage':
return history.push(createURL('storage', pathname));
return (
isCreateStoragePermitted &&
history.push(createURL('storage/form', trimLastHistoryPath(history)))
);
}
},
[history],
[history, isCreateNetworkPermitted, isCreateStoragePermitted],
);

return (
Expand Down
14 changes: 14 additions & 0 deletions src/views/checkups/checkups.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,18 @@
background-color: var(--pf-global--disabled-color--200);
}
}
&--item {
&__disabled {
cursor: default;
color: var(--pf-global--disabled-color--200);
}
}
}

.CheckupsNetworkStatusIcon {
&--main {
svg {
margin-right: var(--pf-global--spacer--xs);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
KebabToggle,
} from '@patternfly/react-core';

import { deleteNetworkCheckup, rerunNetworkCheckup, STATUS_SUCCEEDED } from '../utils/utils';
import { STATUS_SUCCEEDED } from '../../utils/utils';
import { deleteNetworkCheckup, rerunNetworkCheckup } from '../utils/utils';

const CheckupsNetworkActions = ({
configMap,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTransla
import { ResourceYAMLEditor } from '@openshift-console/dynamic-plugin-sdk';
import { Bullseye, Divider, PageSection, Tab, Tabs, TabTitleText } from '@patternfly/react-core';

import CheckupsDetailsPageHistory from '../../CheckupsDetailsPageHistory';
import { getJobByName } from '../../utils/utils';
import useCheckupsNetworkData from '../hooks/useCheckupsNetworkData';
import { getJobByName } from '../utils/utils';

import CheckupsNetworkDetailsPageHeader from './CheckupsNetworkDetailsPageHeader';
import CheckupsNetworkDetailsPageHistory from './CheckupsNetworkDetailsPageHistory';
import CheckupsNetworkDetailsPageSection from './CheckupsNetworkDetailsPageSection';

import './checkups-network-details-page.scss';
Expand Down Expand Up @@ -48,7 +48,7 @@ const CheckupsNetworkDetailsPage = () => {
<Divider />
</PageSection>
<PageSection>
<CheckupsNetworkDetailsPageHistory error={error} jobs={jobMatches} loading={loading} />
<CheckupsDetailsPageHistory error={error} jobs={jobMatches} loading={loading} />
</PageSection>
</Tab>
<Tab eventKey={1} title={<TabTitleText>{t('YAML')}</TabTitleText>}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,20 @@ import {
Title,
} from '@patternfly/react-core';

import CheckupsNetworkStatusIcon from '../components/CheckupsNetworkStatusIcon';
import CheckupsNetworkStatusIcon from '../../CheckupsNetworkStatusIcon';
import {
STATUS_AVG_LATENCY_NANO,
STATUS_COMPILATION_TIME_STAMP,
STATUS_FAILURE_REASON,
STATUS_START_TIME_STAMP,
} from '../../utils/utils';
import {
STATUS_AVG_LATENCY_NANO,
STATUS_MAX_LATENCY_NANO,
STATUS_MIN_LATENCY_NANO,
STATUS_NAD_NAME,
STATUS_NAD_NAMESPACE,
STATUS_SAMPLE_DURATION,
STATUS_SOURCE_NODE,
STATUS_START_TIME_STAMP,
STATUS_TARGET_NODE,
} from '../utils/utils';

Expand Down
3 changes: 2 additions & 1 deletion src/views/checkups/network/hooks/useCheckupsNetworkData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { ALL_NAMESPACES_SESSION_KEY } from '@kubevirt-utils/hooks/constants';
import useKubevirtWatchResource from '@kubevirt-utils/hooks/useKubevirtWatchResource';
import { useActiveNamespace } from '@openshift-console/dynamic-plugin-sdk';

import { KUBEVIRT_VM_LATENCY_LABEL, KUBEVIRT_VM_LATENCY_LABEL_VALUE } from '../utils/utils';
import { KUBEVIRT_VM_LATENCY_LABEL } from '../../utils/utils';
import { KUBEVIRT_VM_LATENCY_LABEL_VALUE } from '../utils/utils';

const useCheckupsNetworkData = () => {
const [namespace] = useActiveNamespace();
Expand Down
Loading
Loading