controller

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2018 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package controller implements a generic controller for monitoring ingress resources in Kubernetes. It delegates update logic to an Updater interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	KubernetesClient             k8s.Client
	Updaters                     []Updater
	DefaultAllow                 string
	DefaultStripPath             bool
	DefaultBackendTimeoutSeconds int
	DefaultBackendMaxConnections int
}

Config for creating a new ingress controller.

type Controller

type Controller interface {
	// Run the controller, returning immediately after it starts or an error occurs.
	Start() error
	// Stop the controller, blocking until it stops or an error occurs.
	Stop() error
	// Healthy returns true for a healthy controller, false for unhealthy.
	Health() error
}

Controller operates on ingress resources, listening for updates and notifying its Updaters.

func New

func New(conf Config) Controller

New creates an ingress controller.

type IngressEntries added in v1.1.1

type IngressEntries []IngressEntry

IngressEntries type

type IngressEntry

type IngressEntry struct {
	// Namespace of the ingress.
	Namespace string
	// Name of the ingress.
	Name string
	// Host is the fully qualified domain name used for external access.
	Host string
	// Path is the url path after the hostname. Must be non-empty.
	Path string
	// ServiceAddress is a routable address for the Kubernetes backend service to proxy traffic to.
	// Must be non-empty.
	ServiceAddress string
	// ServicePort is the port to proxy traffic to. Must be non-zero.
	ServicePort int32
	// Allow are the ips or cidrs that are allowed to access the service.
	Allow []string
	// LbScheme internet-facing or internal will dictate which kind of load balancer to attach to.
	LbScheme string
	// StripPaths before forwarding to the backend
	StripPaths bool
	// BackendTimeoutSeconds backend timeout
	BackendTimeoutSeconds int
	// BackendMaxConnections maximum backend connections
	BackendMaxConnections int
	// Ingress creation time
	CreationTimestamp time.Time
	// Ingress resource
	Ingress *v1beta1.Ingress
}

IngressEntry describes the ingress for a single host, path, and service.

func (IngressEntry) NamespaceName

func (e IngressEntry) NamespaceName() string

NamespaceName returns the string "Namespace/Name".

type Updater

type Updater interface {
	// Start the ingress updater, returning immediately after it's started.
	Start() error
	// Stop the ingress updater. Blocks until the ingress updater stops or an error occurs.
	Stop() error
	// Update the ingress updater configuration.
	// Not thread safe, should only be called by a single go routine
	Update(IngressEntries) error
	// Health returns nil if healthy, otherwise an error. Should be fast to respond, as it
	// may be called often. Any long running checks should be done separately.
	Health() error
}

Updater that the Controller delegates to.

Jump to

Keyboard shortcuts

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