plugins: set upstream unconditionally (#2956)

`upstream` is not needed as a setting; just set if unconditionally and
remove all documentation and tests for it.

At some point we want remove the hanlding for `upstream` as well and
error out on seeing it.

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben 2019-07-02 16:23:47 +01:00 committed by GitHub
parent 3a0c7c6153
commit 22c6e3e179
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 28 additions and 114 deletions

View file

@ -17,7 +17,6 @@ template CLASS TYPE [ZONE...] {
additional RR
authority RR
rcode CODE
upstream
fallthrough [ZONE...]
}
~~~
@ -29,7 +28,6 @@ template CLASS TYPE [ZONE...] {
* `answer|additional|authority` **RR** A [RFC 1035](https://tools.ietf.org/html/rfc1035#section-5) style resource record fragment
built by a [Go template](https://golang.org/pkg/text/template/) that contains the reply.
* `rcode` **CODE** A response code (`NXDOMAIN, SERVFAIL, ...`). The default is `SUCCESS`.
* `upstream` defines the upstream resolvers used for resolving CNAMEs. CoreDNS will resolve CNAMEs against itself.
* `fallthrough` Continue with the next plugin if the zone matched but no regex matched.
If specific zones are listed (for example `in-addr.arpa` and `ip6.arpa`), then only queries for
those zones will be subject to fallthrough.

View file

@ -74,6 +74,7 @@ func templateParse(c *caddy.Controller) (handler Handler, err error) {
templatePrefix := ""
t.answer = make([]*gotmpl.Template, 0)
t.upstream = upstream.New()
for c.NextBlock() {
switch c.Val() {
@ -144,8 +145,8 @@ func templateParse(c *caddy.Controller) (handler Handler, err error) {
t.fall.SetZonesFromArgs(c.RemainingArgs())
case "upstream":
c.RemainingArgs() // eat remaining args
t.upstream = upstream.New()
// remove soon
c.RemainingArgs()
default:
return handler, c.ArgErr()
}

View file

@ -141,13 +141,6 @@ func TestSetupParse(t *testing.T) {
}`,
false,
},
{
`template ANY ANY up.stream.local {
answer "up.stream.local 5 IN CNAME up.river.local"
upstream
}`,
false,
},
}
for i, test := range tests {
c := caddy.NewTestController("dns", test.inputFileRules)