-
Notifications
You must be signed in to change notification settings - Fork 690
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
internal/contour: filter EDS notifications #1480
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updates projectcontour#426 Signed-off-by: Dave Cheney <[email protected]>
Allow the caller of Register to pass a set of hints to be notified on. Signed-off-by: Dave Cheney <[email protected]>
stevesloka
approved these changes
Sep 11, 2019
davecheney
added a commit
to davecheney/contour
that referenced
this pull request
Sep 18, 2019
Fixes projectcontour#1514 On Sept 10th I introduced a bug in projectcontour#1480 which caused Cond.Register() calls that supplied a hint, such as Envoy's RDS requests, to only receive one initial update then ignore any further table updates. The cause was a shadowing but on line 64 where `hints` was shadow from outside the loop. The result was the `len(hints) == 0` condition would be false, yet the map lookup version later would never be true because the map would be empty. Rewrite `Notify` to make it harder to shadow the variable `hints` and also avoid the deeply nested logic requiring a break from the inner loop to the outer loop. The new approach is slower for large values of registered or notifited hints, but the former is usually no more than one as Envoy either asks for everything, or a specific resource, and the latter is often zero and only in the case of EDS one entry, so the overall cost should be reasonable compared with the previous implementation. Signed-off-by: Dave Cheney <[email protected]>
davecheney
added a commit
to davecheney/contour
that referenced
this pull request
Sep 18, 2019
Fixes projectcontour#1514 On Sept 10th I introduced a bug in projectcontour#1480 which caused Cond.Register() calls that supplied a hint, such as Envoy's RDS requests, to only receive one initial update then ignore any further table updates. The cause was a shadowing but on line 64 where `hints` was shadow from outside the loop. The result was the `len(hints) == 0` condition would be false, yet the map lookup version later would never be true because the map would be empty. Rewrite `Notify` to make it harder to shadow the variable `hints` and also avoid the deeply nested logic requiring a break from the inner loop to the outer loop. The new approach is slower for large values of registered or notifited hints, but the former is usually no more than one as Envoy either asks for everything, or a specific resource, and the latter is often zero and only in the case of EDS one entry, so the overall cost should be reasonable compared with the previous implementation. Signed-off-by: Dave Cheney <[email protected]>
davecheney
added a commit
to davecheney/contour
that referenced
this pull request
Sep 18, 2019
Fixes projectcontour#1514 On Sept 10th I introduced a bug in projectcontour#1480 which caused Cond.Register() calls that supplied a hint, such as Envoy's RDS requests, to only receive one initial update then ignore any further table updates. The cause was a shadowing but on line 64 where `hints` was shadow from outside the loop. The result was the `len(hints) == 0` condition would be false, yet the map lookup version later would never be true because the map would be empty. Rewrite `Notify` to make it harder to shadow the variable `hints` and also avoid the deeply nested logic requiring a break from the inner loop to the outer loop. The new approach is slower for large values of registered or notifited hints, but the former is usually no more than one as Envoy either asks for everything, or a specific resource, and the latter is often zero and only in the case of EDS one entry, so the overall cost should be reasonable compared with the previous implementation. Signed-off-by: Dave Cheney <[email protected]>
davecheney
added a commit
that referenced
this pull request
Sep 18, 2019
Fixes #1514 On Sept 10th I introduced a bug in #1480 which caused Cond.Register() calls that supplied a hint, such as Envoy's RDS requests, to only receive one initial update then ignore any further table updates. The cause was a shadowing but on line 64 where `hints` was shadow from outside the loop. The result was the `len(hints) == 0` condition would be false, yet the map lookup version later would never be true because the map would be empty. Rewrite `Notify` to make it harder to shadow the variable `hints` and also avoid the deeply nested logic requiring a break from the inner loop to the outer loop. The new approach is slower for large values of registered or notifited hints, but the former is usually no more than one as Envoy either asks for everything, or a specific resource, and the latter is often zero and only in the case of EDS one entry, so the overall cost should be reasonable compared with the previous implementation. Signed-off-by: Dave Cheney <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updates #426
Updates #499
This PR consolidates all the
internal/contour
caches on theCond
type. TheCond
type has been taught to send notifications to only those who register for those notification. At the moment this is only used for EDS however CDS and SDS may be possible. LDS and RDS are not useful as they only contain two entries each.