Skip to content
Merged
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 libs/locales/lib/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
"ai:Error parsing cluster feature_usage field": "Error parsing cluster feature_usage field",
"ai:Events table": "Events table",
"ai:Exactly 1 host is required, capable of functioning both as control plane and worker node.": "Exactly 1 host is required, capable of functioning both as control plane and worker node.",
"ai:Exactly 2 hosts capable of functioning as control plane nodes, and one arbiter, are required.": "Exactly 2 hosts capable of functioning as control plane nodes, and one arbiter, are required.",
"ai:Exclude destination domain names, IP addresses, or other network CIDRs from proxying by adding them to this comma-separated list.": "Exclude destination domain names, IP addresses, or other network CIDRs from proxying by adding them to this comma-separated list.",
"ai:Exposes the service externally using a cloud provider's load balancer": "Exposes the service externally using a cloud provider's load balancer",
"ai:Exposes the service on each node's IP at a static port": "Exposes the service on each node's IP at a static port",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ const getInitialValues = ({
const isSNOCluster = getIsSNOCluster(agentClusterInstall);
const cdName = clusterDeployment?.metadata?.name;
const cdNamespace = clusterDeployment?.metadata?.namespace;

let hostCount =
(agentClusterInstall?.spec?.provisionRequirements?.controlPlaneAgents || 0) +
(agentClusterInstall?.spec?.provisionRequirements?.arbiterAgents || 0) +
(agentClusterInstall?.spec?.provisionRequirements?.workerAgents || 0);

if (isSNOCluster) {
hostCount = 1;
} else if (hostCount === 2 || hostCount === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,25 @@ import {
getAgentsForSelection,
getClusterDeploymentCpuArchitecture,
getIsSNOCluster,
getIsTNACluster,
} from '../../helpers';
import MinimalHWRequirements from '../../Agent/MinimalHWRequirements';
import NoAgentsAlert from '../../Agent/NoAgentsAlert';
import { useTranslation } from '../../../../common/hooks/use-translation-wrapper';
import { TFunction } from 'i18next';

const getHostRequirementText = (isSNO: boolean, isTNA: boolean, t: TFunction) => {
if (isSNO) {
return t(
'ai:Exactly 1 host is required, capable of functioning both as control plane and worker node.',
);
} else if (isTNA) {
return t(
'ai:Exactly 2 hosts capable of functioning as control plane nodes, and one arbiter, are required.',
);
}
return t('ai:At least 3 hosts are required, capable of functioning as control plane nodes.');
};

const ClusterDeploymentHostsSelection: React.FC<ClusterDeploymentHostsSelectionProps> = ({
agentClusterInstall,
Expand All @@ -28,9 +43,11 @@ const ClusterDeploymentHostsSelection: React.FC<ClusterDeploymentHostsSelectionP
onSetInstallationDiskId,
isNutanix,
}) => {
const { t } = useTranslation();
const { values } = useFormikContext<ClusterDeploymentHostsSelectionValues>();
const { autoSelectHosts } = values;
const isSNOCluster = getIsSNOCluster(agentClusterInstall);
const isTNA = getIsTNACluster(agentClusterInstall);

const cdName = clusterDeployment?.metadata?.name;
const cdNamespace = clusterDeployment?.metadata?.namespace;
Expand All @@ -45,22 +62,20 @@ const ClusterDeploymentHostsSelection: React.FC<ClusterDeploymentHostsSelectionP
!agent.spec.clusterDeploymentName?.namespace &&
agent.status?.inventory.cpu?.architecture === cpuArchitecture),
);

return isNutanix
? filtered.filter((a) => a.status?.inventory?.systemVendor?.manufacturer === 'Nutanix')
: filtered;
}, [agents, cdNamespace, cdName, cpuArchitecture, isNutanix]);
const { t } = useTranslation();

const hostRequirementText = getHostRequirementText(isSNOCluster, isTNA, t);

return (
<Grid hasGutter>
<GridItem>
<TextContent>
{isSNOCluster
? t(
'ai:Exactly 1 host is required, capable of functioning both as control plane and worker node.',
)
: t('ai:At least 3 hosts are required, capable of functioning as control plane nodes.')}
</TextContent>
<TextContent>{hostRequirementText}</TextContent>
</GridItem>

{aiConfigMap && (
<GridItem>
<MinimalHWRequirements aiConfigMap={aiConfigMap} isSNOCluster={isSNOCluster} />
Expand Down
4 changes: 4 additions & 0 deletions libs/ui-lib/lib/cim/components/helpers/agentClusterInstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { getClusterNameOfAgent } from './agents';
export const getIsSNOCluster = (agentClusterInstall?: AgentClusterInstallK8sResource) =>
agentClusterInstall?.spec?.provisionRequirements?.controlPlaneAgents === 1;

export const getIsTNACluster = (agentClusterInstall?: AgentClusterInstallK8sResource) =>
agentClusterInstall?.spec?.provisionRequirements.arbiterAgents === 1 &&
agentClusterInstall.spec.provisionRequirements.controlPlaneAgents === 2;

export const getAgentClusterInstallOfAgent = (
agentClusterInstalls: AgentClusterInstallK8sResource[],
agent?: AgentK8sResource,
Expand Down
Loading