diff --git a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/utils.ts b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/utils.ts index a9efaea398d..6de9ec7a42b 100644 --- a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/utils.ts +++ b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/components/assisted-installer/utils.ts @@ -626,6 +626,15 @@ export const onChangeBMHHostname = async (bmh: BareMetalHostK8sResource, hostnam }, ]).promise as Promise +export const onEditHostRole = async (agent: AgentK8sResource, role: string) => + patchResource(agent as IResource, [ + { + op: 'replace', + path: '/spec/role', + value: role, + }, + ]).promise as Promise + export const useAgentsOfAIFlow = ({ name, namespace }: { name: string; namespace: string }): AgentK8sResource[] => { const { agentsState } = useSharedAtoms() const agents = useRecoilValue(agentsState) diff --git a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/cim/ScaleUpDialog.tsx b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/cim/ScaleUpDialog.tsx index 5c6cd26dd0b..cbdc87d8190 100644 --- a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/cim/ScaleUpDialog.tsx +++ b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/cim/ScaleUpDialog.tsx @@ -6,6 +6,7 @@ import { onChangeHostname, onSetInstallationDiskId, onChangeBMHHostname, + onEditHostRole, } from '../../CreateCluster/components/assisted-installer/utils' import { useSharedAtoms, useRecoilValue } from '../../../../../../shared-recoil' import { IResource } from '../../../../../../resources' @@ -50,7 +51,7 @@ const ScaleUpDialog = ({ isOpen, closeDialog, clusterName }: ScaleUpDialogProps) { op: 'replace', path: '/spec/role', - value: 'worker', + value: agent.spec?.role, }, ]).promise }) @@ -76,6 +77,7 @@ const ScaleUpDialog = ({ isOpen, closeDialog, clusterName }: ScaleUpDialogProps) onChangeBMHHostname={onChangeBMHHostname} onSetInstallationDiskId={onSetInstallationDiskId} isNutanix={agentClusterInstall?.spec?.platformType === 'Nutanix'} + onEditHostRole={onEditHostRole} /> ) }