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
acd0b73a
Commit
acd0b73a
authored
Jan 16, 2020
by
Miek Gieben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more options to the plugin
Signed-off-by:
Miek Gieben
<
miek@miek.nl
>
parent
c2594d17
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
7 deletions
+13
-7
plugin/traffic/README.md
plugin/traffic/README.md
+2
-2
plugin/traffic/setup.go
plugin/traffic/setup.go
+8
-3
plugin/traffic/traffic.go
plugin/traffic/traffic.go
+2
-1
plugin/traffic/xds/client.go
plugin/traffic/xds/client.go
+1
-1
No files found.
plugin/traffic/README.md
View file @
acd0b73a
...
@@ -39,11 +39,11 @@ The extended syntax (not implemented; everything is hard-coded at the moment):
...
@@ -39,11 +39,11 @@ The extended syntax (not implemented; everything is hard-coded at the moment):
~~~
~~~
traffic {
traffic {
server grpc://dsdsd <creds>
server grpc://dsdsd <creds>
id
ID
node
ID
}
}
~~~
~~~
*
id
**ID**
is how
*traffic*
identifies itself to the control plane
.
*
node
**ID**
is how
*traffic*
identifies itself to the control plane. This defaults to
`coredns`
.
## Examples
## Examples
...
...
plugin/traffic/setup.go
View file @
acd0b73a
...
@@ -51,13 +51,18 @@ func setup(c *caddy.Controller) error {
...
@@ -51,13 +51,18 @@ func setup(c *caddy.Controller) error {
return
nil
return
nil
}
}
func
parse
(
c
*
caddy
.
Controller
)
error
{
func
parse
(
c
*
caddy
.
Controller
)
(
*
Traffic
,
error
)
{
for
c
.
Next
()
{
for
c
.
Next
()
{
args
:=
c
.
RemainingArgs
()
args
:=
c
.
RemainingArgs
()
if
len
(
args
)
!=
0
{
if
len
(
args
)
!=
0
{
return
c
.
ArgErr
()
return
nil
,
c
.
ArgErr
()
}
}
for
c
.
NextBlock
()
{
switch
c
.
Val
()
{
case
"id"
:
}
}
}
}
return
nil
return
nil
,
nil
}
}
plugin/traffic/traffic.go
View file @
acd0b73a
...
@@ -14,11 +14,12 @@ import (
...
@@ -14,11 +14,12 @@ import (
// Traffic is a plugin that load balances according to assignments.
// Traffic is a plugin that load balances according to assignments.
type
Traffic
struct
{
type
Traffic
struct
{
c
*
xds
.
Client
c
*
xds
.
Client
id
string
Next
plugin
.
Handler
Next
plugin
.
Handler
}
}
// New returns a pointer to a new and initialized Traffic.
// New returns a pointer to a new and initialized Traffic.
func
New
()
(
*
Traffic
,
error
)
{
func
New
(
addr
,
node
string
)
(
*
Traffic
,
error
)
{
c
,
err
:=
xds
.
New
(
":18000"
,
"mycoredns"
)
c
,
err
:=
xds
.
New
(
":18000"
,
"mycoredns"
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
plugin/traffic/xds/client.go
View file @
acd0b73a
...
@@ -54,7 +54,7 @@ type Client struct {
...
@@ -54,7 +54,7 @@ type Client struct {
// New returns a new client that's dialed to addr using node as the local identifier.
// New returns a new client that's dialed to addr using node as the local identifier.
func
New
(
addr
,
node
string
)
(
*
Client
,
error
)
{
func
New
(
addr
,
node
string
)
(
*
Client
,
error
)
{
// todo credentials
// todo credentials
!
opts
:=
[]
grpc
.
DialOption
{
grpc
.
WithInsecure
()}
opts
:=
[]
grpc
.
DialOption
{
grpc
.
WithInsecure
()}
cc
,
err
:=
grpc
.
Dial
(
addr
,
opts
...
)
cc
,
err
:=
grpc
.
Dial
(
addr
,
opts
...
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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