Skip to content

Commit 65d53e6

Browse files
authored
Update examples/dyplomat to v3 (#620)
Signed-off-by: Raul Gutierrez Segales <[email protected]> Co-authored-by: Raul Gutierrez Segales <[email protected]>
1 parent 29a4b73 commit 65d53e6

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

examples/dyplomat/main.go

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ import (
88

99
"google.golang.org/grpc"
1010

11-
api "github.com/envoyproxy/go-control-plane/envoy/api/v2"
12-
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2"
11+
core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
12+
endpointv3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
13+
clusterservice "github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3"
14+
discoverygrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
15+
endpointservice "github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3"
16+
listenerservice "github.com/envoyproxy/go-control-plane/envoy/service/listener/v3"
17+
routeservice "github.com/envoyproxy/go-control-plane/envoy/service/route/v3"
1318
"github.com/envoyproxy/go-control-plane/pkg/cache/types"
14-
"github.com/envoyproxy/go-control-plane/pkg/cache/v2"
15-
xds "github.com/envoyproxy/go-control-plane/pkg/server/v2"
16-
17-
endpoint "github.com/envoyproxy/go-control-plane/envoy/api/v2"
18-
core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core"
19-
endpointv2 "github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint"
19+
"github.com/envoyproxy/go-control-plane/pkg/cache/v3"
20+
xds "github.com/envoyproxy/go-control-plane/pkg/server/v3"
2021

2122
corev1 "k8s.io/api/core/v1"
2223
"k8s.io/client-go/informers"
@@ -43,11 +44,11 @@ func main() {
4344
grpcServer := grpc.NewServer()
4445
lis, _ := net.Listen("tcp", ":8080")
4546

46-
discovery.RegisterAggregatedDiscoveryServiceServer(grpcServer, server)
47-
api.RegisterEndpointDiscoveryServiceServer(grpcServer, server)
48-
api.RegisterClusterDiscoveryServiceServer(grpcServer, server)
49-
api.RegisterRouteDiscoveryServiceServer(grpcServer, server)
50-
api.RegisterListenerDiscoveryServiceServer(grpcServer, server)
47+
discoverygrpc.RegisterAggregatedDiscoveryServiceServer(grpcServer, server)
48+
endpointservice.RegisterEndpointDiscoveryServiceServer(grpcServer, server)
49+
clusterservice.RegisterClusterDiscoveryServiceServer(grpcServer, server)
50+
routeservice.RegisterRouteDiscoveryServiceServer(grpcServer, server)
51+
listenerservice.RegisterListenerDiscoveryServiceServer(grpcServer, server)
5152

5253
clusters, _ := CreateBootstrapClients()
5354

@@ -116,19 +117,19 @@ func HandleEndpointsUpdate(oldObj, newObj interface{}) {
116117
version++
117118
}
118119

119-
func MakeEndpointsForCluster(service *EnvoyCluster) *endpoint.ClusterLoadAssignment {
120+
func MakeEndpointsForCluster(service *EnvoyCluster) *endpointv3.ClusterLoadAssignment {
120121
fmt.Printf("Updating endpoints for cluster %s: %v\n", service.name, service.endpoints)
121-
cla := &endpoint.ClusterLoadAssignment{
122+
cla := &endpointv3.ClusterLoadAssignment{
122123
ClusterName: service.name,
123-
Endpoints: []*endpointv2.LocalityLbEndpoints{},
124+
Endpoints: []*endpointv3.LocalityLbEndpoints{},
124125
}
125126

126127
for _, endpoint := range service.endpoints {
127128
cla.Endpoints = append(cla.Endpoints,
128-
&endpointv2.LocalityLbEndpoints{
129-
LbEndpoints: []*endpointv2.LbEndpoint{{
130-
HostIdentifier: &endpointv2.LbEndpoint_Endpoint{
131-
Endpoint: &endpointv2.Endpoint{
129+
&endpointv3.LocalityLbEndpoints{
130+
LbEndpoints: []*endpointv3.LbEndpoint{{
131+
HostIdentifier: &endpointv3.LbEndpoint_Endpoint{
132+
Endpoint: &endpointv3.Endpoint{
132133
Address: &core.Address{
133134
Address: &core.Address_SocketAddress{
134135
SocketAddress: &core.SocketAddress{

0 commit comments

Comments
 (0)