templaterouter

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2015 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolHTTP  = "http"
	ProtocolHTTPS = "https"
	ProtocolTLS   = "tls"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	ID         string
	Contents   string
	PrivateKey string
}

Certificate represents a pub/private key pair. It is identified by ID which is set to indicate if this is a client or ca certificate (see router.go). A CA certificate will not have a PrivateKey set.

type Endpoint

type Endpoint struct {
	ID   string
	IP   string
	Port string
}

Endpoint is an internal representation of a k8s endpoint.

type ServiceAliasConfig added in v0.2.2

type ServiceAliasConfig struct {
	// Host is a required host name ie. www.example.com
	Host string
	// Path is an optional path ie. www.example.com/myservice where "myservice" is the path
	Path string
	// TLSTermination is the termination policy for this backend and drives the mapping files and router configuration
	TLSTermination routeapi.TLSTerminationType
	// Certificates used for securing this backend.  Keyed by the cert id
	Certificates map[string]Certificate
}

ServiceAliasConfig is a route for a service. Uniquely identified by host + path.

type ServiceUnit added in v0.2.2

type ServiceUnit struct {
	// Name corresponds to a service name & namespace.  Uniquely identifies the ServiceUnit
	Name string
	// EndpointTable are endpoints that back the service, this translates into a final backend implementation for routers
	// keyed by IP:port for easy access
	EndpointTable map[string]Endpoint
	// ServiceAliasConfigs is a collection of unique routes that support this service, keyed by host + path
	ServiceAliasConfigs map[string]ServiceAliasConfig
}

ServiceUnit is an encapsulation of a service, the endpoints that back that service, and the routes that point to the service. This is the data that drives the creation of the router configuration files

func (ServiceUnit) TemplateSafeName added in v0.4.1

func (s ServiceUnit) TemplateSafeName() string

TemplateSafeName provides a name that can be used in the template that does not contain restricted characters like / which is used to concat namespace and name in the service unit key

type TemplatePlugin

type TemplatePlugin struct {
	Router router
}

TemplatePlugin implements the router.Plugin interface to provide a template based, backend-agnostic router.

func NewTemplatePlugin

func NewTemplatePlugin(templatePath, reloadScriptPath string) (*TemplatePlugin, error)

NewTemplatePlugin creates a new TemplatePlugin.

func (*TemplatePlugin) HandleEndpoints

func (p *TemplatePlugin) HandleEndpoints(eventType watch.EventType, endpoints *kapi.Endpoints) error

HandleEndpoints processes watch events on the Endpoints resource.

func (*TemplatePlugin) HandleRoute

func (p *TemplatePlugin) HandleRoute(eventType watch.EventType, route *routeapi.Route) error

HandleRoute processes watch events on the Route resource.

Jump to

Keyboard shortcuts

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