Documentation ¶
Index ¶
- Constants
- Variables
- func CacheResponseHandler(h http.Handler, informerCache cache.Cache, restMapper meta.RESTMapper, ...) http.Handler
- func InjectOwnerReferenceHandler(h http.Handler, cMap *ControllerMap, restMapper meta.RESTMapper) http.Handler
- func MakeRegexpArray(str string) ([]*regexp.Regexp, error)
- func MakeRegexpArrayOrDie(str string) []*regexp.Regexp
- func RequestLogHandler(h http.Handler) http.Handler
- func Run(done chan error, o Options) error
- type ControllerMap
- type FilterServer
- type HandlerChain
- type Options
Constants ¶
const ( // DefaultHostAcceptRE is the default value for which hosts to accept. DefaultHostAcceptRE = "^localhost$,^127\\.0\\.0\\.1$,^\\[::1\\]$" // DefaultPathAcceptRE is the default path to accept. DefaultPathAcceptRE = "^.*" // DefaultPathRejectRE is the default set of paths to reject. DefaultPathRejectRE = "^/api/.*/pods/.*/exec,^/api/.*/pods/.*/attach" // DefaultMethodRejectRE is the set of HTTP methods to reject by default. DefaultMethodRejectRE = "^$" )
Variables ¶
var ( // ReverseProxyFlushInterval is the frequency to flush the reverse proxy. // Only matters for long poll connections like the one used to watch. With an // interval of 0 the reverse proxy will buffer content sent on any connection // with transfer-encoding=chunked. // TODO: Flush after each chunk so the client doesn't suffer a 100ms latency per // watch event. ReverseProxyFlushInterval = 100 * time.Millisecond )
Functions ¶
func CacheResponseHandler ¶ added in v0.3.0
func CacheResponseHandler(h http.Handler, informerCache cache.Cache, restMapper meta.RESTMapper, watchedNamespaces map[string]interface{}) http.Handler
CacheResponseHandler will handle proxied requests and check if the requested resource exists in our cache. If it does then there is no need to bombard the APIserver with our request and we should write the response from the proxy.
func InjectOwnerReferenceHandler ¶
func InjectOwnerReferenceHandler(h http.Handler, cMap *ControllerMap, restMapper meta.RESTMapper) http.Handler
InjectOwnerReferenceHandler will handle proxied requests and inject the owner refernece found in the authorization header. The Authorization is then deleted so that the proxy can re-set with the correct authorization.
func MakeRegexpArray ¶
MakeRegexpArray splits a comma separated list of regexps into an array of Regexp objects.
func MakeRegexpArrayOrDie ¶
MakeRegexpArrayOrDie creates an array of regular expression objects from a string or exits.
Types ¶
type ControllerMap ¶ added in v0.4.0
ControllerMap - map of GVK to controller
func NewControllerMap ¶ added in v0.4.0
func NewControllerMap() *ControllerMap
NewControllerMap returns a new object that contains a mapping between GVK and controller
func (*ControllerMap) Delete ¶ added in v0.4.0
func (cm *ControllerMap) Delete(key schema.GroupVersionKind)
Delete - Deletes associated GVK to controller mapping from the ControllerMap
func (*ControllerMap) Get ¶ added in v0.4.0
func (cm *ControllerMap) Get(key schema.GroupVersionKind) (controller controller.Controller, watch, ok bool)
Get - Returns a controller given a GVK as the key. `watch` in the return specifies whether or not the operator will watch dependent resources for this controller. `ok` returns whether the query was successful. `controller` is the associated controller-runtime controller object.
func (*ControllerMap) Store ¶ added in v0.4.0
func (cm *ControllerMap) Store(key schema.GroupVersionKind, value controller.Controller, watch bool)
Store - Adds a new GVK to controller mapping. Also creates a mapping between GVK and a boolean `watch` that specifies whether this controller is watching dependent resources.
type FilterServer ¶
type FilterServer struct { // Only paths that match this regexp will be accepted AcceptPaths []*regexp.Regexp // Paths that match this regexp will be rejected, even if they match the above RejectPaths []*regexp.Regexp // Hosts are required to match this list of regexp AcceptHosts []*regexp.Regexp // Methods that match this regexp are rejected RejectMethods []*regexp.Regexp // contains filtered or unexported fields }
FilterServer rejects requests which don't match one of the specified regular expressions
func (*FilterServer) HandlerFor ¶
func (f *FilterServer) HandlerFor(delegate http.Handler) *FilterServer
HandlerFor makes a shallow copy of f which passes its requests along to the new delegate.
func (*FilterServer) ServeHTTP ¶
func (f *FilterServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type HandlerChain ¶
HandlerChain will be used for users to pass defined handlers to the proxy. The hander chain will be run after InjectingOwnerReference if it is added and before the proxy handler.
type Options ¶
type Options struct { Address string Port int Handler HandlerChain NoOwnerInjection bool LogRequests bool KubeConfig *rest.Config Cache cache.Cache RESTMapper meta.RESTMapper ControllerMap *ControllerMap WatchedNamespaces []string DisableCache bool }
Options will be used by the user to specify the desired details for the proxy.