Skip to content
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 fallback #11254

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
25aa454
Checkpoint
larry-safran Mar 12, 2024
d8f7094
XdsClient Fallback working
larry-safran Mar 13, 2024
d0e7ba2
Merge branch 'master' into xds_fallback
larry-safran Aug 28, 2024
c2f0ecc
Eliminate version of getSubscribedResources that doesn't take an auth…
larry-safran Aug 29, 2024
2ab47a5
Change logic based on changing from assuming that fallback servers ha…
larry-safran Sep 5, 2024
38267d5
Cleanup stuff added for debugging
larry-safran Sep 5, 2024
05d188f
Remove changes to CensusModulesTest
larry-safran Sep 13, 2024
dedb8fe
Cleanup as recommended
larry-safran Sep 13, 2024
22b5a0c
Remove ControlPlaneClient from resource and instead use authority to …
larry-safran Oct 31, 2024
003348b
Restore experimental property in @After of test
larry-safran Oct 31, 2024
2c11225
Remove unnecessary checks for index not being at end when getting sub…
larry-safran Oct 31, 2024
7323f25
Remove unnecessary checks for index not being at end when getting sub…
larry-safran Oct 31, 2024
fe384a8
When response have been received, don't consider it an error when the…
larry-safran Nov 1, 2024
4d2e4d8
Fix logic for identifying missing resources whose subscribers need to…
larry-safran Nov 1, 2024
23b6740
Change internalHandleStreamReady() to onl add to activeCpClients when…
larry-safran Nov 1, 2024
b5d69d3
Eliminate use of compare function for control plane clients.
larry-safran Nov 1, 2024
5b28d7a
Don't recalculate which server was deletion ignored from in onAbsent,…
larry-safran Nov 1, 2024
1169f39
when a CPC is bumped by a higher priority server coming up, but is st…
larry-safran Nov 1, 2024
8d22cfd
Address trivial review comments
larry-safran Nov 6, 2024
023c6cd
Simplify getOrCreateControlPlaneClient of a list by relying on the ve…
larry-safran Nov 6, 2024
517bcc3
In handleStreamClosed used the response handler's stored ServerInfo t…
larry-safran Nov 6, 2024
230c18d
Eliminate unneeded argument from private method doFallbackForAuthority.
larry-safran Nov 6, 2024
7975051
Eliminate unneeded null handling.
larry-safran Nov 7, 2024
5c6b524
Create a manageControlPlaneClients() method to wrap usages of getOrCr…
larry-safran Nov 7, 2024
b979d70
Eliminate doFallbackForAuthority since it became a simple call to man…
larry-safran Nov 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions xds/src/main/java/io/grpc/xds/GrpcXdsTransportFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.grpc.CallOptions;
import io.grpc.ChannelCredentials;
import io.grpc.ClientCall;
import io.grpc.ConnectivityState;
import io.grpc.Context;
import io.grpc.Grpc;
import io.grpc.ManagedChannel;
Expand Down Expand Up @@ -84,6 +85,12 @@ public void shutdown() {
channel.shutdown();
}

@Override
public boolean isConnected() {
ejona86 marked this conversation as resolved.
Show resolved Hide resolved
ConnectivityState state = channel.getState(false);
ejona86 marked this conversation as resolved.
Show resolved Hide resolved
return state == ConnectivityState.READY;
}

private class XdsStreamingCall<ReqT, RespT> implements
XdsTransportFactory.StreamingCall<ReqT, RespT> {

Expand Down
16 changes: 16 additions & 0 deletions xds/src/main/java/io/grpc/xds/client/BootstrapperImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
@Internal
public abstract class BootstrapperImpl extends Bootstrapper {

public static final String GRPC_EXPERIMENTAL_XDS_FALLBACK =
"GRPC_EXPERIMENTAL_XDS_FALLBACK";

// Client features.
@VisibleForTesting
public static final String CLIENT_FEATURE_DISABLE_OVERPROVISIONING =
Expand All @@ -59,11 +62,18 @@
logger = XdsLogger.withLogId(InternalLogId.allocate("bootstrapper", null));
}

// Delayed initialization of xdsFallbackEnabled to allow for flag initialization.
public static boolean isEnabledXdsFallback() {
ejona86 marked this conversation as resolved.
Show resolved Hide resolved
return GrpcUtil.getFlag(GRPC_EXPERIMENTAL_XDS_FALLBACK, false);
}

protected abstract String getJsonContent() throws IOException, XdsInitializationException;

protected abstract Object getImplSpecificConfig(Map<String, ?> serverConfig, String serverUri)
throws XdsInitializationException;



/**
* Reads and parses bootstrap config. The config is expected to be in JSON format.
*/
Expand Down Expand Up @@ -102,6 +112,9 @@
throw new XdsInitializationException("Invalid bootstrap: 'xds_servers' does not exist.");
}
List<ServerInfo> servers = parseServerInfos(rawServerConfigs, logger);
if (servers.size() > 1 && !isEnabledXdsFallback()) {
servers = ImmutableList.of(servers.get(0));

Check warning on line 116 in xds/src/main/java/io/grpc/xds/client/BootstrapperImpl.java

View check run for this annotation

Codecov / codecov/patch

xds/src/main/java/io/grpc/xds/client/BootstrapperImpl.java#L116

Added line #L116 was not covered by tests
}
builder.servers(servers);

Node.Builder nodeBuilder = Node.newBuilder();
Expand Down Expand Up @@ -208,6 +221,9 @@
if (rawAuthorityServers == null || rawAuthorityServers.isEmpty()) {
authorityServers = servers;
} else {
if (rawAuthorityServers.size() > 1 && !isEnabledXdsFallback()) {
rawAuthorityServers = ImmutableList.of(rawAuthorityServers.get(0));

Check warning on line 225 in xds/src/main/java/io/grpc/xds/client/BootstrapperImpl.java

View check run for this annotation

Codecov / codecov/patch

xds/src/main/java/io/grpc/xds/client/BootstrapperImpl.java#L225

Added line #L225 was not covered by tests
}
authorityServers = parseServerInfos(rawAuthorityServers, logger);
}
authorityInfoMapBuilder.put(
Expand Down
Loading