-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
xds: Add xDS node ID in few control plane errors #11519
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 |
---|---|---|
|
@@ -58,7 +58,9 @@ | |
import io.grpc.xds.LeastRequestLoadBalancer.LeastRequestConfig; | ||
import io.grpc.xds.RingHashLoadBalancer.RingHashConfig; | ||
import io.grpc.xds.XdsClusterResource.CdsUpdate; | ||
import io.grpc.xds.client.Bootstrapper.BootstrapInfo; | ||
import io.grpc.xds.client.Bootstrapper.ServerInfo; | ||
import io.grpc.xds.client.EnvoyProtoData; | ||
import io.grpc.xds.client.XdsClient; | ||
import io.grpc.xds.client.XdsResourceType; | ||
import io.grpc.xds.internal.security.CommonTlsContextTestsUtil; | ||
|
@@ -94,6 +96,16 @@ public class CdsLoadBalancer2Test { | |
private static final String DNS_HOST_NAME = "backend-service-dns.googleapis.com:443"; | ||
private static final ServerInfo LRS_SERVER_INFO = | ||
ServerInfo.create("lrs.googleapis.com", InsecureChannelCredentials.create()); | ||
private static final String SERVER_URI = "trafficdirector.googleapis.com"; | ||
private static final String NODE_ID = | ||
"projects/42/networks/default/nodes/5c85b298-6f5b-4722-b74a-f7d1f0ccf5ad"; | ||
private static final EnvoyProtoData.Node BOOTSTRAP_NODE = | ||
EnvoyProtoData.Node.newBuilder().setId(NODE_ID).build(); | ||
private static final BootstrapInfo BOOTSTRAP_INFO = BootstrapInfo.builder() | ||
.servers(ImmutableList.of( | ||
ServerInfo.create(SERVER_URI, InsecureChannelCredentials.create()))) | ||
.node(BOOTSTRAP_NODE) | ||
.build(); | ||
private final UpstreamTlsContext upstreamTlsContext = | ||
CommonTlsContextTestsUtil.buildUpstreamTlsContext("google_cloud_private_spiffe", true); | ||
private final OutlierDetection outlierDetection = OutlierDetection.create( | ||
|
@@ -211,7 +223,8 @@ public void nonAggregateCluster_resourceNotExist_returnErrorPicker() { | |
verify(helper).updateBalancingState( | ||
eq(ConnectivityState.TRANSIENT_FAILURE), pickerCaptor.capture()); | ||
Status unavailable = Status.UNAVAILABLE.withDescription( | ||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " + CLUSTER); | ||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " + CLUSTER | ||
+ " xDS node ID: " + NODE_ID); | ||
assertPicker(pickerCaptor.getValue(), unavailable, null); | ||
assertThat(childBalancers).isEmpty(); | ||
} | ||
|
@@ -254,7 +267,8 @@ public void nonAggregateCluster_resourceRevoked() { | |
xdsClient.deliverResourceNotExist(CLUSTER); | ||
assertThat(childBalancer.shutdown).isTrue(); | ||
Status unavailable = Status.UNAVAILABLE.withDescription( | ||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " + CLUSTER); | ||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " + CLUSTER | ||
+ " xDS node ID: " + NODE_ID); | ||
verify(helper).updateBalancingState( | ||
eq(ConnectivityState.TRANSIENT_FAILURE), pickerCaptor.capture()); | ||
assertPicker(pickerCaptor.getValue(), unavailable, null); | ||
|
@@ -331,7 +345,8 @@ public void aggregateCluster_noNonAggregateClusterExits_returnErrorPicker() { | |
verify(helper).updateBalancingState( | ||
eq(ConnectivityState.TRANSIENT_FAILURE), pickerCaptor.capture()); | ||
Status unavailable = Status.UNAVAILABLE.withDescription( | ||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " + CLUSTER); | ||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " + CLUSTER | ||
+ " xDS node ID: " + NODE_ID); | ||
assertPicker(pickerCaptor.getValue(), unavailable, null); | ||
assertThat(childBalancers).isEmpty(); | ||
} | ||
|
@@ -379,7 +394,8 @@ public void aggregateCluster_descendantClustersRevoked() { | |
verify(helper).updateBalancingState( | ||
eq(ConnectivityState.TRANSIENT_FAILURE), pickerCaptor.capture()); | ||
Status unavailable = Status.UNAVAILABLE.withDescription( | ||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " + CLUSTER); | ||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " + CLUSTER | ||
+ " xDS node ID: " + NODE_ID); | ||
assertPicker(pickerCaptor.getValue(), unavailable, null); | ||
assertThat(childBalancer.shutdown).isTrue(); | ||
assertThat(childBalancers).isEmpty(); | ||
|
@@ -418,7 +434,8 @@ public void aggregateCluster_rootClusterRevoked() { | |
verify(helper).updateBalancingState( | ||
eq(ConnectivityState.TRANSIENT_FAILURE), pickerCaptor.capture()); | ||
Status unavailable = Status.UNAVAILABLE.withDescription( | ||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " + CLUSTER); | ||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " + CLUSTER | ||
+ " xDS node ID: " + NODE_ID); | ||
assertPicker(pickerCaptor.getValue(), unavailable, null); | ||
assertThat(childBalancer.shutdown).isTrue(); | ||
assertThat(childBalancers).isEmpty(); | ||
|
@@ -466,7 +483,8 @@ public void aggregateCluster_intermediateClusterChanges() { | |
verify(helper).updateBalancingState( | ||
eq(ConnectivityState.TRANSIENT_FAILURE), pickerCaptor.capture()); | ||
Status unavailable = Status.UNAVAILABLE.withDescription( | ||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " + CLUSTER); | ||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " + CLUSTER | ||
+ " xDS node ID: " + NODE_ID); | ||
assertPicker(pickerCaptor.getValue(), unavailable, null); | ||
assertThat(childBalancer.shutdown).isTrue(); | ||
assertThat(childBalancers).isEmpty(); | ||
|
@@ -507,7 +525,7 @@ public void aggregateCluster_withLoops() { | |
Status unavailable = Status.UNAVAILABLE.withDescription( | ||
"CDS error: circular aggregate clusters directly under cluster-02.googleapis.com for root" | ||
+ " cluster cluster-foo.googleapis.com, named [cluster-01.googleapis.com," | ||
+ " cluster-02.googleapis.com]"); | ||
+ " cluster-02.googleapis.com]" + ", xDS node ID: " + NODE_ID); | ||
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. Combine the two string literals on the same line together. Ditto bellow. 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. Done |
||
assertPicker(pickerCaptor.getValue(), unavailable, null); | ||
} | ||
|
||
|
@@ -549,7 +567,7 @@ public void aggregateCluster_withLoops_afterEds() { | |
Status unavailable = Status.UNAVAILABLE.withDescription( | ||
"CDS error: circular aggregate clusters directly under cluster-02.googleapis.com for root" | ||
+ " cluster cluster-foo.googleapis.com, named [cluster-01.googleapis.com," | ||
+ " cluster-02.googleapis.com]"); | ||
+ " cluster-02.googleapis.com]" + ", xDS node ID: " + NODE_ID); | ||
assertPicker(pickerCaptor.getValue(), unavailable, null); | ||
} | ||
|
||
|
@@ -617,7 +635,7 @@ public void aggregateCluster_discoveryErrorBeforeChildLbCreated_returnErrorPicke | |
eq(ConnectivityState.TRANSIENT_FAILURE), pickerCaptor.capture()); | ||
Status expectedError = Status.UNAVAILABLE.withDescription( | ||
"Unable to load CDS cluster-foo.googleapis.com. xDS server returned: " | ||
+ "RESOURCE_EXHAUSTED: OOM"); | ||
+ "RESOURCE_EXHAUSTED: OOM" + " xDS node ID: " + NODE_ID); | ||
assertPicker(pickerCaptor.getValue(), expectedError, null); | ||
assertThat(childBalancers).isEmpty(); | ||
} | ||
|
@@ -647,7 +665,8 @@ public void aggregateCluster_discoveryErrorAfterChildLbCreated_propagateToChildL | |
|
||
@Test | ||
public void handleNameResolutionErrorFromUpstream_beforeChildLbCreated_returnErrorPicker() { | ||
Status upstreamError = Status.UNAVAILABLE.withDescription("unreachable"); | ||
Status upstreamError = Status.UNAVAILABLE.withDescription( | ||
"unreachable" + " xDS node ID: " + NODE_ID); | ||
loadBalancer.handleNameResolutionError(upstreamError); | ||
verify(helper).updateBalancingState( | ||
eq(ConnectivityState.TRANSIENT_FAILURE), pickerCaptor.capture()); | ||
|
@@ -821,6 +840,11 @@ public <T extends ResourceUpdate> void cancelXdsResourceWatch(XdsResourceType<T> | |
} | ||
} | ||
|
||
@Override | ||
public BootstrapInfo getBootstrapInfo() { | ||
return BOOTSTRAP_INFO; | ||
} | ||
|
||
private void deliverCdsUpdate(String clusterName, CdsUpdate update) { | ||
if (watchers.containsKey(clusterName)) { | ||
List<ResourceWatcher<CdsUpdate>> resourceWatchers = | ||
|
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 will have two spaces before " xDS node ID" if getDescription() != null.
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.
When description == null, then there will be a one space indent before "xDS node ID", so I'd leave the extra space here and remove it from the string building.
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.
As Larry suggested, removed extra space from string building in L294.