-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
TLS Configuration Support for QueryServer and Dispatch Client #13645
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
aa7f666
Adding tls support for QueryServer
anandkrshaw cb35968
Adding tls support for QueryServer
anandkrshaw 79880f8
Improve logging
anandkrshaw 8c669f9
Add server tls config
anandkrshaw 3040823
Remove violation
anandkrshaw 64c409a
Add TLS support to Dispacth client
anandkrshaw 0a44b73
Fix test cases
anandkrshaw 0071294
Fix for review comments
anandkrshaw 1b4d5b7
Fix for review comments
anandkrshaw d771f61
Fix for review commenst
anandkrshaw d4e7b97
Make the SSL build context as util
anandkrshaw 22d0f23
Make the SSL build context as util
anandkrshaw 4915032
Make the SSL build context as util
anandkrshaw 4c5a937
Remove Local SSL context
anandkrshaw a5acd61
Remove Local SSL context
anandkrshaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,17 +20,20 @@ | |
|
||
import io.grpc.Server; | ||
import io.grpc.ServerBuilder; | ||
import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder; | ||
import io.grpc.stub.StreamObserver; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.TimeUnit; | ||
import org.apache.pinot.common.config.TlsConfig; | ||
import org.apache.pinot.common.exception.QueryException; | ||
import org.apache.pinot.common.proto.PinotQueryWorkerGrpc; | ||
import org.apache.pinot.common.proto.Worker; | ||
import org.apache.pinot.common.utils.NamedThreadFactory; | ||
import org.apache.pinot.core.transport.grpc.GrpcQueryServer; | ||
import org.apache.pinot.query.routing.QueryPlanSerDeUtils; | ||
import org.apache.pinot.query.routing.StageMetadata; | ||
import org.apache.pinot.query.routing.StagePlan; | ||
|
@@ -55,16 +58,18 @@ public class QueryServer extends PinotQueryWorkerGrpc.PinotQueryWorkerImplBase { | |
|
||
private final int _port; | ||
private final QueryRunner _queryRunner; | ||
private final TlsConfig _tlsConfig; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nullable annotation is needed here |
||
// query submission service is only used for plan submission for now. | ||
// TODO: with complex query submission logic we should allow asynchronous query submission return instead of | ||
// directly return from submission response observer. | ||
private final ExecutorService _querySubmissionExecutorService; | ||
|
||
private Server _server = null; | ||
|
||
public QueryServer(int port, QueryRunner queryRunner) { | ||
public QueryServer(int port, QueryRunner queryRunner, TlsConfig tlsConfig) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nullabe annotation is needed here |
||
_port = port; | ||
_queryRunner = queryRunner; | ||
_tlsConfig = tlsConfig; | ||
_querySubmissionExecutorService = | ||
Executors.newCachedThreadPool(new NamedThreadFactory("query_submission_executor_on_" + _port + "_port")); | ||
} | ||
|
@@ -73,7 +78,14 @@ public void start() { | |
LOGGER.info("Starting QueryServer"); | ||
try { | ||
if (_server == null) { | ||
_server = ServerBuilder.forPort(_port).addService(this).maxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE).build(); | ||
if (_tlsConfig == null) { | ||
_server = ServerBuilder.forPort(_port).addService(this) | ||
.maxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE).build(); | ||
} else { | ||
_server = NettyServerBuilder.forPort(_port).addService(this) | ||
.sslContext(GrpcQueryServer.buildGRpcSslContext(_tlsConfig)) | ||
.maxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE).build(); | ||
} | ||
LOGGER.info("Initialized QueryServer on port: {}", _port); | ||
} | ||
_queryRunner.start(); | ||
|
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constructor is only used in the other constructor to create non-tls DispatchClient. Does it mean that if gRPC TLS is enabled on the server side, then DispatchClient will always fail? I don't see a place where TLS enabled DispatchClient is created. cc: @gortiz @Jackie-Jiang