serverless

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(service string, cluster Cluster) serving.Serving

New returns a new serving instance

func NewDirectorFunc

func NewDirectorFunc(service string) func(*http.Request)

NewDirectorFunc returns a director function capable of configuring a proxy request

func NewErrorHandler

func NewErrorHandler() func(http.ResponseWriter, *http.Request, error)

NewErrorHandler returns a func(http.ResponseWriter, *http.Request, error) responsible for handling proxy errors

func NewFromAPISource added in v1.17.0

func NewFromAPISource(config api.Serverless) (serving.Serving, error)

NewFromAPISource returns a serverless serving instance built from GitLab API response

Types

type Certs

type Certs struct {
	RootCerts   *x509.CertPool
	Certificate tls.Certificate
}

Certs holds definition of certificates we use to perform mTLS handshake with a cluster

func NewClusterCerts

func NewClusterCerts(clientCert, clientKey string) (*Certs, error)

NewClusterCerts creates a new cluster configuration from cert / key pair

type Cluster

type Cluster struct {
	Address string // Address is a real IP address of a cluster ingress
	Port    string // Port is a real port of HTTP TLS service
	Name    string // Name is a cluster name, used in cluster certificates
	Certs   *Certs
}

Cluster represent a Knative cluster that we want to proxy requests to

func (Cluster) Host

func (c Cluster) Host() string

Host returns a real cluster location based on IP address and port

func (Cluster) TLSConfig

func (c Cluster) TLSConfig() *tls.Config

TLSConfig builds a new tls.Config and returns a pointer to it

type Serverless

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

Serverless is a servering used to proxy requests between a client and Knative cluster.

func (*Serverless) ServeFileHTTP

func (s *Serverless) ServeFileHTTP(h serving.Handler) bool

ServeFileHTTP handle an incoming request and proxies it to Knative cluster

func (*Serverless) ServeNotFoundHTTP

func (s *Serverless) ServeNotFoundHTTP(h serving.Handler)

ServeNotFoundHTTP responds with 404

type Transport

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

Transport is a struct that handle the proxy connection round trip to Knative cluster

func NewTransport

func NewTransport(cluster Cluster) *Transport

NewTransport fabricates as new transport type

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip performs a connection to a Knative cluster and returns a response

Jump to

Keyboard shortcuts

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