Have probe query kube dns to find the app.

This commit is contained in:
Tom Wilkie
2016-05-05 12:07:57 +01:00
committed by Tom Wilkie
parent c671c58d93
commit 9b8f8a6c83
3 changed files with 8 additions and 1 deletions

View File

@@ -137,6 +137,7 @@ func (r staticResolver) resolveOne(t target) []string {
var err error
addrs, err = r.lookup(t.host)
if err != nil {
log.Debugf("Error resolving %s: %v", t.host, err)
return []string{}
}
}

View File

@@ -67,6 +67,7 @@ type probeFlags struct {
insecure bool
logPrefix string
logLevel string
resolver string
dockerEnabled bool
dockerInterval time.Duration
@@ -132,6 +133,7 @@ func main() {
flag.StringVar(&flags.probe.pluginsRoot, "probe.plugins.root", "/var/run/scope/plugins", "Root directory to search for plugins")
flag.BoolVar(&flags.probe.useConntrack, "probe.conntrack", true, "also use conntrack to track connections")
flag.BoolVar(&flags.probe.insecure, "probe.insecure", false, "(SSL) explicitly allow \"insecure\" SSL connections and transfers")
flag.StringVar(&flags.probe.resolver, "probe.resolver", "", "IP address & port of resolver to use. Default is to use system resolver.")
flag.StringVar(&flags.probe.logPrefix, "probe.log.prefix", "<probe>", "prefix for each log line")
flag.StringVar(&flags.probe.logLevel, "probe.log.level", "info", "logging threshold level: debug|info|warn|error|fatal|panic")
flag.BoolVar(&flags.probe.dockerEnabled, "probe.docker", false, "collect Docker-related attributes for processes")

View File

@@ -113,7 +113,11 @@ func probeMain(flags probeFlags) {
})
defer clients.Stop()
resolver := appclient.NewResolver(targets, net.LookupIP, clients.Set)
dnsLookupFn := net.LookupIP
if flags.resolver != "" {
dnsLookupFn = appclient.LookupUsing(flags.resolver)
}
resolver := appclient.NewResolver(targets, dnsLookupFn, clients.Set)
defer resolver.Stop()
processCache := process.NewCachingWalker(process.NewWalker(flags.procRoot))