Skip to content

grpc access log: verify cluster exists and is static#2360

Merged
htuch merged 2 commits intomasterfrom
access_log_cluster_fix
Jan 14, 2018
Merged

grpc access log: verify cluster exists and is static#2360
htuch merged 2 commits intomasterfrom
access_log_cluster_fix

Conversation

@mattklein123
Copy link
Copy Markdown
Member

Risk Level: Low
Testing: Unit
Docs Changes: N/A
Release Notes: N/A

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

@junr03 @ccaraman @lita @rodaine PTAL

// TODO(htuch): Support Google gRPC client.
const auto cluster_name = proto_config.common_config().grpc_service().envoy_grpc().cluster_name();
auto cluster = context.clusterManager().get(cluster_name);
if (cluster == nullptr || cluster->info()->addedViaApi()) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what is the difference between a static cluster vs a cluster added by api?

Copy link
Copy Markdown
Contributor

@ccaraman ccaraman Jan 12, 2018

Choose a reason for hiding this comment

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

Static cluster is one defined in the config. A cluster added by api would be a cluster added via CDS.

ccaraman
ccaraman previously approved these changes Jan 12, 2018
Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Copy Markdown
Member Author

Discussed this with @htuch and I think we will move this check into the base AsyncClient for now as I think we want this in all existing use cases.

@mattklein123
Copy link
Copy Markdown
Member Author

Hmm. I just looked and this is not so easy, as we don't create the AsyncClient in this case until we get into TLS code, unlike many of the existing main thread use cases. I think the best I can do is potentially make a utility function for this check? @htuch WDYT?

@htuch
Copy link
Copy Markdown
Member

htuch commented Jan 13, 2018 via email

@mattklein123
Copy link
Copy Markdown
Member Author

Are we relying on client creation to be cheap and potentially reuse an existing connection?

In general, yes, but not in the case of access log where we are more careful about TLS data structures and will keep the client around for a long time. There are other cases (rate limit is one for sure) where we create a new client on every request. This is not optimal but works OK with the Envoy gRPC client.

@mattklein123
Copy link
Copy Markdown
Member Author

@htuch I'm inclined to just merge this and we can reconcile the error handling in a follow up PR? WDYT?

Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

OK, let's do this. I think we're going to have to iterate a bit here; the initial Google gRPC implementation will be sub-optimal for rate limit for sure, we'll be missing some checks for Envoy gRPC where they should be as well. Keep in mind that there are two in-flight PRs that will be adding new gRPC client users.

@htuch htuch merged commit 3024f25 into master Jan 14, 2018
@htuch htuch deleted the access_log_cluster_fix branch January 14, 2018 17:01
@ramaraochavali
Copy link
Copy Markdown
Contributor

@mattklein123 @htuch i was thinking of doing similar validation for metrics service. Should I do the same or wait till it is finalised on how this should be done generically?

@htuch
Copy link
Copy Markdown
Member

htuch commented Jan 15, 2018 via email

@ramaraochavali
Copy link
Copy Markdown
Contributor

Cool. Thanks

@ramaraochavali
Copy link
Copy Markdown
Contributor

@htuch did you push this static cluster validation?

@htuch
Copy link
Copy Markdown
Member

htuch commented Feb 2, 2018

@ramaraochavali yes, this was done in #2393.

@ramaraochavali
Copy link
Copy Markdown
Contributor

@htuch Great. Thanks.

Shikugawa pushed a commit to Shikugawa/envoy that referenced this pull request Mar 28, 2020
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.

6 participants