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

internal/contour: filter EDS notifications #1480

Merged
merged 2 commits into from
Sep 11, 2019

Conversation

davecheney
Copy link
Contributor

@davecheney davecheney commented Sep 10, 2019

Updates #426
Updates #499

This PR consolidates all the internal/contour caches on the Cond type. The Cond 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.

Allow the caller of Register to pass a set of hints to be notified on.

Signed-off-by: Dave Cheney <[email protected]>
@davecheney davecheney added this to the 1.0.0-beta.1 milestone Sep 10, 2019
@davecheney davecheney merged commit 89d300a into projectcontour:master Sep 11, 2019
@davecheney davecheney deleted the issue/426 branch September 11, 2019 01:15
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants