plugin/route53: make the upstream address in route53 plugin optional. (#2263)
* Make the upstream in route53 plugin optional. Signed-off-by: Jiacheng Xu <xjcmaxwellcjx@gmail.com> * Add 2 tests for upstream in route53. Signed-off-by: Jiacheng Xu <xjcmaxwellcjx@gmail.com> * Change the readme. Signed-off-by: Jiacheng Xu <xjcmaxwellcjx@gmail.com>
This commit is contained in:
parent
1a01e13db8
commit
165b4f86a3
3 changed files with 10 additions and 8 deletions
|
@ -32,7 +32,7 @@ route53 [ZONE:HOSTED_ZONE_ID...] {
|
||||||
* `upstream` [**ADDRESS**...] specifies upstream resolver(s) used for resolving services that point
|
* `upstream` [**ADDRESS**...] specifies upstream resolver(s) used for resolving services that point
|
||||||
to external hosts (eg. used to resolve CNAMEs). If no **ADDRESS** is given, CoreDNS will resolve
|
to external hosts (eg. used to resolve CNAMEs). If no **ADDRESS** is given, CoreDNS will resolve
|
||||||
against itself. **ADDRESS** can be an IP, an IP:port or a path to a file structured like
|
against itself. **ADDRESS** can be an IP, an IP:port or a path to a file structured like
|
||||||
resolv.conf (**NB**: Currently a bug (#2099) is preventing the use of self-resolver).
|
resolv.conf.
|
||||||
* `credentials` used for reading the credential file and setting the profile name for a given zone.
|
* `credentials` used for reading the credential file and setting the profile name for a given zone.
|
||||||
* **PROFILE** AWS account profile name. Defaults to `default`.
|
* **PROFILE** AWS account profile name. Defaults to `default`.
|
||||||
* **FILENAME** AWS credentials filename. Defaults to `~/.aws/credentials`
|
* **FILENAME** AWS credentials filename. Defaults to `~/.aws/credentials`
|
||||||
|
|
|
@ -84,11 +84,6 @@ func setup(c *caddy.Controller, f func(*credentials.Credentials) route53iface.Ro
|
||||||
})
|
})
|
||||||
case "upstream":
|
case "upstream":
|
||||||
args := c.RemainingArgs()
|
args := c.RemainingArgs()
|
||||||
// TODO(dilyevsky): There is a bug that causes coredns to crash
|
|
||||||
// when no upstream endpoint is provided.
|
|
||||||
if len(args) == 0 {
|
|
||||||
return c.Errf("local upstream not supported. please provide upstream endpoint")
|
|
||||||
}
|
|
||||||
var err error
|
var err error
|
||||||
up, err = upstream.New(args)
|
up, err = upstream.New(args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -35,11 +35,18 @@ func TestSetupRoute53(t *testing.T) {
|
||||||
t.Fatalf("Expected errors, but got: %v", err)
|
t.Fatalf("Expected errors, but got: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c = caddy.NewTestController("dns", `route53 example.org:12345678 {
|
||||||
|
upstream 10.0.0.1
|
||||||
|
}`)
|
||||||
|
if err := setup(c, f); err != nil {
|
||||||
|
t.Fatalf("Expected no errors, but got: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
c = caddy.NewTestController("dns", `route53 example.org:12345678 {
|
c = caddy.NewTestController("dns", `route53 example.org:12345678 {
|
||||||
upstream
|
upstream
|
||||||
}`)
|
}`)
|
||||||
if err := setup(c, f); err == nil {
|
if err := setup(c, f); err != nil {
|
||||||
t.Fatalf("Expected errors, but got: %v", err)
|
t.Fatalf("Expected no errors, but got: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c = caddy.NewTestController("dns", `route53 example.org:12345678 {
|
c = caddy.NewTestController("dns", `route53 example.org:12345678 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue