Commit graph

38 commits

Author SHA1 Message Date
Dan Salmon
7bced74f51
Fix typo (#6053) 2023-04-25 11:24:49 -04:00
Ondřej Benkovský
4ae811ad96
plugin/reload : stop scheduler on shutdown (#5686) 2022-10-11 07:05:00 -04:00
Yong Tang
c7b55230e0
[plugin/reload]: Change hash from md5 to sha512 (#5226)
This PR changes the reload plugin's hash from md5 to sha512,
for the purpose of avoid using md5. MD5 is a weak hash algorithm
and for security reasons we will avoid using it.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2022-03-07 09:55:10 -08:00
Miek Gieben
c2e4f2f1ab
docs: move Also See to See Also (#4245)
sed -i 's/Also See/See Also/' plugin/**/README.md

Some plugins did already use 'See Also', so it's all consistent now.

Fixes: #4196

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-10-28 10:56:35 -07:00
Miek Gieben
b003d06003
For caddy v1 in our org (#4018)
* 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>
2020-09-24 18:14:41 +02:00
Zou Nengren
4166dcc2fe
using promauto package to ensure all created metrics are properly registered (#4025)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-07-25 08:06:28 -07:00
Zou Nengren
87214a4c5c
introduce metric naming test (#3789)
* introduce metric naming test

Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>

* Update metrics.go

Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-03-31 08:07:36 +02:00
Zou Nengren
fa1e909d0b
regitry reload metrics (#3784)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-03-27 09:40:59 +01:00
Chris O'Haver
5cd8472384
Fix plugin name in project README (#3683)
* Update README.md

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* fix readme occurances

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-03-26 10:24:56 -04:00
Miek Gieben
19cfa2960c
Cleanup metrics (#3776)
Cleanup a variety of metric issues.
* Eliminate department of redundancy "count_total" naming.
* Use the plural of the unit when appropriate. (ex, "requests")
* Remove label names from metric names where appropriate. (ex, "rcode")
* Simplify request metrics by consolidating type label in to the base
request counter.
* Re-generate man pages.

Signed-off-by: Ben Kochie <superq@gmail.com>

Co-authored-by: Ben Kochie <superq@gmail.com>
2020-03-26 09:17:33 +01:00
Zou Nengren
1dba31ee7d
export config file hash in a metric (#3768)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-03-25 14:33:04 +01:00
Miek Gieben
24176a97e6
Move to CODEOWNERS (#3489)
* Move to CODEOWNERS

No change in who own what; just a move to CODEOWNERS. This allows
dreck cleanups.

Added .dreck.yaml for alias and exec.

Fixes: #3486

Signed-off-by: Miek Gieben <miek@miek.nl>

* stickler bot

Signed-off-by: Miek Gieben <miek@miek.nl>

* sort the file

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-11-29 13:17:05 +00:00
Miciah Dashiel Butler Masters
1942746c48 plugin/reload: Fix "durations" documentation link (#3431)
* plugin/reload/README.md: Fix the syntax of the link to the Go
documentation for duration values.

Signed-off-by: Miciah Dashiel Butler Masters <mmasters@redhat.com>
2019-11-06 13:27:55 -08:00
Miek Gieben
65458b2de2
Directive -> plugin (#3363)
Caught my eye, we name things directive still, esp when talking about
the prometheus *plugin*. Rename everything that needs to be plugin to
'plugin'. Also make sure Metrics is a H2 section (not H1).

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-08 10:20:48 +01:00
Miek Gieben
7328d3e8c9
plugin/reload: reflow documentation (#3313)
* plugin/reload: reflow documentation

For some reason these we're all bullets points, which made for awkward
reading.

Signed-off-by: Miek Gieben <miek@miek.nl>

* typo

Signed-off-by: Miek Gieben <miek@miek.nl>

* Update plugin/reload/README.md

Co-Authored-By: Michael Grosser <development@stp-ip.net>
2019-09-27 11:10:47 +01:00
Miek Gieben
004c5fca9d
all: simply registering plugins (#3287)
Abstract the caddy call and make it simpler.

See #3261 for some part of the discussion.

Go from:

~~~ go
func init() {
       caddy.RegisterPlugin("any", caddy.Plugin{
               ServerType: "dns",
               Action:     setup,
       })
}
~~~

To:

~~~ go
func init() { plugin.Register("any", setup) }
~~~

This requires some external documents in coredns.io to be updated as
well; the old way still works, so it's backwards compatible.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-09-20 08:02:30 +01:00
wwgfhf
1590320ff2 fix typo (#3180) 2019-08-23 06:29:17 +00:00
Chris O'Haver
3f47fc8ba4
typo fixes (#3169)
* spelling fixes

* its/it's
2019-08-21 16:08:55 -04:00
Erik Wilson
367d285765 plugin/reload: Graceful reload of imported files (#3068)
Automatically submitted.
2019-07-30 22:44:16 +00:00
Yong Tang
f8bba51f84
Update Caddy to 1.0.1, and update import path (#2961)
* 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>
2019-07-03 09:04:47 +08:00
Anshul Sharma
ad352cee88 plugin/reload: Add metrics (#2922)
* Issue 2920
- Add failed reload counter metrics

* typo fix

* Requested Changes
2019-06-26 07:38:46 +01:00
Miek Gieben
824367e8e6
plugin/reload: add bug text about import (#2638)
Signed-off-by: Miek Gieben <miek@miek.nl>
2019-03-02 09:03:25 +00:00
Miek Gieben
a72f3a161c
plugin/reload: fix data races (#2567)
Reload didn't take proper care to protect the fields from use in
different goroutines. Add a mutex and add helpers for usage and
interval.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-02-17 14:57:36 +00:00
Miek Gieben
725becd134
Stop importing testing in the main binary (#2479)
* Stop importing testing in the main binary

Stop importing "testing" into the main binary:

* test/helpers.go imported it; remote that and change function signature
* update all tests that use this

Signed-off-by: Miek Gieben <miek@miek.nl>

* Drop import testing from metrics plugin

Signed-off-by: Miek Gieben <miek@miek.nl>

* more fiddling

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-01-19 11:23:13 +00:00
Karsten Weiss
6d8a078704 Typo fixes (#2031) 2018-08-14 08:55:55 -07:00
Miek Gieben
f3134da45e
Clean up tests logging (#1979)
* Clean up tests logging

This cleans up the travis logs so you can see the failures better.

Older tests in tests/ would call log.SetOutput(ioutil.Discard) in
a haphazard way. This add log.Discard and put an `init` function in each
package's dir (no way to do this globally). The cleanup in tests/ is
clear.

All plugins also got this init function to have some uniformity and kill
any (future) logging there in the tests as well.

There is a one-off in pkg/healthcheck because that does log.

Signed-off-by: Miek Gieben <miek@miek.nl>

* bring back original log_test.go

Signed-off-by: Miek Gieben <miek@miek.nl>

* suppress logging here as well

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-19 16:23:06 +01:00
Miek Gieben
bcc749db04
Docs (#1943)
* Doc updates

Make the name section fit on one line.

Signed-off-by: Miek Gieben <miek@miek.nl>

* Regen docs

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-06 11:27:40 +01:00
Chris O'Haver
8026dc2560
plugin/reload: mention auto in reload (#1793)
mention auto in reload docs
2018-05-11 15:09:38 -04:00
Miek Gieben
12b2ff9740
Use logging (#1718)
* update docs

* plugins: use plugin specific logging

Hooking up pkg/log also changed NewWithPlugin to just take a string
instead of a plugin.Handler as that is more flexible and for instance
the Root "plugin" doesn't implement it fully.

Same logging from the reload plugin:

.:1043
2018/04/22 08:56:37 [INFO] CoreDNS-1.1.1
2018/04/22 08:56:37 [INFO] linux/amd64, go1.10.1,
CoreDNS-1.1.1
linux/amd64, go1.10.1,
2018/04/22 08:56:37 [INFO] plugin/reload: Running configuration MD5 = ec4c9c55cd19759ea1c46b8c45742b06
2018/04/22 08:56:54 [INFO] Reloading
2018/04/22 08:56:54 [INFO] plugin/reload: Running configuration MD5 = 9e2bfdd85bdc9cceb740ba9c80f34c1a
2018/04/22 08:56:54 [INFO] Reloading complete

* update docs

* better doc
2018-04-22 21:40:33 +01:00
Miek Gieben
acbcad7b4e
reload: use OnRestart (#1709)
* reload: use OnRestart

Close the listener on OnRestart for health and metrics so the default
setup function can setup the listener when the plugin is "starting up".

Lightly test with some SIGUSR1-ing. Also checked the reload plugin with
this, seems fine:

.com.:1043
.:1043
2018/04/20 15:01:25 [INFO] CoreDNS-1.1.1
2018/04/20 15:01:25 [INFO] linux/amd64, go1.10,
CoreDNS-1.1.1
linux/amd64, go1.10,
2018/04/20 15:01:25 [INFO] Running configuration MD5 = aa8b3f03946fb60546ca1f725d482714
2018/04/20 15:02:01 [INFO] Reloading
2018/04/20 15:02:01 [INFO] Running configuration MD5 = b34a96d99e01db4015a892212560155f
2018/04/20 15:02:01 [INFO] Reloading complete
^C2018/04/20 15:02:06 [INFO] SIGINT: Shutting down

With this corefile:
.com {
  proxy . 127.0.0.1:53
  prometheus :9054
  whoami
  reload
}

. {
  proxy . 127.0.0.1:53
  prometheus :9054
  whoami
  reload
}

The prometheus port was 9053, changed that to 54 so reload would pick it
up.

From a cursory look it seems this also fixes:
Fixes #1604 #1618 #1686 #1492

* At least make it test

* Use onfinalshutdown

* reload: add reload test

This test #1604 adn right now fails.

* Address review comments

* Add bug section explaining things a bit

* compile tests

* Fix tests

* fixes

* slightly less crazy

* try to make prometheus setup less confusing

* Use ephermal port for test

* Don't use the listener

* These are shared between goroutines, just use the boolean in the main
  structure.
* Fix text in the reload README,
* Set addr to TODO once stopping it
* Morph fturb's comment into test, to test reload and scrape health and
  metric endpoint
2018-04-21 17:43:02 +01:00
Miek Gieben
26d1432ae6
Update all plugins to use plugin/pkg/log (#1694)
* Update all plugins to use plugin/pkg/log

I wish this could have been done with sed. Alas manually changed all
callers to use the new plugin/pkg/log package.

* Error -> Info

* Add docs to debug plugin as well
2018-04-19 07:41:56 +01:00
Miek Gieben
6cec66ce40
plugin/reload: enable (#1587)
Couldn't revert the original commit, just manually perform the needed
tweaks.
2018-03-02 17:17:26 -08:00
Miek Gieben
f697b33283
return an error for multiple use of some plugins (#1559)
* plugins: Return error for multiple use of some

Return plugin.ErrOnce when a plugin that doesn't support it, is called
mutliple times.

This now adds it for: cache, dnssec, errors, forward, hosts, nsid.
And changes it slightly in kubernetes, pprof, reload, root.

* more tests
2018-02-28 18:16:05 -08:00
Miek Gieben
2e894eb0a2
plugin/reload: disable for now (#1511)
Reloading should work (kill -TERM reload the coredns process), but a lot
of plugins can't handle it proper. Disable to reload plugin until we fix
(most) of the plugins
2018-02-09 11:30:55 +00:00
Sandeep Rajan
d0892abc2c add sync for proper termination (#1507) 2018-02-08 13:57:49 -05:00
Miek Gieben
fd7abd9849
Add OWNERS file (#1486)
This should have everyone, but the process was quite manual. The rename
from middleware -> plugin also meant I had to do some extra digging on
who actually submitted the PR. I also double checked the current list of
people with commit access.

Every plugin now has an OWNERS, except *reverse*. I'll file a bug for
that.
2018-02-08 10:55:51 +00:00
Francois Tur
2440024772 Plugin/RELOAD - Tune usage of var global, add limit to options (#1457)
* tune usage of var global, add limit to options

* update readme for minimal values

* useless change to quick-off codecov

* fix msgs for min values and tune the flag for end of reload usage, with a 'maybe' option

* adding UT for min values, adding MD5 of corefile on the log
2018-02-02 13:15:56 -05:00
John Belamaric
0b35d4d28f Reload hook (#1445)
* Add reload directive

* gofmt

* Fix default jitter and error message

* remove unneeded call to NextArg, add a couple negative setup tests

* Review feedback
2018-01-27 10:42:57 +00:00