Repository navigation
Commit 9f4a76a
authored
fix(bigtable): allow non-default service accounts for session DirectAccess (#14926)
### Problem
Workloads running on Compute Engine or GKE with a non-default service
account (for example, GKE Workload Identity Federation or explicit
service account credentials) cannot establish DirectPath
(`DirectAccess`) connections on the session-based protocol path
(`ShimImpl` and `GaxDirectAccessChannelProvider`), even when classic
unary RPCs on the same client successfully use DirectPath. Instead,
session channels fall back to CloudPath (`GaxBasicChannelProvider`) and
report `direct_access/compatible=0`.
### Root Cause
`ShimImpl.create` and both factory methods in
`GaxDirectAccessChannelProvider` (`create` and `createWithFallback`)
called `.setAttemptDirectPath(true).setAttemptDirectPathXds()` without
setting `.setAllowNonDefaultServiceAccount(true)`.
Without `setAllowNonDefaultServiceAccount(true)`,
`InstantiatingGrpcChannelProvider.isCredentialDirectPathCompatible()`
only accepts `ComputeEngineCredentials` and returns `false` for other
credential types. Consequently,
`directAccessProvider.canUseDirectPath()` returns `false` in
`GaxDirectAccessChannelProvider`, causing
`GaxDirectAccessChannelProvider.createWithFallback` to immediately
return a CloudPath `GaxBasicChannelProvider`.
### Fix
- Enable `.setAllowNonDefaultServiceAccount(true)` on the DirectAccess
`InstantiatingGrpcChannelProvider` builders in `ShimImpl.create`,
`GaxDirectAccessChannelProvider.create`, and
`GaxDirectAccessChannelProvider.createWithFallback`.
### Testing
- Added `GaxDirectAccessChannelProviderTest` verifying that `create` and
`createWithFallback` return `GaxDirectAccessChannelProvider` on a GCE
Linux environment when configured with non-`ComputeEngineCredentials`
credentials.1 parent 8535344 commit 9f4a76a
3 files changed
Lines changed: 106 additions & 2 deletions
File tree
- java-bigtable/google-cloud-bigtable/src
- main/java/com/google/cloud/bigtable/data/v2/internal/compat
- test/java/com/google/cloud/bigtable/data/v2/internal/compat
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
40 | 44 | | |
41 | 45 | | |
42 | 46 | | |
| |||
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
55 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
56 | 64 | | |
57 | 65 | | |
58 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
0 commit comments