From 219eb167ce5931fcc8e887d4d573f1e8bcf8f86a Mon Sep 17 00:00:00 2001 From: Elay Aharoni Date: Wed, 14 May 2025 17:54:46 +0300 Subject: [PATCH] Binding-day-2-host-to-cluster-defaults-host-to-worker-role Signed-off-by: Elay Aharoni --- .../CreateCluster/components/assisted-installer/utils.ts | 9 +++++++++ .../ManagedClusters/components/cim/ScaleUpDialog.tsx | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) 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} /> ) }