Skip to content
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

Trigger NEG syncers to sync on Node Topology CRD changes. #2677

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sawsa307
Copy link
Contributor

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 17, 2024
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 17, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sawsa307
Once this PR has been reviewed and has the lgtm label, please ask for approval from gauravkghildiyal. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

* Add NodeInformer to NewController, and add fake informer to test
  cases.
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 18, 2024
* When zones or subnets of a cluster changes, all syncers react to this
  change by either creating additional NEGs in new zone/subnet, or mark
  NEGs as Inactive/To-be-deleted.
@sawsa307
Copy link
Contributor Author

/retest

Copy link
Member

@gauravkghildiyal gauravkghildiyal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have left a few comments and have one additional one:

Have we considered starting a filtered informer for NodeTopology which only informs changes to a specific resource? You can make the name of that resource pluggable through a flag to get some flexibility.

I can see why choosing the option of having an un-filtered informer might offer more flexibility for future use cases, where things might work naturally if you ever have multiple NodeTopology resources. But on the other hand, I also feel that if such a case actually arises, it would warrant some additional thought and verification (like maybe not syncing all syncers for each NodeTopology resource? or something like that)

This specific aspect may benefit from getting an additional opinion (@swetharepakula)

@@ -322,6 +324,27 @@ func NewController(
}
},
})
if flags.F.EnableMultiSubnetClusterPhase1 {
nodeTopologyInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we were to add a very simple unit test which verifies transitions to the NodeTopology CR triggering sync or not, I think we may spot a bug :)

@@ -322,6 +324,27 @@ func NewController(
}
},
})
if flags.F.EnableMultiSubnetClusterPhase1 {
nodeTopologyInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to not watch for AddEvents?

(For not having DeleteEvents, that does somewhat make sense)

subnetChanged = true
}
if zoneChanged || subnetChanged {
manager.SyncAllSyncers()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment here, noting that we are fine with syncing all syncers within the same goroutine as the informer-handler because we don't expect this CR to change very frequently.

Alternatively, if that is not the case, we should likely be using an intermediate queue here (like we do for the rest of the informers)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants