Skip to content

Commit 1d4fa8a

Browse files
xds: change cdsbalancer to use update from dependency manager (grpc#8907)
This PR is part of A74 changes. This PR changes following: 1. Changes the CDS balancer to use the CDS and EDS/DNS update from XDSConfig received by xds_resolver instead of starting its own CDS watchers. 2. Remove cluster resolver completely 3. CDS balancer creates the priority config and creates priority balancer as its child. 4. Remove serializer from CDS balancer since it was there to serializer watcher updates and ClientConn updates, now that there are no watchers and clientConn updates are already serialized , serializer is no longer needed. 5. Update tests in cdsbalancer package to check the priority config instead of cluster_resolver config. 6. xds_resolver tracks reference counts for weighted cluster and cluster specifier plugin seperately. xds_resolver subscribes to the weighted cluster in dependency manager when referenced for first time and unsubscribes when references in xds_resolver go to zero. 7. Incase of LDS/RDS resource error , we now directly send empty service config , instead of sending a complete service config with clusters that RPCs are still referenced to. 8. Minor test fixes. RELEASE NOTES: * xds: * Ambient errors for cluster resources are now logged exclusively in the dependency manager and are no longer propagated to Load Balancing (LB) policies. * When re-resolution is requested, all clusters of type LOGICAL_DNS will be re-resolved simultaneously, rather than only a single cluster. * Upon receipt of a listener or route resource error, all in-flight RPCs will now fail immediately. * Any error encountered during the creation or update of a priority configuration will now transition the channel to a TRANSIENT_FAILURE state.
1 parent 8f47d36 commit 1d4fa8a

31 files changed

+1238
-3030
lines changed

internal/xds/balancer/balancer.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
_ "google.golang.org/grpc/internal/xds/balancer/cdsbalancer" // Register the CDS balancer
2626
_ "google.golang.org/grpc/internal/xds/balancer/clusterimpl" // Register the xds_cluster_impl balancer
2727
_ "google.golang.org/grpc/internal/xds/balancer/clustermanager" // Register the xds_cluster_manager balancer
28-
_ "google.golang.org/grpc/internal/xds/balancer/clusterresolver" // Register the xds_cluster_resolver balancer
2928
_ "google.golang.org/grpc/internal/xds/balancer/outlierdetection" // Register the outlier_detection balancer
3029
_ "google.golang.org/grpc/internal/xds/balancer/priority" // Register the priority balancer
3130
)

internal/xds/balancer/cdsbalancer/aggregate_cluster_test.go

Lines changed: 148 additions & 213 deletions
Large diffs are not rendered by default.

internal/xds/balancer/cdsbalancer/cdsbalancer.go

Lines changed: 284 additions & 342 deletions
Large diffs are not rendered by default.

internal/xds/balancer/cdsbalancer/cdsbalancer_security_test.go

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"encoding/json"
2424
"fmt"
2525
"os"
26-
"strings"
2726
"testing"
2827

2928
"github.com/google/uuid"
@@ -552,14 +551,8 @@ func (s) TestSecurityConfigUpdate_GoodToFallback(t *testing.T) {
552551
// bootstrap file contents. Verifies that the connection between the client and
553552
// the server is secure. Subsequently, the cds LB policy receives a cluster
554553
// resource that is NACKed by the xDS client. Test verifies that the cds LB
555-
// policy continues to use the previous good configuration, but the error from
556-
// the xDS client is propagated to the child policy.
554+
// policy continues to use the previous good configuration.
557555
func (s) TestSecurityConfigUpdate_GoodToBad(t *testing.T) {
558-
// Register a wrapped clusterresolver LB policy (child policy of the cds LB
559-
// policy) for the duration of this test that makes the resolver error
560-
// pushed to it available to the test.
561-
_, resolverErrCh, _, _ := registerWrappedClusterResolverPolicy(t)
562-
563556
// Spin up an xDS management server.
564557
mgmtServer := e2e.StartManagementServer(t, e2e.ManagementServerOptions{})
565558

@@ -615,16 +608,6 @@ func (s) TestSecurityConfigUpdate_GoodToBad(t *testing.T) {
615608
t.Fatal(err)
616609
}
617610

618-
const wantNACKErr = "instance name \"unknown-certificate-provider-instance\" missing in bootstrap configuration"
619-
select {
620-
case err := <-resolverErrCh:
621-
if !strings.Contains(err.Error(), wantNACKErr) {
622-
t.Fatalf("Child policy got resolver error: %v, want err: %v", err, wantNACKErr)
623-
}
624-
case <-ctx.Done():
625-
t.Fatal("Timeout when waiting for resolver error to be pushed to the child policy")
626-
}
627-
628611
// Verify that a successful RPC can be made over a secure connection.
629612
if _, err := client.EmptyCall(ctx, &testpb.Empty{}, grpc.WaitForReady(true)); err != nil {
630613
t.Fatalf("EmptyCall() failed: %v", err)

0 commit comments

Comments
 (0)