Skip to content

[feature] Provide a Run(srv, admitters) Method #4

@elithrar

Description

@elithrar

We should consider exposing a Run method that supports minimal viable configuration and starts a server.

This will make getting started much easier, and avoid having to set up every dependency (logging, HTTP server, routing, middleware) if a user doesn’t have strict opinions on these things. See cmd/admissiond for an example.

Proposed API:

  • Expose an AdmissionServer type, with a NewAdmissionServer constructor that accepts a *http.Server, a log.Logger (maybe?), and a map[string]AdmitFunc that maps URL paths to the provided handlers.
  • Extra (optional) config can be exposed as struct fields; otherwise we use opinionated defaults
  • Create a Run(ctx) error method that starts the HTTP server.

Users with custom requirements can continue to build their own servers around the http.Handler compatible AdmissionHandler type.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions