Skip to content

Commit

Permalink
MGMT-19467: Operators step redesign (#2778)
Browse files Browse the repository at this point in the history
* Updating API with latest changes

* Add bundles and single operators in Operators page

* Adapting tests

* Adjusting code for operators

* Adjusting tests 2

* Improvement of design in Operators step
  • Loading branch information
ammont82 authored Feb 12, 2025
1 parent 79c1c35 commit d53de13
Show file tree
Hide file tree
Showing 33 changed files with 1,150 additions and 74 deletions.
1 change: 1 addition & 0 deletions libs/locales/lib/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"ai:arm64 is not supported in this OpenShift version": "arm64 is not supported in this OpenShift version",
"ai:At least 3 hosts are required, capable of functioning as control plane nodes.": "At least 3 hosts are required that are capable of functioning as control plane nodes.",
"ai:Authentication is provided by the discovery ISO, therefore when you access your host using SSH, a password is not required. Optional -i parameter can be used to specify the private key that matches the public key provided when generating Discovery ISO.": "Authentication is provided by the Discovery ISO, so a password is not required when you access your host using SSH. The optional -i parameter can be used to specify the private key that matches the public key that is provided when generating Discovery ISO.",
"ai:Authorino": "Authorino",
"ai:Auto synchronized NTP (Network Time Protocol) sources": "Auto synchronized NTP (Network Time Protocol) sources",
"ai:Auto-assign": "Auto-assign",
"ai:Auto-select hosts": "Auto-select hosts",
Expand Down
66 changes: 63 additions & 3 deletions libs/types/assisted-installer-service.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,28 @@ export interface Boot {
pxeInterface?: string;
commandLine?: string;
secureBootState?: SecureBootState;
deviceType?: 'persistent' | 'ephemeral';
}
export interface Bundle {
/**
* Unique identifier of the bundle, for example `virtualization` or `openshift-ai-nvidia`.
*/
id?: string;
/**
* Short human friendly description for the bundle, usually only a few words, for example `Virtualization` or
* `OpenShift AI (NVIDIA)`.
*
*/
title?: string;
/**
* Longer human friendly description for the bundle, usually one or more sentences.
*
*/
description?: string;
/**
* List of operators associated with the bundle.
*/
operators?: string[];
}
export interface Cluster {
/**
Expand Down Expand Up @@ -372,6 +394,7 @@ export interface Cluster {
* Specifies the required number of control plane nodes that should be part of the cluster.
*/
controlPlaneCount?: number;
loadBalancer?: LoadBalancer;
}
export interface ClusterCreateParams {
/**
Expand Down Expand Up @@ -454,6 +477,8 @@ export interface ClusterCreateParams {
additionalNtpSource?: string;
/**
* List of OLM operators to be installed.
* For the full list of supported operators, check the endpoint `/v2/supported-operators`:
*
*/
olmOperators?: OperatorCreateParams[];
/**
Expand Down Expand Up @@ -501,6 +526,7 @@ export interface ClusterCreateParams {
* Specifies the required number of control plane nodes that should be part of the cluster.
*/
controlPlaneCount?: number;
loadBalancer?: LoadBalancer;
}
export interface ClusterDefaultConfig {
clusterNetworkCidr?: string; // ^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)[\/]([1-9]|[1-2][0-9]|3[0-2]?)$
Expand Down Expand Up @@ -629,7 +655,8 @@ export type ClusterValidationId =
| 'servicemesh-requirements-satisfied'
| 'serverless-requirements-satisfied'
| 'openshift-ai-requirements-satisfied'
| 'authorino-requirements-satisfied';
| 'authorino-requirements-satisfied'
| 'nmstate-requirements-satisfied';
export interface CompletionParams {
isSuccess: boolean;
errorInfo?: string;
Expand Down Expand Up @@ -1020,7 +1047,9 @@ export type FeatureSupportLevelId =
| 'SERVERLESS'
| 'OPENSHIFT_AI'
| 'NON_STANDARD_HA_CONTROL_PLANE'
| 'AUTHORINO';
| 'AUTHORINO'
| 'USER_MANAGED_LOAD_BALANCER'
| 'NMSTATE';
/**
* Cluster finalizing stage managed by controller
*/
Expand Down Expand Up @@ -1573,7 +1602,8 @@ export type HostValidationId =
| 'serverless-requirements-satisfied'
| 'openshift-ai-requirements-satisfied'
| 'authorino-requirements-satisfied'
| 'mtu-valid';
| 'mtu-valid'
| 'nmstate-requirements-satisfied';
/**
* Explicit ignition endpoint overrides the default ignition endpoint.
*/
Expand Down Expand Up @@ -1870,6 +1900,10 @@ export interface InstallCmdRequest {
*
*/
highAvailabilityMode?: 'Full' | 'None';
/**
* Specifies the required number of control plane nodes that should be part of the cluster.
*/
controlPlaneCount?: number;
proxy?: Proxy;
/**
* Check CVO status if needed
Expand Down Expand Up @@ -1911,6 +1945,10 @@ export interface InstallCmdRequest {
* If true, notify number of reboots by assisted controller
*/
notifyNumReboots?: boolean;
/**
* CoreOS container image to use if installing to the local device
*/
coreosImage?: string;
}
export interface InstallerArgsParams {
/**
Expand Down Expand Up @@ -2024,6 +2062,21 @@ export interface ListVersions {
versions?: Versions;
releaseTag?: string;
}
export interface LoadBalancer {
/**
* Indicates if the load balancer will be managed by the cluster or by the user. This is optional and The
* default is `cluster-managed`.
*
* `cluster-managed` means that the cluster will start the components that assign the API and ingress VIPs to the
* nodes of the cluster automatically.
*
* `user-managed` means that the user is responsible for configuring an external load balancer and assign the
* API and ingress VIPs to it. Note that this configuration needs to be completed before starting the
* installation of the cluster, as it is needed during the installation process.
*
*/
type?: 'cluster-managed' | 'user-managed';
}
export interface LogsGatherCmdRequest {
/**
* Cluster id
Expand Down Expand Up @@ -2147,6 +2200,10 @@ export interface MonitoredOperator {
* Time at which the operator was last updated.
*/
statusUpdatedAt?: string; // date-time
/**
* List of identifier of the bundles associated with the operator. Can be empty.
*/
bundles?: string[];
}
export type MonitoredOperatorsList = MonitoredOperator[];
export interface MtuReport {
Expand Down Expand Up @@ -2706,6 +2763,8 @@ export interface V2ClusterUpdateParams {
additionalNtpSource?: string;
/**
* List of OLM operators to be installed.
* For the full list of supported operators, check the endpoint `/v2/supported-operators`:
*
*/
olmOperators?: OperatorCreateParams[];
/**
Expand Down Expand Up @@ -2748,6 +2807,7 @@ export interface V2ClusterUpdateParams {
* Specifies the required number of control plane nodes that should be part of the cluster.
*/
controlPlaneCount?: number;
loadBalancer?: LoadBalancer;
}
export interface V2Events {
clusterId?: string;
Expand Down
44 changes: 43 additions & 1 deletion libs/ui-lib-tests/cypress/fixtures/cluster/base-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,46 @@ const baseCluster = (name = Cypress.env('CLUSTER_NAME')) => ({
vip_dhcp_allocation: false,
});

export { fakeClusterId, fakeClusterInfraEnvId, baseCluster };
const bundles = [
{
description: 'Run virtual machines alongside containers on one platform.',
id: 'virtualization',
operators: ['cnv', 'nmstate', 'mtv'],
title: 'Virtualization',
},
{
description:
'Train, serve, monitor and manage AI/ML models and applications using NVIDIA GPUs.',
id: 'openshift-ai-nvidia',
operators: [
'servicemesh',
'serverless',
'openshift-ai',
'authorino',
'pipelines',
'nvidia-gpu',
'odf',
],
title: 'OpenShift AI (NVIDIA)',
},
];

const supported_operators = [
'nvidia-gpu',
'pipelines',
'nmstate',
'lvm',
'node-feature-discovery',
'openshift-ai',
'authorino',
'odf',
'mce',
'osc',
'cnv',
'mtv',
'servicemesh',
'serverless',
'lso',
];

export { fakeClusterId, fakeClusterInfraEnvId, baseCluster, bundles, supported_operators };
3 changes: 3 additions & 0 deletions libs/ui-lib-tests/cypress/fixtures/create-mn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { isoDownloadedClusterBuilder } from '../create-sno/2-iso-downloaded';
import { hostDiscoveredBuilder } from '../create-sno/3-host-discovered';
import { hostRenamedBuilder } from '../create-sno/4-host-renamed';
import { clusterReadyBuilder } from '../create-sno/5-cluster-ready';
import { bundles, supported_operators } from '../cluster/base-cluster';

const isoDownloadedCluster = isoDownloadedClusterBuilder(multinodeCluster);
const hostDiscoveredCluster = () => hostDiscoveredBuilder(isoDownloadedCluster);
Expand All @@ -21,6 +22,8 @@ const createMultinodeFixtureMapping = {
READY_TO_INSTALL: readyToInstallCluster,
default: multinodeCluster,
},
bundles: bundles,
supported_operators: supported_operators,
};

export { createMultinodeFixtureMapping };
44 changes: 43 additions & 1 deletion libs/ui-lib-tests/cypress/fixtures/read-only/5-cluster-ready.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,46 @@ const readOnlyCluster = {
},
};

export { readOnlyCluster };
const bundles = [
{
description: 'Run virtual machines alongside containers on one platform.',
id: 'virtualization',
operators: ['cnv', 'nmstate', 'mtv'],
title: 'Virtualization',
},
{
description:
'Train, serve, monitor and manage AI/ML models and applications using NVIDIA GPUs.',
id: 'openshift-ai-nvidia',
operators: [
'servicemesh',
'serverless',
'openshift-ai',
'authorino',
'pipelines',
'nvidia-gpu',
'odf',
],
title: 'OpenShift AI (NVIDIA)',
},
];

const supported_operators = [
'nvidia-gpu',
'pipelines',
'nmstate',
'lvm',
'node-feature-discovery',
'openshift-ai',
'authorino',
'odf',
'mce',
'osc',
'cnv',
'mtv',
'servicemesh',
'serverless',
'lso',
];

export { readOnlyCluster, bundles, supported_operators };
4 changes: 3 additions & 1 deletion libs/ui-lib-tests/cypress/fixtures/read-only/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { readOnlyCluster } from './5-cluster-ready';
import { bundles, readOnlyCluster, supported_operators } from './5-cluster-ready';

const createReadOnlyFixtureMapping = {
clusters: {
default: readOnlyCluster,
},
bundles: bundles,
supported_operators: supported_operators,
};

export { createReadOnlyFixtureMapping };
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ describe(`Assisted Installer Read Only Cluster`, () => {
navbar.clickOnNavItem('Operators');
bareMetalDiscoveryPage.getCnvField().should('be.disabled');
bareMetalDiscoveryPage.getOdfOperator().should('be.disabled');
bareMetalDiscoveryPage.getLvmOperator().should('not.exist');
});

it('Should display the Host discovery page in viewer mode', () => {
Expand Down
16 changes: 16 additions & 0 deletions libs/ui-lib-tests/cypress/support/interceptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { day2FlowIds } = fixtures;

const allInfraEnvsApiPath = '/api/assisted-install/v2/infra-envs/';
const allClustersApiPath = '/api/assisted-install/v2/clusters/';
const allOperatorsApiPath = '/api/assisted-install/v2/operators/';

const x86 = 'x86_64';
const arm = 'arm64';
Expand Down Expand Up @@ -141,6 +142,17 @@ const mockUISettingsResponse: HttpRequestInterceptor = (req) => {
}
};

const mockBundlesResponse: HttpRequestInterceptor = (req) => {
const fixtureMapping = getScenarioFixtureMapping();
console.log(fixtureMapping);
req.reply(fixtureMapping?.bundles || []);
};

const mockSupportedOperators: HttpRequestInterceptor = (req) => {
const fixtureMapping = getScenarioFixtureMapping();
req.reply(fixtureMapping?.supported_operators || []);
};

const setScenarioEnvVars = (activeScenario) => {
Cypress.env('AI_SCENARIO', activeScenario);
Cypress.env('ASSISTED_SNO_DEPLOYMENT', false);
Expand Down Expand Up @@ -403,6 +415,10 @@ const addAdditionalIntercepts = () => {
cy.intercept('POST', '/api/accounts_mgmt/v1/access_token', (req) => {
req.reply(fixtures.pullSecret);
});
cy.intercept('GET', `${allOperatorsApiPath}/bundles`, mockBundlesResponse).as('bundles');
cy.intercept('GET', '/api/assisted-install/v2/supported-operators', mockSupportedOperators).as(
'supported-operators',
);
};

const addEventsIntercepts = () => {
Expand Down
18 changes: 18 additions & 0 deletions libs/ui-lib/lib/common/api/assisted-service/BundleAPI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { client } from '../axiosClient';
import { Bundle } from '@openshift-assisted/types/assisted-installer-service';

const BundleAPI = {
makeBaseURI() {
return `/v2/operators/bundles`;
},

list() {
return client.get<Bundle[]>(`${BundleAPI.makeBaseURI()}`);
},

listOperatorsForBundle(bundleName: string) {
return client.get<string[]>(`${BundleAPI.makeBaseURI()}?bundle_name=${bundleName}`);
},
};

export default BundleAPI;
13 changes: 13 additions & 0 deletions libs/ui-lib/lib/common/api/assisted-service/OperatorsAPI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { client } from '../axiosClient';

const OperatorsAPI = {
makeBaseURI() {
return `/v2/supported-operators`;
},

list() {
return client.get<string[]>(`${OperatorsAPI.makeBaseURI()}`);
},
};

export default OperatorsAPI;
4 changes: 3 additions & 1 deletion libs/ui-lib/lib/common/components/clusterWizard/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export type ValidationActionLinkProps<S extends string> = {
wizardStepNames: { [key in S]: string };
};

export type ClusterOperatorProps = Pick<Cluster, 'openshiftVersion'> & { clusterId: Cluster['id'] };
export type ClusterOperatorProps = Pick<Cluster, 'openshiftVersion'> & {
clusterId: Cluster['id'];
} & { monitoredOperators?: Cluster['monitoredOperators'] };

export type ItemDropdown = {
label: string;
Expand Down
Loading

0 comments on commit d53de13

Please sign in to comment.