Skip to content

WIP: Base server for go #9096

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

Closed
wants to merge 9 commits into from
Closed

WIP: Base server for go #9096

wants to merge 9 commits into from

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Apr 4, 2022

Description

Introduces a library called baseserver. It is a combination of an HTTP and gRPC server designed to make it dead-easy to get sensible defaults and be able to use a server.

Using a common base server can give us the following benefits:

  • Reduced learning curve for each server engineers interact with
  • Drive good sensible defaults
  • Provide security out of the box
  • Provide authentication & authorization out of the box
  • Metrics, logging, profiling all out of the box
  • Engineers can focus on building services, not servers
  • No reason to not write good client-to-server tests as unit tests when standing up a server is so easy

To fulfill the role outlined above, the following will be needed as well. These will be added incrementally as we need them.

  • Prometheus metrics server
  • gRPC Interceptors
  • HTTP Interceptors
  • Use k8s health handler
  • pprof

Related Issue(s)

Fixes #

How to test

  • go test ./...

Release Notes

NONE

Documentation

/uncc
/hold

"net/http"
)

type config struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should export this so that we can reuse this config in the installer and component config.

We'd want to pull in pprof and prometheus, too.


var healthyResponse = []byte(`healthy`)

func ReadyHandler() http.Handler {
Copy link
Contributor

Choose a reason for hiding this comment

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

registry-facade and others use a Kubernetes package for their readiness probes. We should re-use that and promote their use rather than rolling our own.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, makes sense. The idea here is that when you get a server, it already comes with sensible defaults. What does are is entirely up to us.

@roboquat roboquat added size/XXL and removed size/XL labels Apr 8, 2022
@stale
Copy link

stale bot commented Apr 18, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Apr 18, 2022
@easyCZ
Copy link
Member Author

easyCZ commented Apr 19, 2022

Landed incrementally as part of #9229, closing.

@easyCZ easyCZ closed this Apr 19, 2022
@easyCZ easyCZ deleted the mp/baseserver branch December 8, 2022 17:00
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