oz123 / coredns-netbox-plugin

A coredns plugin to get dns records from Netbox
Apache License 2.0
63 stars 25 forks source link

Trouble with fallthrough #42

Open zamadatix opened 8 months ago

zamadatix commented 8 months ago

Hey there, I'm having some trouble getting the fallthrough to actually fallthrough. With "test1.example.com" in the local zonefile and "test2.example.com" in netbox I'm getting the following behavior:

Giventhe Corefile:

#    netbox {
#        token MyTokenHere
#        url http://10.20.30.40/api/ipam/ip-addresses
#        fallthrough
#    }

    file /etc/coredns/example.com
}

Queries to test1.example.com resolve and test2.example.com fail. Given the Corefile:

    netbox {
        token MyTokenHere
        url http://10.20.30.40/api/ipam/ip-addresses
        fallthrough
    }

#    file /etc/coredns/example.com
}

Queries to test1.example.com fail and test2.example.com resolve. Given the Corefile:

    netbox {
        token MyTokenHere
        url http://10.20.30.40/api/ipam/ip-addresses
        fallthrough
    }

    file /etc/coredns/example.com
}

Queriest to test1.example.com still fail and test2.example.com resolve. I'm not quite sure why fallthrough isn't letting the file's answer resolve. One thing I thought is maybe I have the plugin position wrong but it's before "file:file":

metadata:metadata
geoip:geoip
cancel:cancel
tls:tls
timeouts:timeouts
reload:reload
nsid:nsid
bufsize:bufsize
bind:bind
debug:debug
trace:trace
ready:ready
health:health
pprof:pprof
prometheus:metrics
errors:errors
log:log
dnstap:dnstap
local:local
dns64:dns64
acl:acl
any:any
chaos:chaos
loadbalance:loadbalance
tsig:tsig
cache:cache
netbox:github.com/oz123/coredns-netbox-plugin
rewrite:rewrite
header:header
dnssec:dnssec
autopath:autopath
minimal:minimal
template:template
transfer:transfer
hosts:hosts
route53:route53
azure:azure
clouddns:clouddns
k8s_external:k8s_external
kubernetes:kubernetes
file:file
auto:auto
secondary:secondary
etcd:etcd
loop:loop
forward:forward
grpc:grpc
erratic:erratic
whoami:whoami
on:github.com/coredns/caddy/onevent
sign:sign
view:view

And even trying it at the very end of the list or very beginning of the list isn't changing the behavior.

hkviseth commented 1 month ago

It seems that the latest release v0.4.0 doesn't include the commit https://github.com/oz123/coredns-netbox-plugin/commit/192f77a46bf930570c609a50d4bd22b4c05411da which adds the fallthrough when no results are found in Netbox (fallthrough on unsupported query type should still work in v0.4.0). Have you tried explicitly downloading the master branch instead of the release tag before compiling CoreDNS? I tried forking the repo and creating a release from the latest commit in master, and it has working fallthrough as expected. Maybe @oz123 could do a new release that includes the changes since v0.4.0? :)