Commit Graph

20 Commits

Author SHA1 Message Date
Ryan Abrams c192a281f8
Merge pull request #2813 from lucab/ups/spec-json-binary
registry: fix binary JSON content-type
2019-03-01 14:26:54 -08:00
Manish Tomar da8db4666b Fix gometalint errors
Signed-off-by: Manish Tomar <manish.tomar@docker.com>
2019-02-04 16:01:04 -08:00
Luca Bruno 15b0204758
registry: fix binary JSON content-type
This fixes registry endpoints to return the proper `application/json`
content-type for JSON content, also updating spec examples for that.

As per IETF specification and IANA registry [0], the `application/json`
type is a binary media, so the content-type label does not need any
text-charset selector. Additionally, the media type definition
explicitly states that it has no required nor optional parameters,
which makes the current registry headers non-compliant.

[0]: https://www.iana.org/assignments/media-types/application/json

Signed-off-by: Luca Bruno <lucab@debian.org>
2019-01-14 09:04:42 +00:00
Derek McGowan db0a4ec1c8
Enable static checks
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-08-06 14:49:11 -07:00
fate-grand-order 3161f9d1fd fix typos in comment
Signed-off-by: fate-grand-order <chenjg@harmonycloud.cn>
2017-02-27 14:06:18 +08:00
Javier Palomo Almena 8b3d826801 Documentation fix for package 'health'. Use proper import path for 'health/api'
Signed-off-by: Javier Palomo Almena <javier.palomo.almena@gmail.com>
2017-01-16 18:38:22 +01:00
ning xie e7140e5361 refactor doc comment
Signed-off-by: andy xie <andy.xning@gmail.com>
2016-12-16 11:42:06 +08:00
ning xie 658cda621f fix filechecker in health with precondition check
Signed-off-by: andy xie <andy.xning@gmail.com>
2016-12-06 10:13:55 +08:00
allencloud db90724ab0 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-06-02 23:03:27 +08:00
Aaron Lehmann b67aab2f60 Add headers parameter for HTTP checker
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-08-20 15:11:16 -07:00
Aaron Lehmann e8f088fea6 Add a TCP health checker
Also, add timeout and status code parameters to the HTTP checker, and
remove the threshold parameter for the file checker.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-08-20 15:11:15 -07:00
Aaron Lehmann b9b9cafa8f Expose a Registry type in health package, so unit tests can stay isolated from each other
Update docs.

Change health_test.go tests to create their own registries and register
the checks there. The tests now call CheckStatus directly instead of
polling the HTTP handler, which returns results from the default
registry.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-08-20 15:07:54 -07:00
Aaron Lehmann b09b0ffcf9 Add configurable file-existence and HTTP health checks
Add a section to the config file called "health". Within this section,
"filecheckers" and "httpcheckers" list checks to run. Each check
specifies a file or URI, a time interval for the check, and a threshold
specifying how many times the check must fail to reach an unhealthy
state.

Document the new options in docs/configuration.md.

Add unit testing for both types of checkers. Add an UnregisterAll
function in the health package to support the unit tests, and an
Unregister function for consistency with Register.

Fix a string conversion problem in the health package's HTTP checker.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-08-20 14:50:12 -07:00
Stephen J Day a68e081de4 Do not expose health check data in health handler
Because health check errors may expose sensitive data, we shouldn't expose the
details of the failure to clients. Instead, an error is returned to the client
with a hint about where they could find further information on why the service
is down.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2015-08-11 11:50:58 -07:00
Stephen J Day 6ba799b69e Provide simple storage driver health check
To ensure the ensure the web application is properly operating, we've added a
periodic health check for the storage driver. If the health check fails three
times in a row, the registry will serve 503 response status for any request
until the condition is resolved. The condition is reported in the response body
and via the /debug/health endpoint.

To ensure that all drivers will properly operate with this health check, a
function has been added to the driver testsuite.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2015-08-11 11:50:52 -07:00
Olivier Gambier 1ad9ac497c Merge pull request #590 from mattrobenolt/patch-1
Return valid json from StatusHandler
2015-06-11 09:51:45 -07:00
Hu Keping 5d5caa0e9a Test: add test for HTTPChecker
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-06-10 01:39:34 +08:00
Matt Robenolt b684b77a0c Return valid json from StatusHandler
Signed-off-by: Matt Robenolt <matt@ydekproductions.com>
2015-06-08 23:31:03 -07:00
Hu Keping 5680d7b8b7 Test: add test for health/check
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-06-05 18:02:34 +08:00
Diogo Mónica 5370f2c0be Adding first version of HealthCheck
Added a expvar style handler for the debug http server to allow health checks (/debug/health).

Signed-off-by: Diogo Monica <diogo@docker.com>
2015-03-20 14:38:40 -07:00