Skip to content

Add unsecured /health endpoint, remove auth checks from isLeader#5087

Merged
himanshug merged 2 commits intoapache:masterfrom
jon-wei:status_endpoints
Nov 15, 2017
Merged

Add unsecured /health endpoint, remove auth checks from isLeader#5087
himanshug merged 2 commits intoapache:masterfrom
jon-wei:status_endpoints

Conversation

@jon-wei
Copy link
Copy Markdown
Contributor

@jon-wei jon-wei commented Nov 14, 2017

This PR adds a new /health endpoint on all services, intended for external health checks issued to Druid services.

This endpoint is unsecured, as external health checks do not necessarily support attaching authentication credentials (e.g., those issued by Amazon ELB).

This PR also removes auth checks from the "/isLeader" endpoints on coordinators and overlords, for similar external compatibility reasons.

"/overlord/false"
"/overlord/false",
"/health",
"/druid/coordinator/v1/isLeader"
Copy link
Copy Markdown
Contributor

@gianm gianm Nov 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to include the overlord isLeader URL too. oops, no you don't, that's in a different file.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of putting /health and /druid/coordinator/v1/isLeader here (& similar in other CLI files) I suggest adding something in the resource itself that just sets the "yeah, I checked myself" flag. Probably using a new helper in AuthorizationUtils. It's better because it's more local -- it's really easy for someone reviewing the http code to miss that the security check is skipped here.

Copy link
Copy Markdown
Contributor Author

@jon-wei jon-wei Nov 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could move the authorization check into the resource, but to skip authentication I'd still need to setup the UnsecuredResourceFilter with the unsecured paths (since the authentication checks happen before the request hits the resource handler methods).

Maybe another approach for authentication could be to have the resources with unsecured endpoints register with some singleton injected registry object that UnsecuredResourceFilter checks (and have UnsecuredResourceFilter apply to all paths), but I'd rather handle that in a separate PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that makes sense. In that case I'd suggest leaving things as you have them here, but adding a comment in the resource file saying that this file has it listed as unsecured.

Really, I'm just concerned that a reader of the http code is going to be confused about where the security check is. I was suggesting a programmatic approach but a comment works too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments on the resources with these unsecured paths, pointing to the service initialization code


/**
*/
@Path("/health")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you put this at /status/health? It would simplify the top level url structure a bit. It could be part of StatusResource.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this to /status/health and StatusResource

Copy link
Copy Markdown
Contributor

@gianm gianm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM.

@himanshug himanshug merged commit af44d11 into apache:master Nov 15, 2017
gianm pushed a commit to implydata/druid-public that referenced this pull request Nov 15, 2017
…che#5087)

* Add unsecured /health endpoint, remove auth checks from isLeader

* PR comments
gianm pushed a commit to implydata/druid-public that referenced this pull request Dec 5, 2017
…che#5087)

* Add unsecured /health endpoint, remove auth checks from isLeader

* PR comments
@jon-wei jon-wei added this to the 0.12.0 milestone Jan 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants