|
47 | 47 | import com.google.common.collect.ImmutableList;
|
48 | 48 | import com.google.common.collect.ImmutableMap;
|
49 | 49 | import com.google.common.io.Files;
|
| 50 | +import io.grpc.CallCredentials; |
50 | 51 | import io.grpc.ChannelCredentials;
|
51 | 52 | import io.grpc.Grpc;
|
52 | 53 | import io.grpc.ManagedChannel;
|
53 | 54 | import io.grpc.ManagedChannelBuilder;
|
54 | 55 | import io.grpc.TlsChannelCredentials;
|
55 |
| -import io.grpc.alts.ComputeEngineChannelBuilder; |
| 56 | +import io.grpc.alts.GoogleDefaultChannelCredentials; |
| 57 | +import io.grpc.auth.MoreCallCredentials; |
56 | 58 | import java.io.File;
|
57 | 59 | import java.io.IOException;
|
58 | 60 | import java.nio.charset.StandardCharsets;
|
@@ -336,13 +338,16 @@ private ManagedChannel createSingleChannel() throws IOException, GeneralSecurity
|
336 | 338 | if (isDirectPathEnabled(serviceAddress)
|
337 | 339 | && isNonDefaultServiceAccountAllowed()
|
338 | 340 | && isOnComputeEngine()) {
|
| 341 | + CallCredentials callCreds = MoreCallCredentials.from(credentials); |
| 342 | + ChannelCredentials channelCreds = |
| 343 | + GoogleDefaultChannelCredentials.newBuilder().callCredentials(callCreds).build(); |
339 | 344 | isDirectPathXdsEnabled = Boolean.parseBoolean(envProvider.getenv(DIRECT_PATH_ENV_ENABLE_XDS));
|
340 | 345 | if (isDirectPathXdsEnabled) {
|
341 | 346 | // google-c2p resolver target must not have a port number
|
342 | 347 | builder =
|
343 |
| - ComputeEngineChannelBuilder.forTarget("google-c2p-experimental:///" + serviceAddress); |
| 348 | + Grpc.newChannelBuilder("google-c2p-experimental:///" + serviceAddress, channelCreds); |
344 | 349 | } else {
|
345 |
| - builder = ComputeEngineChannelBuilder.forAddress(serviceAddress, port); |
| 350 | + builder = Grpc.newChannelBuilderForAddress(serviceAddress, port, channelCreds); |
346 | 351 | builder.defaultServiceConfig(directPathServiceConfig);
|
347 | 352 | }
|
348 | 353 | // Set default keepAliveTime and keepAliveTimeout when directpath environment is enabled.
|
|
0 commit comments