ingress

package
v0.0.0-...-7669b99 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultSSLDirectory defines the location where the SSL certificates will be generated
	// This directory contains all the SSL certificates that are specified in Ingress rules.
	// The name of each file is <namespace>-<secret name>.pem. The content is the concatenated
	// certificate and key.
	DefaultSSLDirectory = "/ingress-controller/ssl"
)

Functions

This section is empty.

Types

type Backend

type Backend struct {
	// Name represents an unique api.Service name formatted as <namespace>-<name>-<port>
	Name string `json:"name"`
	// This indicates if the communication protocol between the backend and the endpoint is HTTP or HTTPS
	// Allowing the use of HTTPS
	// The endpoint/s must provide a TLS connection.
	// The certificate used in the endpoint cannot be a self signed certificate
	// TODO: add annotation to allow the load of ca certificate
	Secure bool `json:"secure"`
	// SSLPassthrough indicates that Ingress controller will delegate TLS termination to the endpoints.
	SSLPassthrough bool `json:"sslPassthrough"`
	// Endpoints contains the list of endpoints currently running
	Endpoints []Endpoint `json:"endpoints"`

	SessionAffinity SessionAffinityConfig
}

Backend describes one or more remote server/s (endpoints) associated with a service

type BackendByNameServers

type BackendByNameServers []*Backend

BackendByNameServers sorts upstreams by name

func (BackendByNameServers) Len

func (c BackendByNameServers) Len() int

func (BackendByNameServers) Less

func (c BackendByNameServers) Less(i, j int) bool

func (BackendByNameServers) Swap

func (c BackendByNameServers) Swap(i, j int)

type BackendInfo

type BackendInfo struct {
	// Name returns the name of the backend implementation
	Name string `json:"name"`
	// Release returns the running version (semver)
	Release string `json:"release"`
	// Build returns information about the git commit
	Build string `json:"build"`
	// Repository return information about the git repository
	Repository string `json:"repository"`
}

BackendInfo returns information about the backend. This fields contains information that helps to track issues or to map the running ingress controller to source code

type Configuration

type Configuration struct {
	// Backends are a list of backends used by all the Ingress rules in the
	// ingress controller. This list includes the default backend
	Backends []*Backend `json:"namespace"`
	// Servers
	Servers []*Server `json:"servers"`
	// TCPEndpoints contain endpoints for tcp streams handled by this backend
	// +optional
	TCPEndpoints []L4Service `json:"tcpEndpoints,omitempty"`
	// UDPEndpoints contain endpoints for udp streams handled by this backend
	// +optional
	UDPEndpoints []L4Service `json:"udpEndpoints,omitempty"`
	// PassthroughBackend contains the backends used for SSL passthrough.
	// It contains information about the associated Server Name Indication (SNI).
	// +optional
	PassthroughBackends []*SSLPassthroughBackend `json:"passthroughBackends,omitempty"`
}

Configuration holds the definition of all the parts required to describe all ingresses reachable by the ingress controller (using a filter by namespace)

type Controller

type Controller interface {
	// HealthzChecker returns is a named healthz check that returns the ingress
	// controller status
	healthz.HealthzChecker

	// Reload takes a byte array representing the new loadbalancer configuration,
	// and returns a byte array containing any output/errors from the backend and
	// if a reload was required.
	// Before returning the backend must load the configuration in the given array
	// into the loadbalancer and restart it, or fail with an error and message string.
	// If reloading fails, there should be not change in the running configuration or
	// the given byte array.
	Reload(data []byte) ([]byte, bool, error)
	// OnUpdate callback invoked from the sync queue https://k8s.io/ingress/core/blob/master/pkg/ingress/controller/controller.go#L387
	// when an update occurs. This is executed frequently because Ingress
	// controllers watches changes in:
	// - Ingresses: main work
	// - Secrets: referenced from Ingress rules with TLS configured
	// - ConfigMaps: where the controller reads custom configuration
	// - Services: referenced from Ingress rules and required to obtain
	//	 information about ports and annotations
	// - Endpoints: referenced from Services and what the backend uses
	//	 to route traffic
	// Any update to services, endpoints, secrets (only those referenced from Ingress)
	// and ingress trigger the execution.
	// Notifications of type Add, Update and Delete:
	// https://github.com/kubernetes/kubernetes/blob/master/pkg/client/cache/controller.go#L164
	//
	// Configuration returns the translation from Ingress rules containing
	// information about all the upstreams (service endpoints ) "virtual"
	// servers (FQDN) and all the locations inside each server. Each
	// location contains information about all the annotations were configured
	// https://k8s.io/ingress/core/blob/master/pkg/ingress/types.go#L83
	// The backend returns the contents of the configuration file or an error
	// with the reason why was not possible to generate the file.
	//
	// The returned configuration is then passed to test, and then to reload
	// if there is no errors.
	OnUpdate(Configuration) ([]byte, error)
	// ConfigMap content of --configmap
	SetConfig(*api.ConfigMap)
	// SetListers allows the access of store listers present in the generic controller
	// This avoid the use of the kubernetes client.
	SetListers(StoreLister)
	// BackendDefaults returns the minimum settings required to configure the
	// communication to endpoints
	BackendDefaults() defaults.Backend
	// Info returns information about the ingress controller
	Info() *BackendInfo
	// OverrideFlags allow the customization of the flags in the backend
	OverrideFlags(*pflag.FlagSet)
	// DefaultIngressClass just return the default ingress class
	DefaultIngressClass() string
}

Controller holds the methods to handle an Ingress backend TODO (#18): Make sure this is sufficiently supportive of other backends.

type CookieSessionAffinity

type CookieSessionAffinity struct {
	Name string `json:"name"`
	Hash string `json:"hash"`
}

CookieSessionAffinity defines the structure used in Affinity configured by Cookies.

type Endpoint

type Endpoint struct {
	// Address IP address of the endpoint
	Address string `json:"address"`
	// Port number of the TCP port
	Port string `json:"port"`
	// MaxFails returns the number of unsuccessful attempts to communicate
	// allowed before this should be considered dow.
	// Setting 0 indicates that the check is performed by a Kubernetes probe
	MaxFails int `json:"maxFails"`
	// FailTimeout returns the time in seconds during which the specified number
	// of unsuccessful attempts to communicate with the server should happen
	// to consider the endpoint unavailable
	FailTimeout int `json:"failTimeout"`
}

Endpoint describes a kubernetes endpoint in a backend

type EndpointByAddrPort

type EndpointByAddrPort []Endpoint

EndpointByAddrPort sorts endpoints by address and port

func (EndpointByAddrPort) Len

func (c EndpointByAddrPort) Len() int

func (EndpointByAddrPort) Less

func (c EndpointByAddrPort) Less(i, j int) bool

func (EndpointByAddrPort) Swap

func (c EndpointByAddrPort) Swap(i, j int)

type L4Backend

type L4Backend struct {
	Port      intstr.IntOrString `json:"port"`
	Name      string             `json:"name"`
	Namespace string             `json:"namespace"`
	Protocol  api.Protocol       `json:"protocol"`
}

L4Backend describes the kubernetes service behind L4 Ingress service

type L4Service

type L4Service struct {
	// Port external port to expose
	Port int `json:"port"`
	// Backend of the service
	Backend L4Backend `json:"backend"`
	// Endpoints active endpoints of the service
	Endpoints []Endpoint `json:"endpoins"`
}

L4Service describes a L4 Ingress service.

type Location

type Location struct {
	// Path is an extended POSIX regex as defined by IEEE Std 1003.1,
	// (i.e this follows the egrep/unix syntax, not the perl syntax)
	// matched against the path of an incoming request. Currently it can
	// contain characters disallowed from the conventional "path"
	// part of a URL as defined by RFC 3986. Paths must begin with
	// a '/'. If unspecified, the path defaults to a catch all sending
	// traffic to the backend.
	Path string `json:"path"`
	// IsDefBackend indicates if service specified in the Ingress
	// contains active endpoints or not. Returning true means the location
	// uses the default backend.
	IsDefBackend bool `json:"isDefBackend"`
	// Backend describes the name of the backend to use.
	Backend string `json:"backend"`
	// BasicDigestAuth returns authentication configuration for
	// an Ingress rule.
	// +optional
	BasicDigestAuth auth.BasicDigest `json:"basicDigestAuth,omitempty"`
	// Denied returns an error when this location cannot not be allowed
	// Requesting a denied location should return HTTP code 403.
	Denied error
	// EnableCORS indicates if path must support CORS
	// +optional
	EnableCORS bool `json:"enableCors,omitempty"`
	// ExternalAuth indicates the access to this location requires
	// authentication using an external provider
	// +optional
	ExternalAuth authreq.External `json:"externalAuth,omitempty"`
	// RateLimit describes a limit in the number of connections per IP
	// address or connections per second.
	// The Redirect annotation precedes RateLimit
	// +optional
	RateLimit ratelimit.RateLimit `json:"rateLimit,omitempty"`
	// Redirect describes the redirection this location.
	// +optional
	Redirect rewrite.Redirect `json:"redirect,omitempty"`
	// Whitelist indicates only connections from certain client
	// addresses or networks are allowed.
	// +optional
	Whitelist ipwhitelist.SourceRange `json:"whitelist,omitempty"`
	// Proxy contains information about timeouts and buffer sizes
	// to be used in connections against endpoints
	// +optional
	Proxy proxy.Configuration `json:"proxy,omitempty"`
	// CertificateAuth indicates the access to this location requires
	// external authentication
	// +optional
	CertificateAuth authtls.AuthSSLConfig `json:"certificateAuth,omitempty"`
	// UsePortInRedirects indicates if redirects must specify the port
	// +optional
	UsePortInRedirects bool `json:"use-port-in-redirects"`
	// ConfigurationSnippet contains additional configuration for the backend
	// to be considered in the configuration of the location
	ConfigurationSnippet string `json:"configuration-snippet"`
}

Location describes an URI inside a server. Also contains additional information about annotations in the Ingress.

Important: The implementation of annotations is optional

In some cases when more than one annotations is defined a particular order in the execution is required. The chain in the execution order of annotations should be: - CertificateAuth - Whitelist - RateLimit - BasicDigestAuth - ExternalAuth - Redirect

type LocationByPath

type LocationByPath []*Location

LocationByPath sorts location by path in descending order Location / is the last one

func (LocationByPath) Len

func (c LocationByPath) Len() int

func (LocationByPath) Less

func (c LocationByPath) Less(i, j int) bool

func (LocationByPath) Swap

func (c LocationByPath) Swap(i, j int)

type SSLCert

type SSLCert struct {
	meta_v1.ObjectMeta `json:"metadata,omitempty"`
	// CAFileName contains the path to the file with the root certificate
	CAFileName string `json:"caFileName"`
	// PemFileName contains the path to the file with the certificate and key concatenated
	PemFileName string `json:"pemFileName"`
	// PemSHA contains the sha1 of the pem file.
	// This is used to detect changes in the secret that contains the certificates
	PemSHA string `json:"pemSha"`
	// CN contains all the common names defined in the SSL certificate
	CN []string `json:"cn"`
}

SSLCert describes a SSL certificate to be used in a server

func (SSLCert) GetObjectKind

func (s SSLCert) GetObjectKind() schema.ObjectKind

GetObjectKind implements the ObjectKind interface as a noop

type SSLPassthroughBackend

type SSLPassthroughBackend struct {
	// Backend describes the endpoints to use.
	Backend string `json:"namespace,omitempty"`
	// Hostname returns the FQDN of the server
	Hostname string `json:"hostname"`
}

SSLPassthroughBackend describes a SSL upstream server configured as passthrough (no TLS termination in the ingress controller) The endpoints must provide the TLS termination exposing the required SSL certificate. The ingress controller only pipes the underlying TCP connection

type Server

type Server struct {
	// Hostname returns the FQDN of the server
	Hostname string `json:"hostname"`
	// SSLPassthrough indicates if the TLS termination is realized in
	// the server or in the remote endpoint
	SSLPassthrough bool `json:"sslPassthrough"`
	// SSLCertificate path to the SSL certificate on disk
	SSLCertificate string `json:"sslCertificate"`
	// SSLPemChecksum returns the checksum of the certificate file on disk.
	// There is no restriction in the hash generator. This checksim can be
	// used to  determine if the secret changed without the use of file
	// system notifications
	SSLPemChecksum string `json:"sslPemChecksum"`
	// Locations list of URIs configured in the server.
	Locations []*Location `json:"locations,omitempty"`
}

Server describes a website

type ServerByName

type ServerByName []*Server

ServerByName sorts servers by name

func (ServerByName) Len

func (c ServerByName) Len() int

func (ServerByName) Less

func (c ServerByName) Less(i, j int) bool

func (ServerByName) Swap

func (c ServerByName) Swap(i, j int)

type SessionAffinityConfig

type SessionAffinityConfig struct {
	AffinityType          string `json:"name"`
	CookieSessionAffinity CookieSessionAffinity
}

SessionAffinityConfig describes different affinity configurations for new sessions. Once a session is mapped to a backend based on some affinity setting, it retains that mapping till the backend goes down, or the ingress controller restarts. Exactly one of these values will be set on the upstream, since multiple affinity values are incompatible. Once set, the backend makes no guarantees about honoring updates.

type StoreLister

type StoreLister struct {
	Ingress   store.IngressLister
	Service   store.ServiceLister
	Node      store.NodeLister
	Endpoint  store.EndpointLister
	Secret    store.SecretLister
	ConfigMap store.ConfigMapLister
}

StoreLister returns the configured stores for ingresses, services, endpoints, secrets and configmaps.

Directories

Path Synopsis
annotations
leaderelection
Package leaderelection implements leader election of a set of endpoints.
Package leaderelection implements leader election of a set of endpoints.

Jump to

Keyboard shortcuts

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