Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
Coredns
Commits
519ef9ca
Commit
519ef9ca
authored
Jan 13, 2020
by
Miek Gieben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more
Signed-off-by:
Miek Gieben
<
miek@miek.nl
>
parent
72213388
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
3 deletions
+52
-3
plugin/traffic/HACKING.md
plugin/traffic/HACKING.md
+19
-0
plugin/traffic/README.md
plugin/traffic/README.md
+11
-0
plugin/traffic/setup.go
plugin/traffic/setup.go
+3
-0
plugin/traffic/xds/client.go
plugin/traffic/xds/client.go
+6
-0
plugin/traffic/xds/v2client.go
plugin/traffic/xds/v2client.go
+12
-2
plugin/traffic/xds_bootstrap.json
plugin/traffic/xds_bootstrap.json
+1
-1
No files found.
plugin/traffic/HACKING.md
View file @
519ef9ca
...
@@ -18,3 +18,22 @@ https://github.com/envoyproxy/learnenvoy/blob/master/_articles/service-discovery
...
@@ -18,3 +18,22 @@ https://github.com/envoyproxy/learnenvoy/blob/master/_articles/service-discovery
Cluster: A cluster is a group of logically similar endpoints that Envoy connects to. In v2, RDS
Cluster: A cluster is a group of logically similar endpoints that Envoy connects to. In v2, RDS
routes points to clusters, CDS provides cluster configuration and Envoy discovers the cluster
routes points to clusters, CDS provides cluster configuration and Envoy discovers the cluster
members via EDS.
members via EDS.
# Testing
~~~
sh
$
cd
~/src/github.com/envoyproxy/go-control-plane
% make integration.xds
~~~
This runs a binary from pkg/test/main. Now we're testing xDS, but there is also aDS (which does
everything including xDS). I'm still figuring out what do to here.
The script stops, unless you have Envoy installed (which I haven't), but you can run it manually:
~~~
sh
./bin/test
--xds
=
xds
--runtimes
=
1
-debug
# for xds
~~~
This fails with
`timeout waiting for the first request`
, means you're consumer wasn't quick enough
in asking for xDS assignments.
plugin/traffic/README.md
View file @
519ef9ca
...
@@ -42,6 +42,17 @@ Findign the xDS endpoint.
...
@@ -42,6 +42,17 @@ Findign the xDS endpoint.
traffic
traffic
~~~
~~~
The extended syntax:
~~~
traffic {
server grpc://dsdsd <creds>
id ID
}
~~~
*
id
**ID**
is how
*traffic*
identifies itself to the control plane.
This enables traffic load balancing for all (sub-)domains named in the server block.
This enables traffic load balancing for all (sub-)domains named in the server block.
## Examples
## Examples
...
...
plugin/traffic/setup.go
View file @
519ef9ca
...
@@ -7,6 +7,7 @@ import (
...
@@ -7,6 +7,7 @@ import (
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin"
clog
"github.com/coredns/coredns/plugin/pkg/log"
clog
"github.com/coredns/coredns/plugin/pkg/log"
"github.com/coredns/coredns/plugin/traffic/xds"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy"
)
)
...
@@ -31,6 +32,8 @@ func setup(c *caddy.Controller) error {
...
@@ -31,6 +32,8 @@ func setup(c *caddy.Controller) error {
return
t
return
t
})
})
t
.
c
.
WatchCluster
(
"xds_experimental"
,
func
(
xds
.
CDSUpdate
,
error
)
{})
return
nil
return
nil
}
}
...
...
plugin/traffic/xds/client.go
View file @
519ef9ca
...
@@ -69,6 +69,8 @@ func New(opts Options) (*Client, error) {
...
@@ -69,6 +69,8 @@ func New(opts Options) (*Client, error) {
return
nil
,
fmt
.
Errorf
(
"xds: failed to dial balancer {%s}: %v"
,
opts
.
Config
.
BalancerName
,
err
)
return
nil
,
fmt
.
Errorf
(
"xds: failed to dial balancer {%s}: %v"
,
opts
.
Config
.
BalancerName
,
err
)
}
}
println
(
"dialed balancer at"
,
opts
.
Config
.
BalancerName
)
c
:=
&
Client
{
c
:=
&
Client
{
opts
:
opts
,
opts
:
opts
,
cc
:
cc
,
cc
:
cc
,
...
@@ -85,6 +87,10 @@ func (c *Client) Close() {
...
@@ -85,6 +87,10 @@ func (c *Client) Close() {
c
.
cc
.
Close
()
c
.
cc
.
Close
()
}
}
func
(
c
*
Client
)
Run
()
{
c
.
v2c
.
run
()
}
// ServiceUpdate contains update about the service.
// ServiceUpdate contains update about the service.
type
ServiceUpdate
struct
{
type
ServiceUpdate
struct
{
Cluster
string
Cluster
string
...
...
plugin/traffic/xds/v2client.go
View file @
519ef9ca
...
@@ -127,12 +127,14 @@ func (v2c *v2Client) run() {
...
@@ -127,12 +127,14 @@ func (v2c *v2Client) run() {
}
}
retries
++
retries
++
println
(
"SENDING STUFF, retries"
,
retries
)
cli
:=
adsgrpc
.
NewAggregatedDiscoveryServiceClient
(
v2c
.
cc
)
cli
:=
adsgrpc
.
NewAggregatedDiscoveryServiceClient
(
v2c
.
cc
)
stream
,
err
:=
cli
.
StreamAggregatedResources
(
v2c
.
ctx
,
grpc
.
WaitForReady
(
true
))
stream
,
err
:=
cli
.
StreamAggregatedResources
(
v2c
.
ctx
)
//
, grpc.WaitForReady(true))
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Infof
(
"xds: ADS stream creation failed: %v"
,
err
)
log
.
Infof
(
"xds: ADS stream creation failed: %v"
,
err
)
continue
continue
}
}
println
(
"created ads stream"
)
// send() could be blocked on reading updates from the different update
// send() could be blocked on reading updates from the different update
// channels when it is not actually sending out messages. So, we need a
// channels when it is not actually sending out messages. So, we need a
...
@@ -143,11 +145,12 @@ func (v2c *v2Client) run() {
...
@@ -143,11 +145,12 @@ func (v2c *v2Client) run() {
if
v2c
.
recv
(
stream
)
{
if
v2c
.
recv
(
stream
)
{
retries
=
0
retries
=
0
}
}
println
(
"sending has succeeded"
)
close
(
done
)
close
(
done
)
}
}
}
}
//
s
endRequest sends a request for provided typeURL and resource on the provided
// endRequest sends a request for provided typeURL and resource on the provided
// stream.
// stream.
//
//
// version is the ack version to be sent with the request
// version is the ack version to be sent with the request
...
@@ -261,9 +264,12 @@ func (v2c *v2Client) processAckInfo(t *ackInfo) (target []string, typeURL, versi
...
@@ -261,9 +264,12 @@ func (v2c *v2Client) processAckInfo(t *ackInfo) (target []string, typeURL, versi
// on the provided ADS stream.
// on the provided ADS stream.
func
(
v2c
*
v2Client
)
send
(
stream
adsStream
,
done
chan
struct
{})
{
func
(
v2c
*
v2Client
)
send
(
stream
adsStream
,
done
chan
struct
{})
{
if
!
v2c
.
sendExisting
(
stream
)
{
if
!
v2c
.
sendExisting
(
stream
)
{
println
(
"not existing stream"
)
return
return
}
}
println
(
"in send"
)
for
{
for
{
select
{
select
{
case
<-
v2c
.
ctx
.
Done
()
:
case
<-
v2c
.
ctx
.
Done
()
:
...
@@ -278,8 +284,10 @@ func (v2c *v2Client) send(stream adsStream, done chan struct{}) {
...
@@ -278,8 +284,10 @@ func (v2c *v2Client) send(stream adsStream, done chan struct{}) {
)
)
switch
t
:=
u
.
(
type
)
{
switch
t
:=
u
.
(
type
)
{
case
*
watchInfo
:
case
*
watchInfo
:
println
(
"watchInfo"
)
target
,
typeURL
,
version
,
nonce
,
send
=
v2c
.
processWatchInfo
(
t
)
target
,
typeURL
,
version
,
nonce
,
send
=
v2c
.
processWatchInfo
(
t
)
case
*
ackInfo
:
case
*
ackInfo
:
println
(
"ackInfo"
)
target
,
typeURL
,
version
,
nonce
,
send
=
v2c
.
processAckInfo
(
t
)
target
,
typeURL
,
version
,
nonce
,
send
=
v2c
.
processAckInfo
(
t
)
}
}
if
!
send
{
if
!
send
{
...
@@ -367,7 +375,9 @@ func (v2c *v2Client) watchEDS(clusterName string, edsCb edsCallback) (cancel fun
...
@@ -367,7 +375,9 @@ func (v2c *v2Client) watchEDS(clusterName string, edsCb edsCallback) (cancel fun
}
}
func
(
v2c
*
v2Client
)
watch
(
wi
*
watchInfo
)
(
cancel
func
())
{
func
(
v2c
*
v2Client
)
watch
(
wi
*
watchInfo
)
(
cancel
func
())
{
println
(
"watch"
)
v2c
.
sendCh
.
Put
(
wi
)
v2c
.
sendCh
.
Put
(
wi
)
println
(
"returning from watch"
)
return
func
()
{
return
func
()
{
v2c
.
mu
.
Lock
()
v2c
.
mu
.
Lock
()
defer
v2c
.
mu
.
Unlock
()
defer
v2c
.
mu
.
Unlock
()
...
...
plugin/traffic/xds_bootstrap.json
View file @
519ef9ca
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
}
}
},
},
"xds_servers"
:
[{
"xds_servers"
:
[{
"server_uri"
:
"
trafficdirector.googleapis.com:443
"
,
"server_uri"
:
"
localhost:18000
"
,
"channel_creds"
:
[
"channel_creds"
:
[
{
"type"
:
"google_default"
}
{
"type"
:
"google_default"
}
]
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment