Skip to content

Commit

Permalink
Ensure NEG Readiness Reflector commits endpoints from non-default
Browse files Browse the repository at this point in the history
subnets.
  • Loading branch information
sawsa307 committed Nov 19, 2024
1 parent 7a865c7 commit 890034f
Show file tree
Hide file tree
Showing 2 changed files with 297 additions and 124 deletions.
22 changes: 20 additions & 2 deletions pkg/neg/syncers/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,27 @@ func (s *transactionSyncer) commitPods(endpointMap map[negtypes.EndpointGroupInf
}
zoneEndpointMap[endpoint] = podName
}
// TODO(sawsa307): Make sure commitPods is called for non-default subnet NEGs.
negName := s.NegSyncerKey.NegName
syncerKey := s.NegSyncerKey
if flags.F.EnableMultiSubnetClusterPhase1 {
defaultSubnet, err := utils.KeyName(s.networkInfo.SubnetworkURL)
if err != nil {
s.logger.Error(err, "Errored getting default subnet from NetworkInfo when committing pods")
continue
}

if endpointGroupInfo.Subnet != defaultSubnet {
negName, err = s.getNonDefaultSubnetName(endpointGroupInfo.Subnet)
if err != nil {
s.logger.Error(err, "Errored getting non-default subnet NEG name when committing pods")
continue
}
}
// To ensure syncerKey has the same information as the passed in NEG name.
syncerKey.NegName = negName
}
// Only zone is needed because NEGs from non-default subnet have different names.
s.reflector.CommitPods(s.NegSyncerKey, s.NegSyncerKey.NegName, endpointGroupInfo.Zone, zoneEndpointMap)
s.reflector.CommitPods(syncerKey, negName, endpointGroupInfo.Zone, zoneEndpointMap)
}
}

Expand Down
Loading

0 comments on commit 890034f

Please sign in to comment.