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 d96f01d
Show file tree
Hide file tree
Showing 2 changed files with 292 additions and 124 deletions.
17 changes: 15 additions & 2 deletions pkg/neg/syncers/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,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 d96f01d

Please sign in to comment.