-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create additional NEGs based on subnets in Node Topology CR. #2702
Create additional NEGs based on subnets in Node Topology CR. #2702
Conversation
sawsa307
commented
Oct 18, 2024
- Query Node Topology CR for the current set of NEGs in the cluster.
- When ensureNetworkEndpointGroups(), ensure NEGs are properly provisioned in the non-default subnets as well.
2f593bb
to
29bc49a
Compare
/assign @gauravkghildiyal |
644e229
to
264bd6c
Compare
/label tide/merge-method-squash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just addressed all the comments, @gauravkghildiyal could you take another look when you have time? Thank you!
Also, is this TODO something that we plan on fixing independently? I guess as long as the MSC flags are disabled, this shouldn't cause any problems but please do confirm. Thanks! |
Yes I'm planning to tackle those TODO in follow up PRs(like #2728), but if you would like, I can also include some of them in this PR as well. |
4bc66aa
to
6d44fe7
Compare
pkg/utils/zonegetter/zone_getter.go
Outdated
nodeTopologyNotSynced := z.nodeTopologyInformer != nil && !z.nodeTopologyHasSynced() | ||
if z.onlyIncludeDefaultSubnetNodes || z.nodeTopologyInformer == nil || nodeTopologyNotSynced { | ||
if z.nodeTopologyInformer == nil || nodeTopologyNotSynced { | ||
logger.Info("NodeTopologyInformer is not ready, fall back to use default subnet only") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend
logger.Info("Falling back to only using default subnet", "z.onlyIncludeDefaultSubnetNodes", z.onlyIncludeDefaultSubnetNodes, <Rest of the variables influencing this decision>)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be useful to know what was the reason why we are using "default subnet only", which means it's worth logging ALL the variables which went into that decision. So maybe we don't have an if !z.nodeTopologyHasSynced() {
condition for the logs, and instead log:
logger.Info("Falling back to only using default subnet when listing nodes", "z.onlyIncludeDefaultSubnetNodes", z.onlyIncludeDefaultSubnetNodes, "z.nodeTopologyHasSynced()", nodeTopologyHasSynced)
On a related note, it plan on using or logging z.nodeTopologyHasSynced()
, it may be useful to store it in a variable before. Reason being that since it's a function, it may return a different value between two independent invocations -- if that ever happens for some reason, our logs would simply end up confusing us.
* Remove NodeTopologyInformer from controller context hasSynced so it won't block controllers from starting up in case of the CRD or CR does not exist.
6d44fe7
to
055d691
Compare
@gauravkghildiyal @swetharepakula This PR is ready for another round of review, please take a look, thank you! |
Github is just the worst at showing newly added comments so sharing the links: |
Addressed both comments, please take a look! @gauravkghildiyal |
pkg/utils/namer/interfaces.go
Outdated
@@ -60,6 +62,9 @@ type BackendNamer interface { | |||
// RXLBBackendName returns the Regional External Ingress backend name, | |||
// based on the service namespace, name and target port. | |||
RXLBBackendName(namespace, name string, port int32) string | |||
// NonDefaultSubnetCustomNEG returns the gce neg name for custom NEGs created | |||
// in non-default subnets. | |||
NonDefaultSubnetCustomNEG(customNEGName, subnetName string) (string, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this needs to be cleaned up (because the embedded NonDefaultSubnetNEGNamer already defines the same)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thanks!
pkg/neg/manager.go
Outdated
@@ -228,6 +232,11 @@ func (manager *syncerManager) EnsureSyncers(namespace, name string, newPorts neg | |||
&portInfo.NetworkInfo, | |||
portInfo.L4LBType, | |||
) | |||
negNamer := manager.namer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Maybe rename to nonDefaultSubnetNEGNamer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thanks!
@@ -79,6 +80,15 @@ func (namer *L4Namer) L4NonDefaultSubnetNEG(namespace, name, subnetName string) | |||
}, "-") | |||
} | |||
|
|||
// NonDefaultSubnetCustomNEG returns the gce neg name in the non-default subnet | |||
// when the NEG name is a custom one. | |||
func (n *L4Namer) NonDefaultSubnetCustomNEG(customNEGName, subnetName string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a note here that as of today, we don't support custom NEG names in L4 NEGs. Let's also Log a function call to this as an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thanks!
@@ -883,6 +928,19 @@ func (s *transactionSyncer) computeEPSStaleness(endpointSlices []*discovery.Endp | |||
} | |||
} | |||
|
|||
// getNonDefaultSubnetName returns the name of the NEG based on the subnet name. | |||
func (s *transactionSyncer) getNonDefaultSubnetName(subnet string) (string, error) { | |||
if s.customName { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we still need to adjust the value stored in s.customName
such that for L4 NEGs, this is always false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
* Query Node Topology CR for the current set of NEGs in the cluster. * When ensureNetworkEndpointGroups(), ensure NEGs are properly provisioned in the non-default subnets as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed all the comments, thank you!
@@ -883,6 +928,19 @@ func (s *transactionSyncer) computeEPSStaleness(endpointSlices []*discovery.Endp | |||
} | |||
} | |||
|
|||
// getNonDefaultSubnetName returns the name of the NEG based on the subnet name. | |||
func (s *transactionSyncer) getNonDefaultSubnetName(subnet string) (string, error) { | |||
if s.customName { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
pkg/utils/namer/interfaces.go
Outdated
@@ -60,6 +62,9 @@ type BackendNamer interface { | |||
// RXLBBackendName returns the Regional External Ingress backend name, | |||
// based on the service namespace, name and target port. | |||
RXLBBackendName(namespace, name string, port int32) string | |||
// NonDefaultSubnetCustomNEG returns the gce neg name for custom NEGs created | |||
// in non-default subnets. | |||
NonDefaultSubnetCustomNEG(customNEGName, subnetName string) (string, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thanks!
@@ -79,6 +80,15 @@ func (namer *L4Namer) L4NonDefaultSubnetNEG(namespace, name, subnetName string) | |||
}, "-") | |||
} | |||
|
|||
// NonDefaultSubnetCustomNEG returns the gce neg name in the non-default subnet | |||
// when the NEG name is a custom one. | |||
func (n *L4Namer) NonDefaultSubnetCustomNEG(customNEGName, subnetName string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thanks!
pkg/neg/manager.go
Outdated
@@ -228,6 +232,11 @@ func (manager *syncerManager) EnsureSyncers(namespace, name string, newPorts neg | |||
&portInfo.NetworkInfo, | |||
portInfo.L4LBType, | |||
) | |||
negNamer := manager.namer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thanks!
2121863
to
e1410e0
Compare
Did a squash over the previous fix-up to make it cleaner, thanks! |
55732d4
to
157daa7
Compare
/lgtm Thank you for the patience! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gauravkghildiyal, sawsa307 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |