File tree 2 files changed +24
-0
lines changed
src/routes/Infrastructure/Clusters/ManagedClusters/CreateCluster
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1986
1986
"node.status.ready" : " Ready" ,
1987
1987
"node.status.unhealthy" : " Unhealthy" ,
1988
1988
"node.status.unknown" : " Unknown" ,
1989
+ "nodepoolname.exists.error" : " The node pool name must be unique." ,
1989
1990
"Nodes" : " Nodes" ,
1990
1991
"nodes xN" : " nodes xN" ,
1991
1992
"None" : " None" ,
Original file line number Diff line number Diff line change @@ -376,6 +376,21 @@ export default function CreateCluster(props: { infrastructureType: ClusterInfras
376
376
return undefined
377
377
}
378
378
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
+
379
394
function onControlInitialize ( control : any ) {
380
395
switch ( control . id ) {
381
396
case 'connection' :
@@ -395,6 +410,14 @@ export default function CreateCluster(props: { infrastructureType: ClusterInfras
395
410
control . available = [ 'clusters' , ...hostedClusterNamespaces . map ( ( hcn ) => hcn . metadata . name ) ]
396
411
}
397
412
break
413
+ case 'nodePoolName' :
414
+ if ( infrastructureType === Provider . kubevirt ) {
415
+ control . validation = {
416
+ contextTester : validateKubeVirtNodePoolName ,
417
+ required : true ,
418
+ }
419
+ }
420
+ break
398
421
case 'additionalNetworks' :
399
422
if ( infrastructureType === Provider . kubevirt ) {
400
423
control . validation = {
You can’t perform that action at this time.
0 commit comments