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

fix: let NNCResonciler process update events with different generations when IPAMv2 is enabled #3279

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

Conversation

tyler-lloyd
Copy link
Contributor

Reason for Change:

IPAMv2 can handle update events even when the update is made from CNS itself, like patching
the spec for more IPs. This solves the problem of missed updates when a watch is re-established
and an NNC has been updated in both its spec and status. IPAMv2 is idempotent and will not
fall into a feedback loop where after CNS patches the NNC for more IPs its NNC reconciler still
sees IPs needed so it requests more IPs again, which triggers the reconciler again to request
more IPs, and so on ...

Issue Fixed:

Fixes #3278

Requirements:

Notes:

The first commit is the basic implementation. The 2nd commit does some more refactoring. I am fine to take just the first commit if you all don't like the refactoring attempt.

Group the predicate funcs into either
specific event filters or the "universal"
filters which get applied to every event
type. Then And() them which is what
controller-runtime event_handler is
functionally doing anyway.

link: https://github.com/kubernetes-sigs/controller-runtime/blob/aea2e32a936584b06ae6f7992f856fe7292b0297/pkg/internal/source/event_handler.go#L116
@tyler-lloyd tyler-lloyd requested a review from a team as a code owner December 18, 2024 21:47
Copy link
Member

@timraymond timraymond left a comment

Choose a reason for hiding this comment

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

This seems reasonable to me

@@ -1482,7 +1482,7 @@ func InitializeCRDState(ctx context.Context, httpRestService cns.HTTPService, cn
// wait for the Reconciler to run once on a NNC that was made for this Node.
// the nncReadyCtx has a timeout of 15 minutes, after which we will consider
// this false and the NNC Reconciler stuck/failed, log and retry.
nncReadyCtx, cancel := context.WithTimeout(ctx, 15*time.Minute) //nolint // it will time out and not leak
nncReadyCtx, cancel := context.WithTimeout(ctx, 15*time.Minute) // nolint // it will time out and not leak
Copy link
Member

Choose a reason for hiding this comment

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

I believe the nolint pragmas are intended to be directly next to the //

Suggested change
nncReadyCtx, cancel := context.WithTimeout(ctx, 15*time.Minute) // nolint // it will time out and not leak
nncReadyCtx, cancel := context.WithTimeout(ctx, 15*time.Minute) //nolint // it will time out and not leak

Copy link
Contributor Author

Choose a reason for hiding this comment

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

here's an arbitrary webpage to say that you're right. wonder why my auto formatter is changing these lines. https://golangci-lint.run/usage/false-positives/#:~:text=tests%20for%20it.-,Use,because,-machine%2Dreadable%20comments

will revert these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

except I wonder if //nolint by itself does anything and you really need to do //nolint:all so my formatter thinks these are just normal comments ... ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CNS can miss NNC updates when its watch is down
2 participants