controller-runtime icon indicating copy to clipboard operation
controller-runtime copied to clipboard

Manager should expose http.Handlers to allow extension by users

Open JoelSpeed opened this issue 4 years ago • 18 comments

Based on a conversation we had on the community call on the 18th June 2020:

There are several http.Handlers set up by the manager that are currently only accessible if served by the manager (metrics and webhooks). If the manager exposed these handlers once constructed this would allow extension by authors to customise how these endpoints are served.

For example, an author could use their own server and serve TLS connections directly instead of using the HTTP only server that is currently implemented with controller-runtime

Or the user could add some HTTP middleware to ensure that all requests to the endpoints are logged in a particular way or authenticated and authorized before serving the content

JoelSpeed avatar Jun 19 '20 09:06 JoelSpeed

/milestone Next /help /kind design /priority important-longterm

vincepri avatar Jul 22 '20 22:07 vincepri

@vincepri: This request has been marked as needing help from a contributor.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

/milestone Next /help /kind design /priority important-longterm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jul 22 '20 22:07 k8s-ci-robot

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Oct 20 '20 22:10 fejta-bot

/remove-lifecycle stale

I still think we should do this at some point

JoelSpeed avatar Oct 21 '20 10:10 JoelSpeed

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Jan 19 '21 10:01 fejta-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten

fejta-bot avatar Feb 18 '21 11:02 fejta-bot

/remove-lifecycle rotten

Still think this would be useful longer term

JoelSpeed avatar Feb 18 '21 11:02 JoelSpeed

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale

fejta-bot avatar May 19 '21 12:05 fejta-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten

fejta-bot avatar Jun 18 '21 12:06 fejta-bot

/remove-lifecycle rotten

Still think this is useful, this came up recently in a Cluster API conversation about Kube RBAC proxy (which is where this originally came from as well)

JoelSpeed avatar Jun 22 '21 10:06 JoelSpeed

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Sep 20 '21 10:09 k8s-triage-robot

/remove-lifecycle stale

palnabarun avatar Oct 06 '21 16:10 palnabarun

/lifecycle frozen (until someone takes this up)

palnabarun avatar Oct 06 '21 16:10 palnabarun

/assign

umangachapagain avatar Mar 06 '22 15:03 umangachapagain

@umangachapagain Are you still working on this? Otherwise, I could also work on this.

alexanderstephan avatar Mar 10 '23 09:03 alexanderstephan

/assign

alexanderstephan avatar Mar 18 '23 00:03 alexanderstephan

I see two possible approaches for the API of this.

First, my current attempt, which is exposing/exporting the http.Handlers and do not let the manager serve individual handlers / endpoints by having dedicated flags for each.

Besides, there could be a complete refactoring which decouples the handlers in exported, stand-alone functions. Which would result in bigger, more involved code-changes, but might be more straight forward to use since no flags are necessary.

Any ideas / preferences for this?

alexanderstephan avatar Apr 04 '23 14:04 alexanderstephan

But I think exposing/exporting http.Handlers is not enough. User might want to also change some configuration of the http.Server (for example to serve TLS traffic instead of just HTTP). It feels like we should be able to have some kind of callback to allow changing configuration for both http.Server and http.Handlers before the server starts.

VirrageS avatar Jun 13 '23 12:06 VirrageS