* Add automaxprocs for better multi processor support in containerized environments
Signed-off-by: Viktor Rodionov <33463837+Shmillerov@users.noreply.github.com>
* correct imports ordering
Signed-off-by: Viktor Rodionov <33463837+Shmillerov@users.noreply.github.com>
* warning instead of fatal
Signed-off-by: Viktor Rodionov <33463837+Shmillerov@users.noreply.github.com>
* fix imports ordering
Signed-off-by: Viktor Rodionov <33463837+Shmillerov@users.noreply.github.com>
---------
Signed-off-by: Viktor Rodionov <33463837+Shmillerov@users.noreply.github.com>
In kubernetes' audit logs you'll see:
"userAgent":"coredns/v0.0.0 (linux/amd64) kubernetes/$Format"
This change adds a userAgent to the requests made by CoreDNS against the kubernetes API:
"userAgent":"CoreDNS/v1.11.1 git_commit:ae2bbc29be1aaae0b3ded5d188968a6c97bb3144 (linux/amd64/go1.22)"
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
* bump golangci-lint with support of go 1.19
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
* remove deprecated usage of varcheck, deadcode, and structcheck
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
While performing security scans there were several
issue raised as G304 (CWE-22): Potential file inclusion via variable.
As some files path are taken from user input, it is possible the
filepath passed by user may have unintended effect if not properly formed.
This fix add Clean to remove the security warning and address some
potential issue.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* For caddy v1 in our org
This RP changes all imports for caddyserver/caddy to coredns/caddy. This
is the v1 code of caddy.
For the coredns/caddy repo the following changes have been made:
* anything not needed by us is deleted
* all `telemetry` stuff is deleted
* all its import paths are also changed to point to coredns/caddy
* the v1 branch has been moved to the master branch
* a v1.1.0 tag has been added to signal the latest release
Signed-off-by: Miek Gieben <miek@miek.nl>
* Fix imports
Signed-off-by: Miek Gieben <miek@miek.nl>
* Group coredns/caddy with out plugins
Signed-off-by: Miek Gieben <miek@miek.nl>
* remove this file
Signed-off-by: Miek Gieben <miek@miek.nl>
* Relax import ordering
github.com/coredns is now also a coredns dep, this makes
github.com/coredns/caddy fit more natural in the list.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Fix final import
Signed-off-by: Miek Gieben <miek@miek.nl>
* Run gostaticheck
Run gostaticcheck on the codebase and fix almost all flagged items.
Only keep
* coremain/run.go:192:2: var appVersion is unused (U1000)
* plugin/chaos/setup.go:54:3: the surrounding loop is unconditionally terminated (SA4004)
* plugin/etcd/setup.go:103:3: the surrounding loop is unconditionally terminated (SA4004)
* plugin/pkg/replacer/replacer.go:274:13: argument should be pointer-like to avoid allocations (SA6002)
* plugin/route53/setup.go:124:28: session.New is deprecated: Use NewSession functions to create sessions instead. NewSession has the same functionality as New except an error can be returned when the func is called instead of waiting to receive an error until a request is made. (SA1019)
* test/grpc_test.go:25:69: grpc.WithTimeout is deprecated: use DialContext and context.WithTimeout instead. Will be supported throughout 1.x. (SA1019)
The first one isn't true, as this is set via ldflags. The rest is
minor. The deprecation should be fixed at some point; I'll file some
issues.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Make sure to plug in the plugins
import the plugins, that file that did this was removed, put it in the
reload test as this requires an almost complete coredns server.
Signed-off-by: Miek Gieben <miek@miek.nl>
* startup: add logo
As discussed in #3225, lets add a little logo. This PR incorperates this
in the startup text. It also removes the logging output as this outputs
identical lines of text, but for no clear reason. This means --quiet now
means "no output on startup at all".
Currently it looks like this:
~~~
.:1053
______ ____ _ _______
/ ____/___ ________ / __ \/ | / / ___/ CoreDNS-1.6.2
/ / / __ \/ ___/ _ \/ / / / |/ /\__ \ linux/amd64, go1.12.9,
/ /___/ /_/ / / / __/ /_/ / /| /___/ /
\____/\____/_/ \___/_____/_/ |_//____/
~~~
We have 2 lines extra on the right if we need to print more (no ideas
come to mind currently).
Signed-off-by: Miek Gieben <miek@miek.nl>
* Add distinct marker for grep and cut purposes
Signed-off-by: Miek Gieben <miek@miek.nl>
The -cpu flag is a weird one (and copied originally from Caddy), it
basically sets GOMAXPROCS which can be *easily* done by just setting
that environment variable. Also with systemd and containerized env you
set this externally *anyway*, so there is little use to do this again in
the binary.
Also the option's help was confusing (i.e. percentage of what?). Remove
the option and supporting files.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Update Caddy to 1.0.1, and update import path
This fix updates caddy to 1.0.1 and also
updates the import path to github.com/caddyserver/caddy
This fix fixes 2959
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Also update plugin.cfg
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Update and bump zplugin.go
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This clear out the remaining map[x]bool usage and moves the bool to an
empty struct.
Two note worthy other changes:
* EnableChaos in the server is now also exported to make it show up in
the documentation.
* The auto plugin is left as is, because there the boolean is
explicitaly set to false to signal 'to-be-deleted' and the key is left
as-is.
Signed-off-by: Miek Gieben <miek@miek.nl>
Default to using pkg/log for all logging and use a fixed time prefix
which is RFC3339Millli (doesn't exist in time, so we just extended
RFC3339), i.e. Nano might be pushing it.
Logs go from:
2018/10/30 19:14:55 [INFO] CoreDNS-1.2.5
2018/10/30 19:14:55 [INFO] linux/amd64, go1.11,
to:
2018-10-30T19:10:07.547Z [INFO] CoreDNS-1.2.5
2018-10-30T19:10:07.547Z [INFO] linux/amd64, go1.11,
Which includes the timezone - which oddly the std log package doesn't
natively do.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Implement deprecation notice for 1.1.4
This still allows all the config to be parsed, but noops it:
* -log; always set the log to stdout; no matter what.
* https_google; removed from the proxy implementation.
* reverse plugin: set to deprecated.
* Whole of reverse can go
* Remove test for deprecated plugin
* doc: some function/vars/const/package level updates
Various update that stood out while reading godoc.org for CoreDNS.
* Fix some misspellings as well
* move flag blacklisting to main
Doing it in init() is the wrong place or something else changed. Doing
it in main() makes it easy to see *when* this happens.
* keep trapsignals
This fix is an enhancement of external plugin enabling.
Previously, it was already able to build a customerized
coredns with plugins enabled selectively, without changing
coredns source code. However, all default plugins are
actually bundled because of the import rule:
```
"github.com/coredns/coredns/coremain"
```
The issue is best described with the following:
```
root@localhost:/go/src/github.com/coredns/coredns/sample# cat sample.go
package main
import (
_ "github.com/coredns/forward"
"github.com/coredns/coredns/coremain"
"github.com/coredns/coredns/core/dnsserver"
)
var directives = []string{
"forward",
"startup",
"shutdown",
}
func init() {
dnsserver.Directives = directives
}
func main() {
coremain.Run()
}
root@localhost:/go/src/github.com/coredns/coredns/sample#
root@localhost:/go/src/github.com/coredns/coredns/sample# go build -v sample.go
root@localhost:/go/src/github.com/coredns/coredns/sample# ./sample -plugins
root@localhost:/go/src/github.com/coredns/coredns/sample# ./sample -plugins
Server types:
dns
Caddyfile loaders:
flag
default
Other plugins:
dns.auto
dns.autopath
dns.bind
dns.cache
dns.chaos
dns.debug
dns.dnssec
dns.dnstap
dns.erratic
dns.errors
dns.etcd
dns.federation
dns.file
dns.forward
dns.health
dns.hosts
dns.kubernetes
dns.loadbalance
dns.log
dns.nsid
dns.pprof
dns.prometheus
dns.proxy
dns.reverse
dns.rewrite
dns.root
dns.route53
dns.secondary
dns.template
....
```
This fix moves zplugins.go to a different package/directory so that
it is possible to "only import plugins as needed".
The following is the new output after this fix:
```
root@localhost:/go/src/github.com/coredns/coredns/sample# ./sample -plugins
Server types:
dns
Caddyfile loaders:
flag
default
Other plugins:
dns.forward
dns.prometheus
shutdown
startup
root@localhost:/go/src/github.com/coredns/coredns/sample#
```
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Now the output would be:
```
./coredns -version
CoreDNS-010
linux/amd64, go1.8, 241e3db
```
In case the local file has been modified, then the output would be (with --dirty):
```
./coredns -version
CoreDNS-010
linux/amd64, go1.8, 241e3db-dirty
```
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* middleware/chaos: fix version
Move the version setting into a init function so it is done early. Then
tweak the setup code for chaos a bit to correctly pick this version up.
Add an integration test to pick this up in the toplevel test/ directory.
Fixes#667
* Update tests
When no Corefile is given, default to loading the whoami middleware on
the default port (2053). Also add back the -port flag that allows you
to override the default port.
Further cleanup the startup messages and use caddy's OnStartupComplete()
to blurp out which zones and ports we have. These can be suppressed
with the -quiet flag.
Normal startup:
miek.nl.:1053
miek.nl2.:1053
example.org.:1054
2016/09/17 20:41:19 [INFO] CoreDNS-001 starting
CoreDNS-001 starting
with the -quiet flag:
2016/09/17 20:41:34 [INFO] CoreDNS-001 starting
* Removed lumberjack from coremain
As is mentioned in 251, this fix removed lumberjack from coremain.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Remove lumberjack from log middleware
As mentioned in 251, lumberjack is not suitable for applications like CoreDNS
so it is removed from the log middleware.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Update log/README.md as lumberjack has been removed
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Adjust default log output from `ioutil.Discard` to `os.Stdout`
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Stop the caddy message and start our own init notifications.
Log the version of CoreDNS when starting up.
Fix all middleware's setup functions so that return the error prefixed
with *which* middleware was failing; leads to better debuggable errors
when starting up.
Fix the code copied from Caddy to refer to Corefile and make 'coredns'
with flags pickup a local Corefile.
Also remove some references to Caddy in the docs and output of coredns.
Fixes#235