diff --git a/frontend/public/locales/en/translation.json b/frontend/public/locales/en/translation.json index 93376c98fc..3df0e66cbd 100644 --- a/frontend/public/locales/en/translation.json +++ b/frontend/public/locales/en/translation.json @@ -1731,6 +1731,7 @@ "InstallPlanApproval determines if subscription installation plans are applied automatically.": "InstallPlanApproval determines if subscription installation plans are applied automatically.", "Instance profile": "Instance profile", "Instance type": "Instance type", + "Integrate with external partner platforms": "Integrate with external partner platforms", "Internal server error": "Internal server error", "internet": "internet", "invalidclustername.message": "The cluster name is invalid. Change the name to the RFC 1123 standard which consists of lower case alphanumeric characters, '-', and must start and end with an alphanumeric character.", diff --git a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/CreateCluster.tsx b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/CreateCluster.tsx index 03f7fb7ea9..dff53a6128 100644 --- a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/CreateCluster.tsx +++ b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/CreateCluster.tsx @@ -65,6 +65,8 @@ import getControlDataVMW from './controlData/ControlDataVMW' import { useLocalHubName } from '../../../../../hooks/use-local-hub' import './style.css' import { VALID_DNS_LABEL } from '../../../../../components/TemplateEditor/utils/validation-types' +import { getPlatform } from './components/assisted-installer/hypershift/utils' + // Register the custom 'and' helper Handlebars.registerHelper('and', function (a, b) { return a && b @@ -592,6 +594,8 @@ export default function CreateCluster(props: { infrastructureType: ClusterInfras break case HostInventoryInfrastructureType.CIM: template = Handlebars.compile(cimTemplate) + Handlebars.registerHelper('convert', getPlatform) + controlData = getControlDataCIM(t, handleModalToggle, , isACMAvailable) breadcrumbs.push(controlPlaneBreadCrumbBM) break @@ -607,6 +611,8 @@ export default function CreateCluster(props: { infrastructureType: ClusterInfras break case HostInventoryInfrastructureType.AI: template = Handlebars.compile(aiTemplate) + Handlebars.registerHelper('convert', getPlatform) + controlData = getControlDataAI(t, handleModalToggle, isACMAvailable) breadcrumbs.push(controlPlaneBreadCrumbBM, hostsBreadCrumb) break diff --git a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/DetailsForm.tsx b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/DetailsForm.tsx index 9ddbda3d87..55dad57b2e 100644 --- a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/DetailsForm.tsx +++ b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/DetailsForm.tsx @@ -29,7 +29,7 @@ import { } from '@openshift-assisted/ui-lib/cim' import React from 'react' import { FieldName } from './types' -import { getFieldLabels } from './hypershift/utils' +import { getFieldLabels, getPlatformLabel } from './hypershift/utils' import { getFirstAgentServiceConfig } from '../../../../../InfraEnvironments/InfraEnvironmentsPage' type FormControl = { @@ -146,6 +146,10 @@ const DetailsForm: React.FC = ({ control, handleChange, contro }, pullSecret: {}, controlPlaneCount: { path: 'AgentClusterInstall[0].spec.provisionRequirements.controlPlaneAgents' }, + platform: { + path: 'AgentClusterInstall[0].spec.platformType', + transform: (a?: string) => a?.toLowerCase() || a, + }, }), [control.additionalProps?.aiFlow] ) @@ -184,8 +188,13 @@ const DetailsForm: React.FC = ({ control, handleChange, contro } Object.keys(fields).forEach((key) => { const path = fields[key].path + const transform = fields[key].transform if (path) { - set(active, key, getValue(templateObject, path) || '') + set( + active, + key, + (transform && transform(getValue(templateObject, path))) || getValue(templateObject, path) || '' + ) } }) if (!isEqual(active, control.active)) { @@ -207,6 +216,9 @@ const DetailsForm: React.FC = ({ control, handleChange, contro if (key === 'openshiftVersion') { desc = getVersion(get(control, `active.${key}`)) } + if (key === 'platform') { + desc = getPlatformLabel(get(control, `active.${key}`)) + } return { term: fieldLabels[key as FieldName] ?? 'Error' + key, desc: desc, diff --git a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/hypershift/utils.ts b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/hypershift/utils.ts index 494f8cea77..0ca9fb0f45 100644 --- a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/hypershift/utils.ts +++ b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/hypershift/utils.ts @@ -32,4 +32,27 @@ export const getFieldLabels = (t: TFunction): Partial<{ [K in FieldName]: string openshiftVersion: t('OpenShift version'), cpuArchitecture: t('CPU architecture'), controlPlaneCount: t('Number of control plane nodes'), + platform: t('Integrate with external partner platforms'), }) + +export type PlatformType = 'none' | 'baremetal' | 'vsphere' | 'nutanix' | 'external' + +const CIMPlatforms: { [key in PlatformType]: string } = { + none: 'None', + baremetal: 'BareMetal', + vsphere: 'VSphere', + nutanix: 'Nutanix', + external: 'External', +} + +const CIMPlatformsLabels: { [key in PlatformType]: string } = { + none: 'No platform integration', + baremetal: 'No platform integration', + vsphere: 'vSphere', + nutanix: 'Nutanix', + external: 'External cloud provider', +} + +export const getPlatform = (a: PlatformType) => (a ? CIMPlatforms[a] : CIMPlatforms['none']) + +export const getPlatformLabel = (a: PlatformType) => (a ? CIMPlatformsLabels[a] : CIMPlatformsLabels['none']) diff --git a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/types.ts b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/types.ts index ab3ad92c9d..3d0b81fde4 100644 --- a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/types.ts +++ b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/types.ts @@ -15,3 +15,4 @@ export type FieldName = | 'openshiftVersion' | 'cpuArchitecture' | 'controlPlaneCount' + | 'platform' diff --git a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/templates/assisted-installer/ai-template.hbs b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/templates/assisted-installer/ai-template.hbs index 7eca78e64d..6b4f927af6 100644 --- a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/templates/assisted-installer/ai-template.hbs +++ b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/templates/assisted-installer/ai-template.hbs @@ -56,6 +56,14 @@ spec: - 172.30.0.0/16 userManagedNetworking: {{{ai.userManagedNetworking}}} sshPublicKey: '{{{ai.sshPublicKey}}}' + platformType: '{{convert ai.platform}}' + {{#switch ai.platform}} + {{#case 'external'}} + external: + platformName: 'External platform' + cloudControllerManager: External + {{/case}} + {{/switch}} --- apiVersion: v1 diff --git a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/templates/assisted-installer/cim-template.hbs b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/templates/assisted-installer/cim-template.hbs index f01a88ba48..da8a49ea10 100644 --- a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/templates/assisted-installer/cim-template.hbs +++ b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/templates/assisted-installer/cim-template.hbs @@ -64,6 +64,14 @@ spec: {{else}} sshPublicKey: '' {{/if}} + platformType: '{{convert ai.platform}}' + {{#switch ai.platform}} + {{#case 'external'}} + external: + platformName: 'External platform' + cloudControllerManager: External + {{/case}} + {{/switch}} --- apiVersion: v1