@@ -195,7 +195,7 @@ export class ClusterResourceHandler extends ResourceHandler {
195
195
return this . updateClusterVersion ( this . newProps . version ) ;
196
196
}
197
197
198
- if ( updates . updateLogging || updates . updateAccess || updates . updateVpc || updates . updateAuthMode ) {
198
+ if ( updates . updateLogging || updates . updateAccess || updates . updateVpc || updates . updateAuthMode || updates . updateRemoteNetworkConfig ) {
199
199
const config : EKS . UpdateClusterConfigCommandInput = {
200
200
name : this . clusterName ,
201
201
} ;
@@ -262,6 +262,10 @@ export class ClusterResourceHandler extends ResourceHandler {
262
262
} ;
263
263
}
264
264
265
+ if ( updates . updateRemoteNetworkConfig ) {
266
+ config . remoteNetworkConfig = this . newProps . remoteNetworkConfig ;
267
+ }
268
+
265
269
const updateResponse = await this . eks . updateClusterConfig ( config ) ;
266
270
267
271
return { EksUpdateId : updateResponse . update ?. id } ;
@@ -415,6 +419,7 @@ interface UpdateMap {
415
419
updateBootstrapClusterCreatorAdminPermissions : boolean ; // accessConfig.bootstrapClusterCreatorAdminPermissions
416
420
updateVpc : boolean ; // resourcesVpcConfig.subnetIds and securityGroupIds
417
421
updateTags : boolean ; // tags
422
+ updateRemoteNetworkConfig : boolean ; // remoteNetworkConfig
418
423
}
419
424
420
425
function analyzeUpdate ( oldProps : Partial < EKS . CreateClusterCommandInput > , newProps : EKS . CreateClusterCommandInput ) : UpdateMap {
@@ -431,6 +436,9 @@ function analyzeUpdate(oldProps: Partial<EKS.CreateClusterCommandInput>, newProp
431
436
const newAccessConfig = newProps . accessConfig || { } ;
432
437
const oldAccessConfig = oldProps . accessConfig || { } ;
433
438
439
+ const oldRemoteNetworkConfig = oldProps . remoteNetworkConfig || { } ;
440
+ const newRemoteNetworkConfig = newProps . remoteNetworkConfig || { } ;
441
+
434
442
return {
435
443
replaceName : newProps . name !== oldProps . name ,
436
444
updateVpc :
@@ -448,6 +456,7 @@ function analyzeUpdate(oldProps: Partial<EKS.CreateClusterCommandInput>, newProp
448
456
updateBootstrapClusterCreatorAdminPermissions : JSON . stringify ( newAccessConfig . bootstrapClusterCreatorAdminPermissions ) !==
449
457
JSON . stringify ( oldAccessConfig . bootstrapClusterCreatorAdminPermissions ) ,
450
458
updateTags : JSON . stringify ( newProps . tags ) !== JSON . stringify ( oldProps . tags ) ,
459
+ updateRemoteNetworkConfig : ! compareRemoteNetworkConfigs ( oldRemoteNetworkConfig , newRemoteNetworkConfig ) ,
451
460
} ;
452
461
}
453
462
@@ -482,3 +491,54 @@ function getTagsToRemove<T extends Record<string, string>>(oldTags: T, newTags:
482
491
483
492
return missingKeys ;
484
493
}
494
+
495
+ function compareRemoteNetworkConfigs (
496
+ oldConfig ?: EKS . RemoteNetworkConfigRequest | undefined ,
497
+ newConfig ?: EKS . RemoteNetworkConfigRequest | undefined ,
498
+ ) : boolean {
499
+ if ( ! oldConfig && ! newConfig ) {
500
+ return true ;
501
+ }
502
+
503
+ if ( ! oldConfig || ! newConfig ) {
504
+ return false ;
505
+ }
506
+
507
+ const nodeNetworksEqual = compareNetworkArrays (
508
+ oldConfig . remoteNodeNetworks ,
509
+ newConfig . remoteNodeNetworks ,
510
+ ) ;
511
+
512
+ const podNetworksEqual = compareNetworkArrays (
513
+ oldConfig . remotePodNetworks ,
514
+ newConfig . remotePodNetworks ,
515
+ ) ;
516
+
517
+ return nodeNetworksEqual && podNetworksEqual ;
518
+ }
519
+
520
+ function compareNetworkArrays (
521
+ oldNetworks ?: ( EKS . RemoteNodeNetwork | EKS . RemotePodNetwork ) [ ] | undefined ,
522
+ newNetworks ?: ( EKS . RemoteNodeNetwork | EKS . RemotePodNetwork ) [ ] | undefined ,
523
+ ) : boolean {
524
+ if ( ! oldNetworks && ! newNetworks ) {
525
+ return true ;
526
+ }
527
+
528
+ if ( ! oldNetworks || ! newNetworks ) {
529
+ return false ;
530
+ }
531
+
532
+ if ( oldNetworks . length !== newNetworks . length ) {
533
+ return false ;
534
+ }
535
+
536
+ const oldCidrs = oldNetworks . flatMap ( network => network . cidrs || [ ] ) . sort ( ) ;
537
+ const newCidrs = newNetworks . flatMap ( network => network . cidrs || [ ] ) . sort ( ) ;
538
+
539
+ if ( oldCidrs . length !== newCidrs . length ) {
540
+ return false ;
541
+ }
542
+
543
+ return oldCidrs . every ( ( cidr , index ) => cidr === newCidrs [ index ] ) ;
544
+ }
0 commit comments