plugin/k8s_extenral: Supports fallthrough option (#5959)

* Add fallthrough option to k8s_external plugin to allow transitioning control to the next plugin if the domain is not found
* Exit on start up if required plugin is not present.

Signed-off-by: vanceli <vanceli@tencent.com>

---------

Signed-off-by: vanceli <vanceli@tencent.com>
Co-authored-by: vanceli <vanceli@tencent.com>
This commit is contained in:
Vancl
2023-03-24 20:52:44 +08:00
committed by GitHub
parent 48c40ae1cd
commit 47dceabfc6
4 changed files with 66 additions and 22 deletions

View File

@@ -10,8 +10,7 @@ This plugin allows an additional zone to resolve the external IP address(es) of
service and headless services. This plugin is only useful if the *kubernetes* plugin is also loaded.
The plugin uses an external zone to resolve in-cluster IP addresses. It only handles queries for A,
AAAA, SRV, and PTR records; all others result in NODATA responses. To make it a proper DNS zone, it handles
SOA and NS queries for the apex of the zone.
AAAA, SRV, and PTR records; To make it a proper DNS zone, it handles SOA and NS queries for the apex of the zone.
By default the apex of the zone will look like the following (assuming the zone used is `example.org`):
@@ -67,6 +66,14 @@ k8s_external [ZONE...] {
* if there is a headless service with external IPs set, external IPs will be resolved
If the queried domain does not exist, you can fall through to next plugin by adding the `fallthrough` option.
~~~
k8s_external [ZONE...] {
fallthrough [ZONE...]
}
~~~
## Examples
Enable names under `example.org` to be resolved to in-cluster DNS addresses.
@@ -106,6 +113,18 @@ zone transfers. Notifies are not supported.
}
~~~
With the `fallthrough` option, if the queried domain does not exist, it will be passed to the next plugin that matches the zone.
~~~
. {
kubernetes cluster.local
k8s_external example.org {
fallthrough
}
forward . 8.8.8.8
}
~~~
# See Also
For some background see [resolve external IP address](https://github.com/kubernetes/dns/issues/242).