Skip to content

Commit 72f7125

Browse files
authored
ACM-17523: Fixing duplicate Node Pool Names error during Cluster Provisioning. (stolostron#4259)
* fixing duplicate node pool name error during cluster creation Signed-off-by: Nitin Dhevar <nitin.dhanabalan@gmail.com> * updating error text for duplicate nodepool name Signed-off-by: Nitin Dhevar <nitin.dhanabalan@gmail.com> --------- Signed-off-by: Nitin Dhevar <nitin.dhanabalan@gmail.com>
1 parent f97643f commit 72f7125

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

frontend/public/locales/en/translation.json

+1
Original file line numberDiff line numberDiff line change
@@ -1986,6 +1986,7 @@
19861986
"node.status.ready": "Ready",
19871987
"node.status.unhealthy": "Unhealthy",
19881988
"node.status.unknown": "Unknown",
1989+
"nodepoolname.exists.error": "The node pool name must be unique.",
19891990
"Nodes": "Nodes",
19901991
"nodes xN": "nodes xN",
19911992
"None": "None",

frontend/src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster/CreateCluster.tsx

+23
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,21 @@ export default function CreateCluster(props: { infrastructureType: ClusterInfras
376376
return undefined
377377
}
378378

379+
function validateKubeVirtNodePoolName(active: any, _controlData: any, templateObjectMap: any) {
380+
const totalNodePools = templateObjectMap['<<main>>'].NodePool.length
381+
const current = templateObjectMap['<<main>>'].NodePool[totalNodePools - 1].$raw.metadata.name
382+
if (totalNodePools > 1) {
383+
for (let i = 0; i < totalNodePools - 1; i++) {
384+
if (current === templateObjectMap['<<main>>'].NodePool[i].$raw.metadata.name)
385+
return t('nodepoolname.exists.error')
386+
}
387+
}
388+
if (!KubeVirtNamespaceRegExp.test(active)) {
389+
return t('import.form.invalid.dns.label')
390+
}
391+
return undefined
392+
}
393+
379394
function onControlInitialize(control: any) {
380395
switch (control.id) {
381396
case 'connection':
@@ -395,6 +410,14 @@ export default function CreateCluster(props: { infrastructureType: ClusterInfras
395410
control.available = ['clusters', ...hostedClusterNamespaces.map((hcn) => hcn.metadata.name)]
396411
}
397412
break
413+
case 'nodePoolName':
414+
if (infrastructureType === Provider.kubevirt) {
415+
control.validation = {
416+
contextTester: validateKubeVirtNodePoolName,
417+
required: true,
418+
}
419+
}
420+
break
398421
case 'additionalNetworks':
399422
if (infrastructureType === Provider.kubevirt) {
400423
control.validation = {

0 commit comments

Comments
 (0)