* Rename middleware to plugin
first pass; mostly used 'sed', few spots where I manually changed
text.
This still builds a coredns binary.
* fmt error
* Rename AddMiddleware to AddPlugin
* Readd AddMiddleware to remain backwards compat
Go is not super helpful if you checkout the code to a random path, then try and follow the build instructions in the README. Add some instructions that help users who don't deal with Go on a day-to-day basis to get it right.
Fixes#1070. Thanks to @johnbelamaric for reminding me about Go's deficiencies.
* Remove debug from interface and methods
* remove debug queries from etcd
* remove debug queries from k8s - they were not used
* And remove from mw/proxy-google as well
* Remove debug query test
Remove the [FILE] option from the docs, we still allow it, but this one
value that we allow now *stdout* isn't shown anymore.
Also test the snippet with readme_test.go by adding `~~ corefile`.
If a README has a corefile snippet that is annotated with `corefile`,
this test will parse the instance and checks the snippet is legal.
This means a) we will get better docs b) we know for sure everything
still parses.
The test parses everything in middleware/*/README.md, it does not check
for README presence, just Corefile snippets. The port used is 10053 and
overrides whatever port is set in the docs.
The secondary middleware was used as an example and adds two examples
that should parse.
failures show up as:
~~~
--- FAIL: TestReadme (0.04s)
readme_test.go:50: Testing ../middleware/secondary/README.md, with 100 byte snippet
readme_test.go:50: Testing ../middleware/secondary/README.md, with 93 byte snippet
readme_test.go:53: Failed to start server for input "middleware/secondary: Corefile:3 - Error during parsing: unknown property 'transfeT'":
. {
secondary example.net {
transfeT from 10.1.2.1
transfer to *
}
}
FAIL
~~~
* mw/etcd: revert 'add fallthrough'
This removes 'fallthrough' for *etcd* which is not needed. This was
added in 00f5c7797 but is totally not needed and creates backwards
incompat behavior even.
Thanks to @johnbelamaric for pointing this out in #925.
* remove here as well
* Revert "remove here as well"
This reverts commit 9d44397827425e567af01d43564c4294b42e98c9.
* Revert "mw/etcd: revert 'add fallthrough'"
This reverts commit 0cfe3cb1ab5495ed38a8a0486e3f5386f3bd95dc.
* mw/{etcd,kubernetes}: use fallthrough correctly
reverts of reverts, will rebase and squash later.
* mw/autopath: correct type for type switch
Use pointer to kubernetes as that is what is registered. Fix up
federation which had the same mistake.
* here
* mw/proxy: simplify google code
Minimize bootstrap code a bit, and block on the first resolve of the
google https endpont. Add more logging and include actual error in the
returned errors.
Also re-resolve every 120 seconds, instead of 300 (might eventually make
this an option).
* fix test
* mw/kubernetes: move fallthrough tests out
Remove the testcase duplication and put fallthrough tests in separate
file.
Also make some names shorter and more descriptive.
* fix test build
* fix corefile
fail startup when dnssec middleware has keys configured that can't be
used to sign any of the responses it should sign.
More tests added, including ones that actually trigger setup failures.
Check for a nil message and if we have a question section. Request is
usually called with an external Msg that already saw validation checks,
but we may also call it from message we create of our own, that may or
may not adhire to this. Just be more robust in this case.
This PR reverts a previous commit that was applied to master.
* mw/kubernetes: split integration tests
* separate file and test for api fallthrough, does not need all other
servers to be started.
* more split ups: make it clear when or when not we need an upstream server,
as just needlessly start it in doIntegrationTests.
* use identifiers from dns package -> "TypeSRV" -> dns.TypeSRV, as there
is no need to reinvent these.
* updates
* deploy work-around
* re-add weird sleep
Reloading caddy won't kill the health handler. Only on final shutdown
we stop the handler.
Currently when reloading CoreDNS with -SIGUSR1 the health handler stops
answering - there is a test for this but it doesn't capture whole
process reloading, sadly. This PR keeps the handler alive during reloads
and only stops on process shutdown.
This add the infrastructure to let other middleware report their health
status back to the health middleware. A health.Healther interface is
introduced and a middleware needs to implement that. A middleware
that supports healthchecks is statically configured.
Every second each supported middleware is queried and the global health
state is updated.
Actual tests have been disabled as no other middleware implements this
at the moment.
* mw/kubernetes: add configurable TTL
Add ttl option to kubernetes. This defaults to 5s but allows
configuration to go up to 3600.
Configure the tests so that a few actually check for the 5s, while the
rest use the TTL of 303 which is ignored by the checking code.
Fixes#935
* fix tests
* and more
block chaos queries, unless the chaos or proxy middleware is loaded. We
respond with REFUSED.
This removes the need for each middleware to do this class != ClassINET
if-then.
Also make config.Registry non-public.