@@ -629,18 +629,18 @@ func (s *transactionSyncer) syncNetworkEndpoints(addEndpoints, removeEndpoints m
629629}
630630
631631// attachNetworkEndpoints runs operation for attaching network endpoints.
632- func (s * transactionSyncer ) attachNetworkEndpoints (epGroupInfo negtypes.NEGLocation , networkEndpointMap map [negtypes.NetworkEndpoint ]* composite.NetworkEndpoint ) {
633- s .logger .V (2 ).Info ("Attaching endpoints to NEG." , "countOfEndpointsBeingAttached" , len (networkEndpointMap ), "negSyncerKey" , s .NegSyncerKey .String (), "zone" , epGroupInfo .Zone , "subnet" , epGroupInfo .Subnet )
634- err := s .operationInternal (attachOp , epGroupInfo , networkEndpointMap , s .logger )
632+ func (s * transactionSyncer ) attachNetworkEndpoints (negLocation negtypes.NEGLocation , networkEndpointMap map [negtypes.NetworkEndpoint ]* composite.NetworkEndpoint ) {
633+ s .logger .V (2 ).Info ("Attaching endpoints to NEG." , "countOfEndpointsBeingAttached" , len (networkEndpointMap ), "negSyncerKey" , s .NegSyncerKey .String (), "zone" , negLocation .Zone , "subnet" , negLocation .Subnet )
634+ err := s .operationInternal (attachOp , negLocation , networkEndpointMap , s .logger )
635635
636636 // WARNING: commitTransaction must be called at last for analyzing the operation result
637637 s .commitTransaction (err , networkEndpointMap )
638638}
639639
640640// detachNetworkEndpoints runs operation for detaching network endpoints.
641- func (s * transactionSyncer ) detachNetworkEndpoints (epGroupInfo negtypes.NEGLocation , networkEndpointMap map [negtypes.NetworkEndpoint ]* composite.NetworkEndpoint , hasMigrationDetachments bool ) {
642- s .logger .V (2 ).Info ("Detaching endpoints from NEG." , "countOfEndpointsBeingDetached" , len (networkEndpointMap ), "negSyncerKey" , s .NegSyncerKey .String (), "zone" , epGroupInfo .Zone , "subnet" , epGroupInfo .Subnet )
643- err := s .operationInternal (detachOp , epGroupInfo , networkEndpointMap , s .logger )
641+ func (s * transactionSyncer ) detachNetworkEndpoints (negLocation negtypes.NEGLocation , networkEndpointMap map [negtypes.NetworkEndpoint ]* composite.NetworkEndpoint , hasMigrationDetachments bool ) {
642+ s .logger .V (2 ).Info ("Detaching endpoints from NEG." , "countOfEndpointsBeingDetached" , len (networkEndpointMap ), "negSyncerKey" , s .NegSyncerKey .String (), "zone" , negLocation .Zone , "subnet" , negLocation .Subnet )
643+ err := s .operationInternal (detachOp , negLocation , networkEndpointMap , s .logger )
644644
645645 if hasMigrationDetachments {
646646 // Unpause the migration since the ongoing migration-detachments have
@@ -655,14 +655,14 @@ func (s *transactionSyncer) detachNetworkEndpoints(epGroupInfo negtypes.NEGLocat
655655// operationInternal executes NEG API call and commits the transactions
656656// It will record events when operations are completed
657657// If error occurs or any transaction entry requires reconciliation, it will trigger resync
658- func (s * transactionSyncer ) operationInternal (operation transactionOp , epGroupInfo negtypes.NEGLocation , networkEndpointMap map [negtypes.NetworkEndpoint ]* composite.NetworkEndpoint , logger klog.Logger ) error {
658+ func (s * transactionSyncer ) operationInternal (operation transactionOp , negLocation negtypes.NEGLocation , networkEndpointMap map [negtypes.NetworkEndpoint ]* composite.NetworkEndpoint , logger klog.Logger ) error {
659659 var err error
660660 start := time .Now ()
661661 networkEndpoints := []* composite.NetworkEndpoint {}
662662 for _ , ne := range networkEndpointMap {
663663 networkEndpoints = append (networkEndpoints , ne )
664664 }
665- zone := epGroupInfo .Zone
665+ zone := negLocation .Zone
666666 negName := s .NegSyncerKey .NegName
667667 if flags .F .EnableMultiSubnetClusterPhase1 {
668668 defaultSubnet , err := utils .KeyName (s .networkInfo .SubnetworkURL )
@@ -676,8 +676,8 @@ func (s *transactionSyncer) operationInternal(operation transactionOp, epGroupIn
676676 // (epGroupInfo.Subnet) is not the defaultSubnet, we are dealing with
677677 // the Multi-Subnet Cluster use case, wherein the name of the NEG would
678678 // need to be different.
679- if s .networkInfo .IsDefault && epGroupInfo .Subnet != defaultSubnet {
680- negName , err = s .getNonDefaultSubnetNEGName (epGroupInfo .Subnet )
679+ if s .networkInfo .IsDefault && negLocation .Subnet != defaultSubnet {
680+ negName , err = s .getNonDefaultSubnetNEGName (negLocation .Subnet )
681681 if err != nil {
682682 s .logger .Error (err , "Errored getting non-default subnet NEG name when updating NEG endpoints" )
683683 return err
0 commit comments