Skip to content

Commit

Permalink
Ensure NEG Readiness Reflector commit endpoints from non-default
Browse files Browse the repository at this point in the history
subnets.
  • Loading branch information
sawsa307 committed Nov 4, 2024
1 parent 1f68588 commit 520b789
Show file tree
Hide file tree
Showing 2 changed files with 294 additions and 125 deletions.
17 changes: 15 additions & 2 deletions pkg/neg/syncers/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,9 +746,22 @@ 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 commiting pods")
continue
}

if endpointGroupInfo.Subnet != defaultSubnet {
negName = s.namer.NonDefaultSubnetNEG(s.NegSyncerKey.Namespace, s.NegSyncerKey.Name, endpointGroupInfo.Subnet, s.NegSyncerKey.PortTuple.Port)
}
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 520b789

Please sign in to comment.