Skip to content

cluster manager: use clusters() instead of get() for main thread cluster validation#14204

Merged
mattklein123 merged 5 commits intomasterfrom
routing_without_thread_local_clusters
Dec 2, 2020
Merged

cluster manager: use clusters() instead of get() for main thread cluster validation#14204
mattklein123 merged 5 commits intomasterfrom
routing_without_thread_local_clusters

Conversation

@mattklein123
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 commented Nov 28, 2020

This is a follow up to #13906. It does a few different things:

  1. Renames get() to getThreadLocalCluster() to make it more clear what it does.
  2. Adds more functionality to clusters() to make it easier to use for validation.
  3. Replaces use of the thread local clusters with the main thread clusters() output for static route
    validation as well as some other places that were using thread local clusters when they should have
    been using main thread clusters during config ingestion.
  4. Make mocks default to no main thread clusters and no thread local clusters. Tests using mocks
    have to explicitly opt in to what clusters they want. This makes tests more intentional and less magical,
    but required a bunch of manual fixes. Overall this reduces quite a lot of test debt when using mocks.

This will enable further cleanups in the cluster manager
code.

Risk Level: Low
Testing: Existing tests
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

This is a follow up to #13906. It replaces use of the thread local
clusters with the main thread clusters() output for static route
validation. This will enable further cleanups in the cluster manager
code.

Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Copy Markdown
Member Author

This is not fully correct. Doing some more invasive work here to clean more stuff up.

/wait

Signed-off-by: Matt Klein <mklein@lyft.com>
…ead_local_clusters

Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123 mattklein123 changed the title route config: use clusters() instead of get() for route validation cluster manager: use clusters() instead of get() for main thread cluster validation Dec 1, 2020
@mattklein123
Copy link
Copy Markdown
Member Author

This is ready for review. It's mostly mechanical. I can split out the config_impl changes as that is the only real functional change if reviewers prefer.

…ead_local_clusters

Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Copy Markdown
Member Author

/retest

for OSX. I don't think clang-tidy is going to pass on this one.

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #14204 (comment) was created by @mattklein123.

see: more, trace.

Copy link
Copy Markdown
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

LGTM!

Very happy to see get() renamed, it's definitely been a bit of a gotcha.

@mattklein123 mattklein123 merged commit d7b10e8 into master Dec 2, 2020
@mattklein123 mattklein123 deleted the routing_without_thread_local_clusters branch December 2, 2020 19:52
@akonradi
Copy link
Copy Markdown
Contributor

Was ClusterManager::clusters() always unsafe to call on any but the main thread? If not, this seems like a breaking API change that could have caused silent failures.

@mattklein123
Copy link
Copy Markdown
Member Author

Was ClusterManager::clusters() always unsafe to call on any but the main thread? If not, this seems like a breaking API change that could have caused silent failures.

Yes. This probably should have been better documented and ASSERTed.

wozz added a commit to wozz/envoy that referenced this pull request Feb 28, 2021
due to envoyproxy#14204, doing static cluster checks for AsyncClientFactory can only be done on the main thread. adds a ENVOY_BUG check to ensure that cluster checks are skipped when not running on the main thread.

Signed-off-by: Michael Wozniak <wozz@koh.ms>

Signed-off-by: wozz <wozz@users.noreply.github.com>
mattklein123 pushed a commit that referenced this pull request Mar 4, 2021
Due to #14204, doing static cluster checks for AsyncClientFactory can only be done on the main thread. 

Signed-off-by: Michael Wozniak <wozz@koh.ms>
rexengineering pushed a commit to rexengineering/istio-envoy that referenced this pull request Oct 15, 2021
Due to envoyproxy/envoy#14204, doing static cluster checks for AsyncClientFactory can only be done on the main thread. 

Signed-off-by: Michael Wozniak <wozz@koh.ms>
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.

4 participants