Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACM-17523: Fixing duplicate Node Pool Names error during Cluster Provisioning. #4259

Merged
merged 2 commits into from
Feb 13, 2025
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 frontend/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,7 @@
"node.status.ready": "Ready",
"node.status.unhealthy": "Unhealthy",
"node.status.unknown": "Unknown",
"nodepoolname.exists.error": "The node pool name must be unique.",
"Nodes": "Nodes",
"nodes xN": "nodes xN",
"None": "None",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,21 @@ export default function CreateCluster(props: { infrastructureType: ClusterInfras
return undefined
}

function validateKubeVirtNodePoolName(active: any, _controlData: any, templateObjectMap: any) {
const totalNodePools = templateObjectMap['<<main>>'].NodePool.length
const current = templateObjectMap['<<main>>'].NodePool[totalNodePools - 1].$raw.metadata.name
if (totalNodePools > 1) {
for (let i = 0; i < totalNodePools - 1; i++) {
if (current === templateObjectMap['<<main>>'].NodePool[i].$raw.metadata.name)
return t('nodepoolname.exists.error')
}
}
if (!KubeVirtNamespaceRegExp.test(active)) {
return t('import.form.invalid.dns.label')
}
return undefined
}

function onControlInitialize(control: any) {
switch (control.id) {
case 'connection':
Expand All @@ -395,6 +410,14 @@ export default function CreateCluster(props: { infrastructureType: ClusterInfras
control.available = ['clusters', ...hostedClusterNamespaces.map((hcn) => hcn.metadata.name)]
}
break
case 'nodePoolName':
if (infrastructureType === Provider.kubevirt) {
control.validation = {
contextTester: validateKubeVirtNodePoolName,
required: true,
}
}
break
case 'additionalNetworks':
if (infrastructureType === Provider.kubevirt) {
control.validation = {
Expand Down