webhook

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdmissionResponder

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

AdmissionResponder is a helper for handling admission response creation It supports adding and returning multiple errors to the user

func (*AdmissionResponder) Flush

Flush creates the admission response to return

func (*AdmissionResponder) HasErrors

func (a *AdmissionResponder) HasErrors() bool

HasErrors returns a true if there are errors false if not

func (*AdmissionResponder) IsAllowed

func (a *AdmissionResponder) IsAllowed() bool

IsAllowed returns a true if the admission is allowed false if not

func (*AdmissionResponder) MapStringsToAdmissionResponse

func (a *AdmissionResponder) MapStringsToAdmissionResponse(mapofmsgs map[string][]string)

MapStringsToAdmissionResponse adds a map of a slice of strings as errors to the reponse

func (*AdmissionResponder) SetAllowed

func (a *AdmissionResponder) SetAllowed()

SetAllowed sets the admission response to allow the admission

func (*AdmissionResponder) SetPatch

func (a *AdmissionResponder) SetPatch(patch []byte)

SetPatch sets the patches to be applied by the api server

func (*AdmissionResponder) StringToAdmissionResponse

func (a *AdmissionResponder) StringToAdmissionResponse(msg string)

StringToAdmissionResponse adds a string as an error to the response

func (*AdmissionResponder) StringsToAdmissionResponse

func (a *AdmissionResponder) StringsToAdmissionResponse(msgs []string)

StringsToAdmissionResponse adds a slice of strings as errors to the response

func (*AdmissionResponder) ToAdmissionResponse

func (a *AdmissionResponder) ToAdmissionResponse(err error)

ToAdmissionResponse adds an error to the response

func (*AdmissionResponder) Write

Write writes the output of flush to the passed responsewriter

type Server

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

Server is the admission webhook server

func NewServer

func NewServer(name string, ctrl controller.Interface, cert, key []byte) *Server

NewServer creates a new admission webhook server with the passed controller handling the admissions

func (*Server) HandleAdmissionRequest

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

HandleAdmissionRequest handles an incoming request and calls the controllers admit function It writes the response from the Admit to the response writer

func (*Server) HandleLiveness

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

HandleLiveness responds to a Kubernetes Liveness probe Fail this request if Kubernetes should restart this instance

func (*Server) HandleReadiness

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

HandleReadiness responds to a Kubernetes Readiness probe Fail this request if this instance can't accept traffic, but Kubernetes shouldn't restart it

func (*Server) Run

func (s *Server) Run()

Run starts the server

Jump to

Keyboard shortcuts

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