Skip to content

Commit

Permalink
Disable removing from AI-flow cluster for ISO-booted nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
jgyselov committed Jan 3, 2024
1 parent f201928 commit e8e308a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/ui-lib/lib/cim/components/Agent/tableUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ export const canUnbindAgent = (
agentClusterInstalls: AgentClusterInstallK8sResource[] | undefined,
agent: AgentK8sResource,
t: TFunction,
infraEnv?: InfraEnvK8sResource,
): ActionCheck => {
if (!agent?.spec.clusterDeploymentName?.name) {
return [false, t('ai:The agent is not bound to a cluster.')];
Expand Down Expand Up @@ -342,7 +343,10 @@ export const canUnbindAgent = (
}
}

if (!agent.metadata?.labels?.hasOwnProperty(AGENT_BMH_NAME_LABEL_KEY)) {
if (
!agent.metadata?.labels?.hasOwnProperty(AGENT_BMH_NAME_LABEL_KEY) &&
infraEnv?.spec?.clusterRef
) {
return [false, t('ai:It is not possible to remove this node from the cluster.')];
}

Expand Down Expand Up @@ -471,7 +475,7 @@ export const useAgentsTable = (
const agent = agents.find((a) => a.metadata?.uid === host.id);

if (agent) {
return canUnbindAgent(agentClusterInstalls, agent, t);
return canUnbindAgent(agentClusterInstalls, agent, t, infraEnv);
}
const bmh = bmhs?.find((bmh) => bmh.metadata?.uid === host.id);
if (bmh) {
Expand Down

0 comments on commit e8e308a

Please sign in to comment.