diff options
Diffstat (limited to 'plugin/kubernetes')
-rw-r--r-- | plugin/kubernetes/README.md | 14 | ||||
-rw-r--r-- | plugin/kubernetes/setup.go | 4 | ||||
-rw-r--r-- | plugin/kubernetes/setup_test.go | 15 |
3 files changed, 6 insertions, 27 deletions
diff --git a/plugin/kubernetes/README.md b/plugin/kubernetes/README.md index 68efdae0c..50a31801f 100644 --- a/plugin/kubernetes/README.md +++ b/plugin/kubernetes/README.md @@ -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 diff --git a/plugin/kubernetes/setup.go b/plugin/kubernetes/setup.go index 593cd2f77..1180d0135 100644 --- a/plugin/kubernetes/setup.go +++ b/plugin/kubernetes/setup.go @@ -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 { diff --git a/plugin/kubernetes/setup_test.go b/plugin/kubernetes/setup_test.go index e7af4e1e2..9dcf0f6a3 100644 --- a/plugin/kubernetes/setup_test.go +++ b/plugin/kubernetes/setup_test.go @@ -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 |