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:
Jiacheng Xu 2018-11-02 22:07:50 +01:00 committed by Miek Gieben
parent 1a01e13db8
commit 165b4f86a3
3 changed files with 10 additions and 8 deletions

View file

@ -32,7 +32,7 @@ route53 [ZONE:HOSTED_ZONE_ID...] {
* `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
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.
* **PROFILE** AWS account profile name. Defaults to `default`.
* **FILENAME** AWS credentials filename. Defaults to `~/.aws/credentials`

View file

@ -84,11 +84,6 @@ func setup(c *caddy.Controller, f func(*credentials.Credentials) route53iface.Ro
})
case "upstream":
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
up, err = upstream.New(args)
if err != nil {

View file

@ -35,11 +35,18 @@ func TestSetupRoute53(t *testing.T) {
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 {
upstream
}`)
if err := setup(c, f); err == nil {
t.Fatalf("Expected errors, but got: %v", err)
if err := setup(c, f); err != nil {
t.Fatalf("Expected no errors, but got: %v", err)
}
c = caddy.NewTestController("dns", `route53 example.org:12345678 {