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

@ -14,7 +14,7 @@ cluster. See the [deployment](https://github.com/coredns/deployment) repository
to deploy CoreDNS in Kubernetes](https://github.com/coredns/deployment/tree/master/kubernetes).
[stubDomains and upstreamNameservers](https://kubernetes.io/blog/2017/04/configuring-private-dns-zones-upstream-nameservers-kubernetes/)
are implemented via the *forward* plugin and kubernetes *upstream*. See the examples below.
are implemented via the *forward* plugin. See the examples below.
This plugin can only be used once per Server Block.
@ -39,7 +39,6 @@ kubernetes [ZONES...] {
labels EXPRESSION
pods POD-MODE
endpoint_pod_names
upstream
ttl TTL
noendpoints
transfer to ADDRESS...
@ -90,9 +89,6 @@ kubernetes [ZONES...] {
follows: Use the hostname of the endpoint, or if hostname is not set, use the
pod name of the pod targeted by the endpoint. If there is no pod targeted by
the endpoint, use the dashed IP address form.
* `upstream` defines the upstream resolvers used for resolving services
that point to external hosts (aka External Services, aka CNAMEs). CoreDNS
will resolve External Services against itself.
* `ttl` allows you to set a custom TTL for responses. The default is 5 seconds. The minimum TTL allowed is
0 seconds, and the maximum is capped at 3600 seconds. Setting TTL to 0 will prevent records from being cached.
* `noendpoints` will turn off the serving of endpoint records by disabling the watch on endpoints.
@ -121,13 +117,12 @@ Kubernetes API.
Handle all queries in the `cluster.local` zone. Connect to Kubernetes in-cluster. Also handle all
`in-addr.arpa` `PTR` requests for `10.0.0.0/17` . Verify the existence of pods when answering pod
requests. Resolve upstream records against `10.102.3.10`. Note we show the entire server block here:
requests.
~~~ txt
10.0.0.0/17 cluster.local {
kubernetes {
pods verified
upstream 10.102.3.10:53
}
}
~~~
@ -152,15 +147,12 @@ kubernetes cluster.local {
## stubDomains and upstreamNameservers
Here we use the *forward* plugin to implement a stubDomain that forwards `example.local` to the nameserver `10.100.0.10:53`.
The *upstream* option in the *kubernetes* plugin means that ExternalName services (CNAMEs) will be resolved using the respective proxy.
Also configured is an upstreamNameserver `8.8.8.8:53` that will be used for resolving names that do not fall in `cluster.local`
or `example.local`.
~~~ txt
cluster.local:53 {
kubernetes cluster.local {
upstream
}
kubernetes cluster.local
}
example.local {
forward . 10.100.0.10:53

View file

@ -162,6 +162,8 @@ func ParseStanza(c *caddy.Controller) (*Kubernetes, error) {
return nil, errors.New("non-reverse zone name must be used")
}
k8s.Upstream = upstream.New()
for c.NextBlock() {
switch c.Val() {
case "endpoint_pod_names":
@ -249,8 +251,8 @@ func ParseStanza(c *caddy.Controller) (*Kubernetes, error) {
case "fallthrough":
k8s.Fall.SetZonesFromArgs(c.RemainingArgs())
case "upstream":
// remove soon
c.RemainingArgs() // eat remaining args
k8s.Upstream = upstream.New()
case "ttl":
args := c.RemainingArgs()
if len(args) == 0 {

View file

@ -381,21 +381,6 @@ func TestKubernetesParse(t *testing.T) {
podModeDisabled,
fall.F{Zones: []string{"ip6.arpa.", "inaddr.arpa.", "foo.com."}},
},
// Valid upstream
{
`kubernetes coredns.local {
upstream
}`,
false,
"",
1,
0,
defaultResyncPeriod,
"",
"",
podModeDisabled,
fall.Zero,
},
// More than one Kubernetes not allowed
{
`kubernetes coredns.local