aboutsummaryrefslogtreecommitdiff
path: root/plugin/health/setup.go (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-09-24For caddy v1 in our org (#4018)Gravatar Miek Gieben 1-2/+1
* 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-07-25using promauto package to ensure all created metrics are properly registered ↵Gravatar Zou Nengren 1-6/+0
(#4025) Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2019-09-20all: simply registering plugins (#3287)Gravatar Miek Gieben 1-6/+1
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-07-03Update Caddy to 1.0.1, and update import path (#2961)Gravatar Yong Tang 1-1/+1
* 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-05-04plugin/health: add OnRestartFailed (#2812)Gravatar Miek Gieben 1-1/+2
Add OnReStartFailed which makes the health plugin stay up if the Corefile is corrupt and we revert to the previous version. Also needs a fix for the channel handling See #2659 Testing it will log the following when restarting with a corrupted Corefile ~~~ 2019-05-04T18:01:59.431Z [INFO] linux/amd64, go1.12.4, CoreDNS-1.5.0 linux/amd64, go1.12.4, [INFO] SIGUSR1: Reloading [INFO] Reloading [ERROR] Restart failed: Corefile:5 - Error during parsing: Unknown directive 'bdhfhdhj' [ERROR] SIGUSR1: starting with listener file descriptors: Corefile:5 - Error during parsing: Unknown directive 'bdhfhdhj' ~~~ After which the curl still works. This also needed a change to reset the channel used for the metrics go-routine which gets closed on shutdown, otherwise you'll see: ~~~ ^C[INFO] SIGINT: Shutting down panic: close of closed channel goroutine 90 [running]: github.com/coredns/coredns/plugin/health.(*health).OnFinalShutdown(0xc000089bc0, 0xc000063d88, 0x4afe6d) ~~~ Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-04plugin/health: cleanups (#2811)Gravatar Miek Gieben 1-4/+3
Small, trivial cleanup: got triggered because I saw a comment on how health plugins polls other plugins which isn't true. * Remove useless newHealth function * healthParse -> parse * Remove useless constants Net deletion of code. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-03-07plugin/health: remove ability to poll other plugins (#2547)Gravatar Miek Gieben 1-27/+0
* plugin/health: remove ability to poll other plugins This mechanism defeats the purpose any plugin (mostly) caching can still be alive, we can probably forward queries still. Don't poll plugins, just tell the world we're up and running. It was only actually used in kubernetes; and there specifically would mean any network hiccup would NACK the entire server health. Fixes: #2534 Signed-off-by: Miek Gieben <miek@miek.nl> * update docs based on feedback Signed-off-by: Miek Gieben <miek@miek.nl>
2018-09-19Ensure Re-register of metrics variables after a reload (#2080)Gravatar Francois Tur 1-1/+1
* - ensure plugins that use prometheus.MustRegister, re-register after reload - removing once.Do on the startup function was simplest way to do it. * - fix underscored names (advice of bot) * - tune existing UT for reload, and add a test verifying failing reload does not prevent correct registering for metrics * - ensure different ports for tests that can run in same time ..
2018-04-21reload: use OnRestart (#1709)Gravatar Miek Gieben 1-1/+2
* 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-01plugin/metrics: add MustRegister function (#1648)Gravatar Miek Gieben 1-9/+1
This registers the Collectors iff the metrics plugin has been loaded. Safes a bunch of code in each and every plugin's setup code.
2018-03-02plugin/health: make reload work (#1585)Gravatar Miek Gieben 1-1/+1
* plugin/health: make reload work Remove the once.Do from the startup, so we can re-bind the HTTP listener. Also clarify the usage of health in multiple server blocks (this is not the best approach - but there isn't a generic solution at this point). Manual tested as we lack testing infra, i.e kill -SIGUSR1 and some CURLing of the health endpoint. * Readme test fix * update * dont need this
2018-01-18plugin/health: add lameduck mode (#1379)Gravatar Miek Gieben 1-8/+32
* plugin/health: add lameduck mode Add a way to configure lameduck more, i.e. set health to false, stop polling plugins. Then wait for a duration before shutting down. As the health middleware is configured early on in the plugin list, it will hold up all other shutdown, meaning we still answer queries. * Add New * More tests * golint * remove confusing text
2018-01-10Overloaded (#1364)Gravatar Miek Gieben 1-3/+18
* plugin/health: add 'overloaded metrics' Query our on health endpoint and record (and export as a metric) the time it takes. The Get has a 5s timeout, that, when reached, will set the metric duration to 5s. The actually call "I'm I overloaded" is left to an external entity. * README * golint and govet * and the tests
2017-12-12Instead of hardcoding plugin lists in autopath/health, use interfaces. (#1306)Gravatar James Hartig 1-3/+3
Switched health and autopath plugin to allow any plugins to be used instead of a hardcoded list. I did not switch federation over since it wasn't obvious that anything other than kubernetes could be used with it. Fixes #1291
2017-09-16More Middleware -> Plugin conversions (#1088)Gravatar Miek Gieben 1-1/+1
Forgot about these.
2017-09-14Remove the word middleware (#1067)Gravatar Miek Gieben 1-0/+73
* 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