webhook

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PodExecAdmissionRequestKind   = "PodExecOptions"
	PodAttachAdmissionRequestKind = "PodAttachOptions"

	ImmutableLabelsDisallowMsg = "The following Pod labels cannot be updated or removed once set:"
	InvalidAnnotationsValueMsg = "The given annotation has an invalid value set in the Pod object:"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ResponseWriterWrapper

type ResponseWriterWrapper struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseWriterWrapper is a minimal wrapper for http.ResponseWriter that allows the written HTTP status code to be captured for logging.

func (*ResponseWriterWrapper) WriteHeader

func (rw *ResponseWriterWrapper) WriteHeader(code int)

WriteHeader updates the wrapper's status code if header is not written.

type Server

type Server struct {
	AllowedNamespaces map[string]bool
	// contains filtered or unexported fields
}

Server handles admission requests received from K8s API-Server.

func NewServer

func NewServer(port int, certPath, keyPath, namespaceAllowlistRaw string) (*Server, error)

NewServer sets up required configuration and returns a new Server object.

func (*Server) AdmitPodInteraction

func (s *Server) AdmitPodInteraction(w http.ResponseWriter, r *http.Request)

AdmitPodInteraction handles an incoming request of interacting a Pod (by kubectl "exec" or "attach" command).

func (*Server) AdmitPodUpdate

func (s *Server) AdmitPodUpdate(w http.ResponseWriter, r *http.Request)

AdmitPodUpdate handles an incoming request of changing a Pod object.

func (*Server) Run

func (s *Server) Run() error

Run will starts the webhook server listening to the specified paths.

Jump to

Keyboard shortcuts

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