apiserver

package
v1.1.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const GracefulShutdownTimeout = 5 * time.Second

GracefulShutdownTimeout is the duration to wait for graceful shutdown

Variables

This section is empty.

Functions

func ConfigureRateLimiter

func ConfigureRateLimiter(r chi.Router, cfg RateLimitConfig)

ConfigureRateLimiter adds rate limiting to a router with the given config

func ConfigureRateLimiterFromConfig

func ConfigureRateLimiterFromConfig(
	r chi.Router,
	cfg *config.RateLimitConfig,
	scope RateLimitScope,
	options ...RateLimitOption,
)

ConfigureRateLimiterFromConfig applies rate limiting based on service config. If trustedProxies is unset, it falls back to cfg.TrustedProxies.

func HealthzHandler added in v0.10.0

func HealthzHandler() http.Handler

HealthzHandler returns a simple HTTP handler that always returns OK. This is for liveness probes that just need to know if the process is running. The response body is empty.

func OapiErrorHandler

func OapiErrorHandler(w http.ResponseWriter, message string, statusCode int)

OapiErrorHandler is a shared error handler for OpenAPI validation errors

func ReadyzHandler added in v0.10.0

func ReadyzHandler(timeout time.Duration, checks ...HealthChecker) http.Handler

ReadyzHandler returns a simple HTTP handler that runs health checks. It iterates through provided checks and returns 503 on any failure. The response body is empty.

Types

type HealthChecker added in v0.10.0

type HealthChecker interface {
	CheckHealth(ctx context.Context) error
}

HealthChecker is a minimal contract for readiness checks.

type RateLimitConfig

type RateLimitConfig struct {
	Requests       int
	Window         time.Duration
	TrustedProxies []string
	Message        string
}

RateLimitConfig holds rate limiting parameters

type RateLimitDefaults

type RateLimitDefaults struct {
	Requests int
	Window   time.Duration
}

type RateLimitOption

type RateLimitOption func(*rateLimitOptions)

func WithMessage

func WithMessage(message string) RateLimitOption

func WithNoTrustedProxies

func WithNoTrustedProxies() RateLimitOption

func WithRate

func WithRate(defaults RateLimitDefaults) RateLimitOption

func WithTrustedProxies

func WithTrustedProxies(trustedProxies []string) RateLimitOption

type RateLimitScope

type RateLimitScope int
const (
	RateLimitScopeGeneral RateLimitScope = iota
	RateLimitScopeAuth
)

type RateLimitScopeDefaults

type RateLimitScopeDefaults struct {
	Defaults RateLimitDefaults
	Message  string
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(
	log logrus.FieldLogger,
	cfg *config.Config,
	st store.Store,
	ca *crypto.CAClient,
	listener net.Listener,
	queuesProvider queues.Provider,
	consoleEndpointReg console.InternalSessionRegistration,
) *Server

New returns a new instance of a flightctl server.

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL