serverless

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(function Function, cluster Cluster) serving.Serving

New returns a new serving instance

func NewDirectorFunc

func NewDirectorFunc(function Function) 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

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 Function

type Function struct {
	Name       string // Name is a function name, it includes a "service name" component too
	Namespace  string // Namespace is a kubernetes namespace this function has been deployed to
	BaseDomain string // BaseDomain is a cluster base domain, used to route requests to apropriate service
}

Function represents a Knative service that is going to be invoked by the proxied request

func (Function) Host

func (f Function) Host() string

Host returns a function address that we are going to expose in the `Host:` header to make it possible to route a proxied request to appropriate service in a Knative cluster

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