handler

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package handler implements the http.HandlerFunc for mutating pod requests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(h http.Handler, middlewares ...Middleware) http.Handler

Apply wraps a list of middlewares around a handler and returns it

func ShutdownOnTerm

func ShutdownOnTerm(server *http.Server, timeout time.Duration)

ShutdownOnTerm will wait for SIGTERM or SIGINT and gracefully shuts down the http server or kill it after the specified timeout

Types

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware is a type for decorating requests.

func InstrumentRoute

func InstrumentRoute() Middleware

InstrumentRoute is a middleware for adding the following metrics for each route:

# Counter
http_request_count{"verb", "path", "code}
# Histogram
http_request_latencies{"verb", "path"}
# Summary
http_request_duration_microseconds{"verb", "path", "code}

func Logging

func Logging() Middleware

type Modifier

type Modifier struct {
	Expiration int64
	MountPath  string
	Cache      cache.ServiceAccountCache
	// contains filtered or unexported fields
}

Modifier holds configuration values for pod modifications

func NewModifier

func NewModifier(opts ...ModifierOpt) *Modifier

NewModifier returns a Modifier with default values

func (*Modifier) Handle

func (m *Modifier) Handle(w http.ResponseWriter, r *http.Request)

Handle handles pod modification requests

func (*Modifier) MutatePod

MutatePod takes a AdmissionReview, mutates the pod, and returns an AdmissionResponse

type ModifierOpt

type ModifierOpt func(*Modifier)

ModifierOpt is an option type for setting up a Modifier

func WithExpiration

func WithExpiration(exp int64) ModifierOpt

WithExpiration sets the modifier expiration

func WithMountPath

func WithMountPath(mountpath string) ModifierOpt

WithMountPath sets the modifier mountPath

func WithServiceAccountCache

func WithServiceAccountCache(c cache.ServiceAccountCache) ModifierOpt

WithServiceAccountCache sets the modifiers cache

Jump to

Keyboard shortcuts

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