Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP 204 returned from /ping endpoint is unsuitable for Google Kubernetes Cloud healthcheck #4935

Closed
noodle-rubrik opened this issue Oct 29, 2018 · 6 comments
Assignees
Labels
area/influxdb feature request Requests for new plugin and for new features to existing plugins
Milestone

Comments

@noodle-rubrik
Copy link

Feature Request

The "/ping" endpoint of influxdb_listener should have an option to return HTTP status code 200

Proposal:

Google Cloud does not allow you to configure the behavior of its health checks, other than the endpoint, it requires a 200 response. This means that the "/ping" endpoint, which seems intended for this sort of use case, can't be used on this cloud provider. The return code should be changed to 200, either by default, or by adding a param to the endpoint, as suggested in a similar issue for influxdb itself.
[1] influxdata/influxdb#9772

Current behavior:

Calling the "/ping" endpoint returns 204. Using "/ping" as your Google HTTP(s) Load Balancer backend's health check fails in a (to me) surprising way. As a workaround, "/query" can be used to return the correct status code, but this is more obtuse, and the behavior of an empty query might change in the future, or consume more resources than a simple ping.

Desired behavior:

If "/ping" can't be configured to return 200 by default, then configuring "/ping?statusCode=200" as the health check should return 200, as proposed in the linked influxdb issue. If that proposal is not accepted, then both implementations of "/ping" should have the same API to request a different status code, so that influxdb_listener is as similar to influxdb as possible.

Use case: [Why is this important (helps with prioritizing requests)]

We are deploying telegraf to GCP as a proxy to forward traffic from a second telegraf instance to influxdb. The influxdb_listener plugin is definitely the right tool for this use case, and we can put this telegraf instance behind an endpoint of our load balancer, as long as we have a health check that returns 200 OK.

@noodle-rubrik
Copy link
Author

noodle-rubrik commented Oct 30, 2018

Maybe this should be a separate issue, but I also am running into problems when trying to use the basic authentication options, since there's no option to send those with Google's healthchecks. I don't think that /ping needs to be protected by this authentication, does it? Removing the call to AuthenticateIfSet for /ping would also help when running telegraf influxdb_listener on GKE.

This one has a better workaround though, by adding a second [[inputs.influxdb_listener]] without authentication, only accessible internally.

@glinton
Copy link
Contributor

glinton commented Oct 30, 2018

I'm surprised you can't configure the GCP Load balancers to see a 204 as "up". I personally think you are right, that the /ping endpoint doesn't need to be behind authentication, but if that's the case, we should strip out any server identification from the response.

@glinton glinton added feature request Requests for new plugin and for new features to existing plugins area/influxdb hacktoberfest labels Oct 30, 2018
@danielnelson
Copy link
Contributor

danielnelson commented Oct 30, 2018

Since this is the influxdb_listener, we should mirror whatever InfluxDB does for compatibility. I'm not sure, but I would assume that means /ping is subject to authentication.

https://github.com/influxdata/influxdb/blob/v1.6.4/services/httpd/handler.go#L809

@glinton
Copy link
Contributor

glinton commented Oct 30, 2018

It looks like /ping isn't behind authentication in influxdb v1.6.4, but I agree that influxdb_listener should mirror influx's api. if it changes to allow a different response code, let us know so we can make that change here too

@danielnelson
Copy link
Contributor

danielnelson commented Oct 30, 2018

Here is what will be, I assume, in 1.7:
https://github.com/influxdata/influxdb/blob/2f49e00f7f3801a506304c3b6d8165b2f4039f3d/services/httpd/handler.go#L851-L862

Looks like the return code is switched if the verbose flag is set, we can add this once it goes into release candidates.

@tanuj83
Copy link

tanuj83 commented Mar 27, 2019

which version this fix would be available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/influxdb feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

No branches or pull requests

4 participants