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

MGMT-19058: Add OpenShif API operator #2677

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions libs/locales/lib/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@
"ai:Open Virtual Networking (OVN)": "Open Virtual Networking (OVN)",
"ai:Opening file": "Opening file",
"ai:OpenShift": "OpenShift",
"ai:OpenShift AI": "OpenShift AI",
"ai:OpenShift Cluster Manager": "OpenShift Cluster Manager",
"ai:OpenShift Data Foundation": "OpenShift Data Foundation",
"ai:OpenShift in-place upgrades aren't expected to work with SNO. If an upgrade is needed, your system will need a redeployment.": "OpenShift in-place upgrades are not expected to work with SNO. If an upgrade is needed, your system to be redeployed.",
Expand Down
135 changes: 68 additions & 67 deletions libs/types/assisted-installer-service.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,17 @@ export interface Cluster {
* Status of the OpenShift cluster.
*/
status:
| 'insufficient'
| 'ready'
| 'error'
| 'preparing-for-installation'
| 'pending-for-input'
| 'installing'
| 'finalizing'
| 'installed'
| 'adding-hosts'
| 'cancelled'
| 'installing-pending-user-action';
| 'insufficient'
| 'ready'
| 'error'
| 'preparing-for-installation'
| 'pending-for-input'
| 'installing'
| 'finalizing'
| 'installed'
| 'adding-hosts'
| 'cancelled'
| 'installing-pending-user-action';
/**
* Additional information pertaining to the status of the OpenShift cluster.
*/
Expand Down Expand Up @@ -967,6 +967,7 @@ export type FeatureSupportLevelId =
| 'SINGLE_NODE_EXPANSION'
| 'LVM'
| 'ODF'
| 'OAI'
| 'LSO'
| 'CNV'
| 'MCE'
Expand Down Expand Up @@ -1050,34 +1051,34 @@ export interface Host {
*/
infraEnvId?: string; // uuid
status:
| 'discovering'
| 'known'
| 'disconnected'
| 'insufficient'
| 'disabled'
| 'preparing-for-installation'
| 'preparing-failed'
| 'preparing-successful'
| 'pending-for-input'
| 'installing'
| 'installing-in-progress'
| 'installing-pending-user-action'
| 'resetting-pending-user-action'
| 'installed'
| 'error'
| 'resetting'
| 'added-to-existing-cluster'
| 'cancelled'
| 'binding'
| 'unbinding'
| 'unbinding-pending-user-action'
| 'known-unbound'
| 'disconnected-unbound'
| 'insufficient-unbound'
| 'disabled-unbound'
| 'discovering-unbound'
| 'reclaiming'
| 'reclaiming-rebooting';
| 'discovering'
| 'known'
| 'disconnected'
| 'insufficient'
| 'disabled'
| 'preparing-for-installation'
| 'preparing-failed'
| 'preparing-successful'
| 'pending-for-input'
| 'installing'
| 'installing-in-progress'
| 'installing-pending-user-action'
| 'resetting-pending-user-action'
| 'installed'
| 'error'
| 'resetting'
| 'added-to-existing-cluster'
| 'cancelled'
| 'binding'
| 'unbinding'
| 'unbinding-pending-user-action'
| 'known-unbound'
| 'disconnected-unbound'
| 'insufficient-unbound'
| 'disabled-unbound'
| 'discovering-unbound'
| 'reclaiming'
| 'reclaiming-rebooting';
statusInfo: string;
/**
* JSON-formatted string containing the validation results for each validation id grouped by category (network, hardware, etc.)
Expand Down Expand Up @@ -1257,34 +1258,34 @@ export interface HostRegistrationResponse {
*/
infraEnvId?: string; // uuid
status:
| 'discovering'
| 'known'
| 'disconnected'
| 'insufficient'
| 'disabled'
| 'preparing-for-installation'
| 'preparing-failed'
| 'preparing-successful'
| 'pending-for-input'
| 'installing'
| 'installing-in-progress'
| 'installing-pending-user-action'
| 'resetting-pending-user-action'
| 'installed'
| 'error'
| 'resetting'
| 'added-to-existing-cluster'
| 'cancelled'
| 'binding'
| 'unbinding'
| 'unbinding-pending-user-action'
| 'known-unbound'
| 'disconnected-unbound'
| 'insufficient-unbound'
| 'disabled-unbound'
| 'discovering-unbound'
| 'reclaiming'
| 'reclaiming-rebooting';
| 'discovering'
| 'known'
| 'disconnected'
| 'insufficient'
| 'disabled'
| 'preparing-for-installation'
| 'preparing-failed'
| 'preparing-successful'
| 'pending-for-input'
| 'installing'
| 'installing-in-progress'
| 'installing-pending-user-action'
| 'resetting-pending-user-action'
| 'installed'
| 'error'
| 'resetting'
| 'added-to-existing-cluster'
| 'cancelled'
| 'binding'
| 'unbinding'
| 'unbinding-pending-user-action'
| 'known-unbound'
| 'disconnected-unbound'
| 'insufficient-unbound'
| 'disabled-unbound'
| 'discovering-unbound'
| 'reclaiming'
| 'reclaiming-rebooting';
statusInfo: string;
/**
* JSON-formatted string containing the validation results for each validation id grouped by category (network, hardware, etc.)
Expand Down
5 changes: 5 additions & 0 deletions libs/ui-lib/lib/common/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export const OPERATOR_NAME_ODF = 'odf';
export const OPERATOR_NAME_LVM = 'lvm';
export const OPERATOR_NAME_LVMS = 'lvms';
export const OPERATOR_NAME_MCE = 'mce';
export const OPERATOR_NAME_OAI = 'oai';

const OperatorNames = [
OPERATOR_NAME_CNV,
Expand All @@ -275,13 +276,15 @@ const OperatorNames = [
OPERATOR_NAME_LVM,
OPERATOR_NAME_LVMS,
OPERATOR_NAME_MCE,
OPERATOR_NAME_OAI,
];
export const ExposedOperatorNames = [
OPERATOR_NAME_CNV,
OPERATOR_NAME_ODF,
OPERATOR_NAME_LVM,
OPERATOR_NAME_LVMS,
OPERATOR_NAME_MCE,
OPERATOR_NAME_OAI,
];

export type OperatorName = (typeof OperatorNames)[number];
Expand All @@ -301,6 +304,7 @@ export const operatorLabelsCim = (
[OPERATOR_NAME_LVM]: useLVMS
? t('ai:Logical Volume Manager Storage')
: t('ai:Logical Volume Manager'),
[OPERATOR_NAME_OAI]: t('ai:OpenShift AI'),
};
};

Expand All @@ -317,6 +321,7 @@ export const operatorLabels = (
? t('ai:Logical Volume Manager Storage')
: t('ai:Logical Volume Manager'),
[OPERATOR_NAME_MCE]: t('ai:Multicluster engine'),
[OPERATOR_NAME_OAI]: t('ai:OpenShift AI'),
};
};

Expand Down
5 changes: 5 additions & 0 deletions libs/ui-lib/lib/common/config/docs_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,15 @@ export const HOST_REQUIREMENTS_LINK = 'https://access.redhat.com/solutions/48856
export const ODF_REQUIREMENTS_LINK =
'https://docs.redhat.com/en/documentation/red_hat_openshift_data_foundation';

export const OAI_REQUIREMENTS_LINK =
'https://docs.redhat.com/en/documentation/red_hat_openshift_data_foundation';

export const CNV_LINK = 'https://cloud.redhat.com/learn/topics/virtualization/';

export const ODF_LINK = 'https://www.redhat.com/en/resources/openshift-data-foundation-datasheet';

export const OAI_LINK = 'https://www.redhat.com/en/technologies/cloud-computing/openshift/openshift-ai';

export const getMceDocsLink = (ocpVersion?: string) =>
`https://docs.redhat.com/en/documentation/openshift_container_platform/${getShortOpenshiftVersion(
ocpVersion,
Expand Down
1 change: 1 addition & 0 deletions libs/ui-lib/lib/common/types/clusters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export type OperatorsValues = V2ClusterUpdateParams & {
useOdfLogicalVolumeManager: boolean;
useContainerNativeVirtualization: boolean;
useMultiClusterEngine: boolean;
useOpenShiftAI: boolean;
};

export type SupportedPlatformType = Extract<PlatformType, 'vsphere' | 'nutanix' | 'external'>;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import React, { useState } from 'react';
import { FormGroup, HelperText, HelperTextItem, Tooltip } from '@patternfly/react-core';
import { ExternalLinkAltIcon } from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
import {
getFieldId,
PopoverIcon,
OAI_REQUIREMENTS_LINK,
OAI_LINK,
OperatorsValues,
} from '../../../../common';
import { OcmCheckboxField } from '../../ui/OcmFormFields';
import { useNewFeatureSupportLevel } from '../../../../common/components/newFeatureSupportLevels';
import { useFormikContext } from 'formik';

const OAI_FIELD_NAME = 'useOpenShiftAI';

const OdfLabel = ({ disabledReason }: { disabledReason?: string }) => (
<>
<Tooltip hidden={!disabledReason} content={disabledReason}>
<span>Install OpenShift AI </span>
</Tooltip>
<PopoverIcon
component={'a'}
headerContent="Additional requirements"
bodyContent={
<a href={OAI_REQUIREMENTS_LINK} target="_blank" rel="noopener noreferrer">
Learn more about the requirements for OpenShift AI <ExternalLinkAltIcon />.
</a>
}
/>
</>
);

const OdfHelperText = () => {
return (
<HelperText>
<HelperTextItem variant="indeterminate">
Train, serve, monitor and manage AI/ML models and applications.{' '}
<a href={OAI_LINK} target="_blank" rel="noopener noreferrer">
{'Learn more'} <ExternalLinkAltIcon />
</a>
</HelperTextItem>
</HelperText>
);
};

const OaiCheckbox = () => {
const featureSupportLevelContext = useNewFeatureSupportLevel();
const { values } = useFormikContext<OperatorsValues>();
const fieldId = getFieldId(OAI_FIELD_NAME, 'input');
const [disabledReason, setDisabledReason] = useState<string | undefined>();

React.useEffect(() => {
let disabledReason = featureSupportLevelContext.getFeatureDisabledReason('OAI');
setDisabledReason(disabledReason);
}, [values, featureSupportLevelContext]);

return (
<FormGroup isInline fieldId={fieldId}>
<OcmCheckboxField
name={OAI_FIELD_NAME}
label={<OdfLabel disabledReason={disabledReason} />}
isDisabled={!!disabledReason}
helperText={<OdfHelperText />}
/>
</FormGroup>
);
};

export default OaiCheckbox;
2 changes: 2 additions & 0 deletions libs/ui-lib/lib/ocm/components/clusterWizard/Operators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
OPERATOR_NAME_LVM,
OPERATOR_NAME_MCE,
OPERATOR_NAME_ODF,
OPERATOR_NAME_OAI,
OperatorsValues,
selectMonitoredOperators,
useAlerts,
Expand All @@ -34,6 +35,7 @@ export const getOperatorsInitialValues = (
useOdfLogicalVolumeManager: isOperatorEnabled([OPERATOR_NAME_LVM]),
useContainerNativeVirtualization: isOperatorEnabled([OPERATOR_NAME_CNV]),
useMultiClusterEngine: isOperatorEnabled([OPERATOR_NAME_MCE]),
useOpenShiftAI: isOperatorEnabled([OPERATOR_NAME_OAI])
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Stack, StackItem } from '@patternfly/react-core';
import { ClusterOperatorProps, ClusterWizardStepHeader } from '../../../common';
import CnvCheckbox from '../clusterConfiguration/operators/CnvCheckbox';
import OdfCheckbox from '../clusterConfiguration/operators/OdfCheckbox';
import OaiCheckbox from '../clusterConfiguration/operators/OaiCheckbox';
import LvmCheckbox from '../clusterConfiguration/operators/LvmCheckbox';
import MceCheckbox from '../clusterConfiguration/operators/MceCheckbox';
import { selectIsCurrentClusterSNO } from '../../store/slices/current-cluster/selectors';
Expand Down Expand Up @@ -38,6 +39,9 @@ export const OperatorsStep = (props: ClusterOperatorProps) => {
<StackItem>
<OdfCheckbox />
</StackItem>
<StackItem>
<OaiCheckbox />
</StackItem>
</>
) : (
<StackItem>{isSNO ? <LvmCheckbox {...props} /> : <OdfCheckbox />}</StackItem>
Expand Down
Loading
Loading