MCPcopy Index your code
hub / github.com/grpc/grpc-java / XdsClusterResource

Class XdsClusterResource

xds/src/main/java/io/grpc/xds/XdsClusterResource.java:60–786  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58import javax.annotation.Nullable;
59
60class XdsClusterResource extends XdsResourceType<CdsUpdate> {
61 @VisibleForTesting
62 static boolean enableLeastRequest =
63 !Strings.isNullOrEmpty(System.getenv("GRPC_EXPERIMENTAL_ENABLE_LEAST_REQUEST"))
64 ? Boolean.parseBoolean(System.getenv("GRPC_EXPERIMENTAL_ENABLE_LEAST_REQUEST"))
65 : Boolean.parseBoolean(
66 System.getProperty("io.grpc.xds.experimentalEnableLeastRequest", "true"));
67 @VisibleForTesting
68 public static boolean enableSystemRootCerts =
69 GrpcUtil.getFlag("GRPC_EXPERIMENTAL_XDS_SYSTEM_ROOT_CERTS", true);
70 static boolean isEnabledXdsHttpConnect =
71 GrpcUtil.getFlag("GRPC_EXPERIMENTAL_XDS_HTTP_CONNECT", false);
72
73 @VisibleForTesting
74 static final String AGGREGATE_CLUSTER_TYPE_NAME = "envoy.clusters.aggregate";
75 static final String ADS_TYPE_URL_CDS =
76 "type.googleapis.com/envoy.config.cluster.v3.Cluster";
77 private static final String TYPE_URL_CLUSTER_CONFIG =
78 "type.googleapis.com/envoy.extensions.clusters.aggregate.v3.ClusterConfig";
79 private static final String TYPE_URL_UPSTREAM_TLS_CONTEXT =
80 "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext";
81 private static final String TYPE_URL_UPSTREAM_TLS_CONTEXT_V2 =
82 "type.googleapis.com/envoy.api.v2.auth.UpstreamTlsContext";
83 private final LoadBalancerRegistry loadBalancerRegistry
84 = LoadBalancerRegistry.getDefaultRegistry();
85
86 private static final XdsClusterResource instance = new XdsClusterResource();
87
88 public static XdsClusterResource getInstance() {
89 return instance;
90 }
91
92 @Override
93 @Nullable
94 protected String extractResourceName(Message unpackedResource) {
95 if (!(unpackedResource instanceof Cluster)) {
96 return null;
97 }
98 return ((Cluster) unpackedResource).getName();
99 }
100
101 @Override
102 public String typeName() {
103 return "CDS";
104 }
105
106 @Override
107 public String typeUrl() {
108 return ADS_TYPE_URL_CDS;
109 }
110
111 @Override
112 public boolean shouldRetrieveResourceKeysForArgs() {
113 return true;
114 }
115
116 @Override
117 protected boolean isFullStateOfTheWorld() {

Callers

nothing calls this directly

Calls 4

getFlagMethod · 0.95
getDefaultRegistryMethod · 0.95
parseBooleanMethod · 0.80
getPropertyMethod · 0.80

Tested by

no test coverage detected