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 go-control-plane instantiation order #5972

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

skriss
Copy link
Member

@skriss skriss commented Nov 16, 2023

Previously, the go-control-plane snapshot cache was not instantiated and wired up to the snapshot handler (via a snapshotter) until after the first DAG run was completed and during the xDS server startup. As a result, the first DAG run never populated the go-control plane snapshot cache, so the go-control-plane xDS server had nothing to respond to initial discovery requests with.

This moves the wiring of the snapshot handler to the snapshot cache up to where the snapshot handler itself is instantiated, before any runnables are started. It also removes the unneeded snapshotter layer of indirection. The snapshot handler now directly generates a go-control-plane snapshot and stores it in the snapshot cache.

// the contents of the Contour xDS caches after the DAG is built.
snapshotHandler := xdscache_v3.NewSnapshotHandler(
resources,
envoy_cache_v3.NewSnapshotCache(false, &contour_xds_v3.Hash, s.log.WithField("context", "snapshotCache")),
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the important change, the snapshot handler is now connected to the snapshot cache before any runnables are started.

@@ -1,56 +0,0 @@
// Copyright Project Contour Authors
Copy link
Member Author

Choose a reason for hiding this comment

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

This seemed like an unnecessary layer of indirection between the snapshot handler and snapshot cache. Those two are now directly connected.

Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Merging #5972 (4b0ba66) into main (42ee2b4) will increase coverage by 0.05%.
Report is 1 commits behind head on main.
The diff coverage is 0.00%.

❗ Current head 4b0ba66 differs from pull request most recent head ed23722. Consider uploading reports for the commit ed23722 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5972      +/-   ##
==========================================
+ Coverage   78.59%   78.64%   +0.05%     
==========================================
  Files         139      138       -1     
  Lines       19638    19625      -13     
==========================================
  Hits        15434    15434              
+ Misses       3901     3888      -13     
  Partials      303      303              
Files Coverage Δ
internal/xds/v3/hash.go 0.00% <0.00%> (ø)
cmd/contour/serve.go 19.46% <0.00%> (-0.07%) ⬇️
internal/xdscache/v3/snapshot.go 0.00% <0.00%> (ø)

@skriss skriss added the release-note/small A small change that needs one line of explanation in the release notes. label Nov 16, 2023
@skriss skriss marked this pull request as ready for review November 17, 2023 00:17
@skriss skriss requested a review from a team as a code owner November 17, 2023 00:17
@skriss skriss requested review from tsaarni, stevesloka and sunjayBhatia and removed request for a team November 17, 2023 00:17
@skriss
Copy link
Member Author

skriss commented Nov 17, 2023

Ran through the E2E's a number of times on this PR and #5973 (which includes this change), had a couple seemingly unrelated flakes but overall looks good with many successful runs. I'm going to revert the E2E config change now.

Previously, the go-control-plane snapshot cache
was not instantiated and wired up to the snapshot
handler (via a snapshotter) until after the first
DAG run was completed and during the xDS server
startup. As a result, the first DAG run never
populated the go-control plane snapshot cache, so
the go-control-plane xDS server had nothing to
respond to initial discovery requests with.

This moves the wiring of the snapshot handler
to the snapshot cache up to where the snapshot
handler itself is instantiated, before any
runnables are started. It also removes the unneeded
snapshotter layer of indirection. The snapshot
handler now directly generates a go-control-plane
snapshot and stores it in the snapshot cache.

Signed-off-by: Steve Kriss <krisss@vmware.com>
@skriss skriss force-pushed the exp-go-control-plane-race branch from 4b0ba66 to ed23722 Compare November 17, 2023 16:55
Copy link
Member

@sunjayBhatia sunjayBhatia left a comment

Choose a reason for hiding this comment

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

Been playing around with this change this morning, adding some log lines in various places to watch contour startup in more detail, and as far as I can tell this looks correct
👍🏽 Should be able to fix the daily build e2e failures that happen on startup of contour. Nice work!

@skriss skriss merged commit e3e0f34 into projectcontour:main Nov 17, 2023
@skriss skriss deleted the exp-go-control-plane-race branch November 17, 2023 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/small A small change that needs one line of explanation in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants