handler

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 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 ShutdownFromContext added in v0.4.0

func ShutdownFromContext(ctx context.Context, server *http.Server, timeout time.Duration)

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 {
	AnnotationDomain           string
	MountPath                  string
	Region                     string
	Cache                      cache.ServiceAccountCache
	ContainerCredentialsConfig containercredentials.Config
	// 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 WithAnnotationDomain added in v0.3.0

func WithAnnotationDomain(domain string) ModifierOpt

WithAnnotationDomain adds an annotation domain

func WithContainerCredentialsConfig added in v0.5.0

func WithContainerCredentialsConfig(config containercredentials.Config) ModifierOpt

WithContainerCredentialsConfig sets the modifier ContainerCredentialsConfig

func WithMountPath

func WithMountPath(mountpath string) ModifierOpt

WithMountPath sets the modifier mountPath

func WithRegion added in v0.3.0

func WithRegion(region string) ModifierOpt

WithRegion sets the modifier region

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