parent
1e4ba588dc
commit
12678ac5e2
4 changed files with 22 additions and 29 deletions
|
@ -1,10 +1,8 @@
|
||||||
# kubernetes
|
# kubernetes
|
||||||
|
|
||||||
*kubernetes* enables reading zone data from a kubernetes cluster.
|
*kubernetes* enables reading zone data from a kubernetes cluster.
|
||||||
It implements the spec defined for kubernetes DNS-Based service discovery:
|
It implements the [spec](https://github.com/kubernetes/dns/blob/master/docs/specification.md)
|
||||||
https://github.com/kubernetes/dns/blob/master/docs/specification.md
|
defined for kubernetes DNS-Based service discovery:
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
Service `A` records are constructed as "myservice.mynamespace.svc.coredns.local" where:
|
Service `A` records are constructed as "myservice.mynamespace.svc.coredns.local" where:
|
||||||
|
|
||||||
|
@ -30,9 +28,9 @@ Endpoint `A` records are constructed as "epname.myservice.mynamespace.svc.coredn
|
||||||
|
|
||||||
Also supported are PTR and SRV records for services/endpoints.
|
Also supported are PTR and SRV records for services/endpoints.
|
||||||
|
|
||||||
## Configuration Syntax
|
## Syntax
|
||||||
|
|
||||||
This is an example kubernetes middle configuration block, with all options described:
|
This is an example kubernetes configuration block, with all options described:
|
||||||
|
|
||||||
```
|
```
|
||||||
# kubernetes <zone> [<zone>] ...
|
# kubernetes <zone> [<zone>] ...
|
||||||
|
|
|
@ -45,7 +45,7 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M
|
||||||
)
|
)
|
||||||
switch state.Type() {
|
switch state.Type() {
|
||||||
case "A":
|
case "A":
|
||||||
records, _, err = middleware.A(&k, zone, state, nil, middleware.Options{}) // Hmm wrt to '&k'
|
records, _, err = middleware.A(&k, zone, state, nil, middleware.Options{})
|
||||||
case "AAAA":
|
case "AAAA":
|
||||||
records, _, err = middleware.AAAA(&k, zone, state, nil, middleware.Options{})
|
records, _, err = middleware.AAAA(&k, zone, state, nil, middleware.Options{})
|
||||||
case "TXT":
|
case "TXT":
|
||||||
|
|
|
@ -151,9 +151,7 @@ func (k *Kubernetes) IsNameError(err error) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug implements the ServiceBackend interface.
|
// Debug implements the ServiceBackend interface.
|
||||||
func (k *Kubernetes) Debug() string {
|
func (k *Kubernetes) Debug() string { return "debug" }
|
||||||
return "debug"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (k *Kubernetes) getClientConfig() (*rest.Config, error) {
|
func (k *Kubernetes) getClientConfig() (*rest.Config, error) {
|
||||||
// For a custom api server or running outside a k8s cluster
|
// For a custom api server or running outside a k8s cluster
|
||||||
|
|
|
@ -84,7 +84,6 @@ func TestParseRequest(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test A request of endpoint
|
// Test A request of endpoint
|
||||||
//
|
|
||||||
query = "1-2-3-4.webs.mynamespace.svc.inter.webs.test."
|
query = "1-2-3-4.webs.mynamespace.svc.inter.webs.test."
|
||||||
r, e = k.parseRequest(query, "A")
|
r, e = k.parseRequest(query, "A")
|
||||||
if e != nil {
|
if e != nil {
|
||||||
|
@ -104,8 +103,6 @@ func TestParseRequest(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invalid query tests
|
// Invalid query tests
|
||||||
//
|
|
||||||
|
|
||||||
invalidAQueries := []string{
|
invalidAQueries := []string{
|
||||||
"_http._tcp.webs.mynamespace.svc.inter.webs.test.", // A requests cannot have port or protocol
|
"_http._tcp.webs.mynamespace.svc.inter.webs.test.", // A requests cannot have port or protocol
|
||||||
"servname.ns1.srv.inter.nets.test.", // A requests must have zone that matches corefile
|
"servname.ns1.srv.inter.nets.test.", // A requests must have zone that matches corefile
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue