Skip to content
Closed
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 frontend/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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, <Warning />, isACMAvailable)
breadcrumbs.push(controlPlaneBreadCrumbBM)
break
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -146,6 +146,10 @@ const DetailsForm: React.FC<DetailsFormProps> = ({ 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]
)
Expand Down Expand Up @@ -184,8 +188,13 @@ const DetailsForm: React.FC<DetailsFormProps> = ({ 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)) {
Expand All @@ -207,6 +216,9 @@ const DetailsForm: React.FC<DetailsFormProps> = ({ 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ export type FieldName =
| 'openshiftVersion'
| 'cpuArchitecture'
| 'controlPlaneCount'
| 'platform'
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down