Closed joebb97 closed 3 years ago
Not sure what you mean?
The instructions for using as an external plugin with the binary coredns are helpful
Perhaps I'm reading too much into the use of the word "binary" above, but adding new external plugins directly to a released CoreDNS binary is not possible.
The instructions in the README are for compiling CoreDNS from source with the rrl plugin included. This is how all external plugins are added to CoreDNS - they must be compiled in at build time.
Yeah I was referring to the compilation from source instruction. I'm looking to include rrl via golang package (which is how we use coredns, we do not build CoreDNS from source as far as I'm aware. It's just included via an import in go).
( ... we do not build CoreDNS from source as far as I'm aware. It's just included via an import in go).
OK, CoreDNS isn't designed to be used in that way, but that's not to say it is impossible or invalid.
If you can share the project, I can try to help.
Thanks for the help, sadly the project is closed source / proprietary.
To maybe shed light on our usage of core dns, this is our main.go for running our dns server
package main
import (
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain"
// Register the plugins provided by CoreDNS.
_ "github.com/coredns/coredns/plugin/debug"
_ "github.com/coredns/coredns/plugin/errors"
_ "github.com/coredns/coredns/plugin/log"
// Register custom plugin.
_ "path/to/internal/plugin"
)
func main() {
// Directives are registered in the order they should be executed.
//
// Ordering is VERY important. Every plugin will feel the effects of all
// other plugin below (after) them during a request, but they must not
// care what plugin above them are doing.
dnsserver.Directives = []string{
"debug",
"errors",
"log",
"internalplugin",
}
coremain.Run()
}
I tried updating our go.mod and modules.txt to include rrl and then doing
import "github.com/coredns/rrl/plugins/rrl"
in this file, but ran into various issues. I think I can get the import to work at some point, just wanted to see if you think this approach is feasible?
After getting that import statement I was going to add rrl
to dnsserver.Directives
and an rrl
block in Corefile like the README example of the rrl repo.
OK, that's all I needed to see. You'd include it in the same way as you have with the "internalplugin" example.
e.g.
import (
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain"
// Register the plugins provided by CoreDNS.
_ "github.com/coredns/coredns/plugin/debug"
_ "github.com/coredns/coredns/plugin/errors"
_ "github.com/coredns/coredns/plugin/log"
// Register custom plugin.
_ "path/to/internal/plugin"
_ "github.com/coredns/rrl/plugin/rrl"
)
func main() {
// Directives are registered in the order they should be executed.
//
// Ordering is VERY important. Every plugin will feel the effects of all
// other plugin below (after) them during a request, but they must not
// care what plugin above them are doing.
dnsserver.Directives = []string{
"debug",
"errors",
"log",
"rrl",
"internalplugin",
}
coremain.Run()
}
Okay that's what I was thinking we'd end up with, just wanted to make sure. Thanks so much for the help!!
Just wanted to follow up and say I got it working!! Thanks again, I really appreciate it.
Cool! Is this related to your work on the DUO Network Gateway Team?
It is! We use coredns in our product and other places at DUO (not super revealing to say that since it's a pretty prevalent project and a popular choice that I think only really competes with bind). It works quite well for our use cases!
It is! We use coredns in our product and other places at DUO (not super revealing to say that since it's a pretty prevalent project and a popular choice that I think only really competes with bind). It works quite well for our use cases!
Awesome! It would be cool to have a big name like Duo on the CoreDNS Adopters list. Most on that list use it in the K8 cluster DNS context only, but IMO it's way more cool to see it being using it in actual product.
I personally would love to see that, but I'll have to see what our leadership says. I think it's in the works of being discussed.
The instructions for using as an external plugin with the binary coredns are helpful, but I don't see anything for how to include this (or other external packages) via the Golang package of coredns, which is what my team uses. Thanks for any help you can provide, and pointers in the right direction would be great!