Skip to content

Commit

Permalink
NET-4858 - xds v2 - implement base connect proxy functionality for ro…
Browse files Browse the repository at this point in the history
…utes (#18501)

* NET-4853 - xds v2 - implement base connect proxy functionality for clusters

* NET-4853 - xds v2 - implement base connect proxy functionality for clusters

* NET-4932 - xds v2 - implement base connect proxy functionality for endpoints

* Update endpoints_test.go

* gofmt

* NET-4858 - Make connect proxy route tests pass using xds v2

* Update endpoints_test.go

* Update naming.go

* use alsoRunTestForV2

* remove unused makeAddress

* gofmt

* fixing clusters
  • Loading branch information
jmurret authored Aug 17, 2023
1 parent 97b41d9 commit 9ea182f
Show file tree
Hide file tree
Showing 14 changed files with 1,806 additions and 408 deletions.
9 changes: 3 additions & 6 deletions agent/xds/clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ func makeClusterDiscoChainTests(enterprise bool) []clusterTestCase {
create: func(t testinf.T) *proxycfg.ConfigSnapshot {
return proxycfg.TestConfigSnapshotDiscoveryChain(t, "simple-with-overrides", enterprise, nil, nil)
},
// TODO(proxystate): requires routes work
alsoRunTestForV2: false,
alsoRunTestForV2: true,
},
{
name: "connect-proxy-with-chain-and-failover",
Expand Down Expand Up @@ -176,16 +175,14 @@ func makeClusterDiscoChainTests(enterprise bool) []clusterTestCase {
create: func(t testinf.T) *proxycfg.ConfigSnapshot {
return proxycfg.TestConfigSnapshotDiscoveryChain(t, "splitter-with-resolver-redirect-multidc", enterprise, nil, nil)
},
// TODO(proxystate): requires routes work
alsoRunTestForV2: false,
alsoRunTestForV2: true,
},
{
name: "connect-proxy-lb-in-resolver",
create: func(t testinf.T) *proxycfg.ConfigSnapshot {
return proxycfg.TestConfigSnapshotDiscoveryChain(t, "lb-resolver", enterprise, nil, nil)
},
// TODO(proxystate): requires routes work
alsoRunTestForV2: false,
alsoRunTestForV2: true,
},
}
}
Expand Down
7 changes: 2 additions & 5 deletions agent/xds/endpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
envoy_endpoint_v3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
"github.com/hashicorp/consul/agent/proxycfg"
"github.com/hashicorp/consul/agent/structs"

"github.com/hashicorp/consul/agent/xds/proxystateconverter"
"github.com/hashicorp/consul/agent/xds/response"
"github.com/hashicorp/consul/agent/xds/testcommon"
Expand Down Expand Up @@ -267,8 +266,7 @@ func makeEndpointDiscoChainTests(enterprise bool) []endpointTestCase {
create: func(t testinf.T) *proxycfg.ConfigSnapshot {
return proxycfg.TestConfigSnapshotDiscoveryChain(t, "simple-with-overrides", enterprise, nil, nil)
},
// TODO(proxystate): requires routes work
alsoRunTestForV2: false,
alsoRunTestForV2: true,
},
{
name: "connect-proxy-with-chain-and-failover",
Expand Down Expand Up @@ -351,8 +349,7 @@ func makeEndpointDiscoChainTests(enterprise bool) []endpointTestCase {
create: func(t testinf.T) *proxycfg.ConfigSnapshot {
return proxycfg.TestConfigSnapshotDiscoveryChain(t, "splitter-with-resolver-redirect-multidc", enterprise, nil, nil)
},
// TODO(proxystate): requires routes work
alsoRunTestForV2: false,
alsoRunTestForV2: true,
},
}
}
Expand Down
3 changes: 2 additions & 1 deletion agent/xds/proxystateconverter/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strings"
"time"

envoy_endpoint_v3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/wrapperspb"

Expand Down Expand Up @@ -1021,7 +1022,7 @@ func configureClusterWithHostnames(
dnsEndpointGroup.Config.DiscoveryType = pbproxystate.DiscoveryType_DISCOVERY_TYPE_STRICT
}

endpoints := make([]*pbproxystate.Endpoint, 0, 1)
endpoints := make([]*envoy_endpoint_v3.LbEndpoint, 0, 1)
uniqueHostnames := make(map[string]bool)

var (
Expand Down
10 changes: 6 additions & 4 deletions agent/xds/proxystateconverter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ func (g *Converter) resourcesFromSnapshot(cfgSnap *proxycfg.ConfigSnapshot) erro
if err != nil {
return err
}
//err = g.routesFromSnapshot(cfgSnap)
//if err != nil {
// return err
//}

err = g.routesFromSnapshot(cfgSnap)
if err != nil {
return err
}

//g.secretsFromSnapshot(cfgSnap)
return nil
}
Expand Down
Loading

0 comments on commit 9ea182f

Please sign in to comment.