@@ -195,7 +195,7 @@ export class ClusterResourceHandler extends ResourceHandler {
195195 return this . updateClusterVersion ( this . newProps . version ) ;
196196 }
197197
198- if ( updates . updateLogging || updates . updateAccess || updates . updateVpc || updates . updateAuthMode ) {
198+ if ( updates . updateLogging || updates . updateAccess || updates . updateVpc || updates . updateAuthMode || updates . updateRemoteNetworkConfig ) {
199199 const config : EKS . UpdateClusterConfigCommandInput = {
200200 name : this . clusterName ,
201201 } ;
@@ -262,6 +262,10 @@ export class ClusterResourceHandler extends ResourceHandler {
262262 } ;
263263 }
264264
265+ if ( updates . updateRemoteNetworkConfig ) {
266+ config . remoteNetworkConfig = this . newProps . remoteNetworkConfig ;
267+ }
268+
265269 const updateResponse = await this . eks . updateClusterConfig ( config ) ;
266270
267271 return { EksUpdateId : updateResponse . update ?. id } ;
@@ -415,6 +419,7 @@ interface UpdateMap {
415419 updateBootstrapClusterCreatorAdminPermissions : boolean ; // accessConfig.bootstrapClusterCreatorAdminPermissions
416420 updateVpc : boolean ; // resourcesVpcConfig.subnetIds and securityGroupIds
417421 updateTags : boolean ; // tags
422+ updateRemoteNetworkConfig : boolean ; // remoteNetworkConfig
418423}
419424
420425function analyzeUpdate ( oldProps : Partial < EKS . CreateClusterCommandInput > , newProps : EKS . CreateClusterCommandInput ) : UpdateMap {
@@ -431,6 +436,9 @@ function analyzeUpdate(oldProps: Partial<EKS.CreateClusterCommandInput>, newProp
431436 const newAccessConfig = newProps . accessConfig || { } ;
432437 const oldAccessConfig = oldProps . accessConfig || { } ;
433438
439+ const oldRemoteNetworkConfig = oldProps . remoteNetworkConfig || { } ;
440+ const newRemoteNetworkConfig = newProps . remoteNetworkConfig || { } ;
441+
434442 return {
435443 replaceName : newProps . name !== oldProps . name ,
436444 updateVpc :
@@ -448,6 +456,7 @@ function analyzeUpdate(oldProps: Partial<EKS.CreateClusterCommandInput>, newProp
448456 updateBootstrapClusterCreatorAdminPermissions : JSON . stringify ( newAccessConfig . bootstrapClusterCreatorAdminPermissions ) !==
449457 JSON . stringify ( oldAccessConfig . bootstrapClusterCreatorAdminPermissions ) ,
450458 updateTags : JSON . stringify ( newProps . tags ) !== JSON . stringify ( oldProps . tags ) ,
459+ updateRemoteNetworkConfig : ! compareRemoteNetworkConfigs ( oldRemoteNetworkConfig , newRemoteNetworkConfig ) ,
451460 } ;
452461}
453462
@@ -482,3 +491,54 @@ function getTagsToRemove<T extends Record<string, string>>(oldTags: T, newTags:
482491
483492 return missingKeys ;
484493}
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