controller

package
v0.0.0-...-d2d5cb9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindPort

func FindPort(pod *api_v1.Pod, svcPort *api_v1.ServicePort) (int32, error)

FindPort locates the container port for the given pod and portName. If the targetPort is a number, use that. If the targetPort is a string, look that string up in all named ports in all containers in the target pod. If no match is found, fail.

func NewListWatchFromClient

func NewListWatchFromClient(c cache.Getter, resource string, namespace string, labelsSelector labels.Selector) *cache.ListWatch

NewListWatchFromClient creates a new ListWatch from the specified client, resource, namespace and label selector.

Types

type Configurator

type Configurator interface {
	ConfigUpdated(cfgm *api_v1.ConfigMap) error
	IngressDeleted(ingKey string) error
	IngressUpdated(ingKey string) error
}

Configurator converts ingress objects into nginx config

func NewConfigurator

func NewConfigurator(
	ingressAccessor IngressAccessor,
	secretAccessor SecretAccessor,
	endpointsAccessor EndpointsAccessor,

	secretWatchlist Watchlist,

	recorder record.EventRecorder,
	mcs storage.MainConfigStorage,
	scs storage.ServerConfigStorage,
) Configurator

NewConfigurator creates a new Configurator instance

type EndpointsAccessor

type EndpointsAccessor interface {
	GetEndpointsForIngressBackend(backend *extensions.IngressBackend, namespace string) ([]string, error)
}

EndpointsAccessor contains methods to access k8s service endpoints

type IngressAccessor

type IngressAccessor interface {
	GetByKey(key string) (*extensions.Ingress, error)
}

IngressAccessor contains methods to access k8s ingress objects

type LoadBalancerController

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

LoadBalancerController watches Kubernetes API and reconfigures NGINX via Controller when needed

func NewLoadBalancerController

func NewLoadBalancerController(
	kubeClient kubernetes.Interface,
	resyncPeriod time.Duration,
	namespace string,
	selector labels.Selector,
	nginxConfigMaps string,
	mcs storage.MainConfigStorage,
	scs storage.ServerConfigStorage,
) (*LoadBalancerController, error)

NewLoadBalancerController creates a controller

func (*LoadBalancerController) Run

func (lbc *LoadBalancerController) Run()

Run starts the loadbalancer controller

func (*LoadBalancerController) Stop

func (lbc *LoadBalancerController) Stop()

Stop stops the loadbalancer controller

type SecretAccessor

type SecretAccessor interface {
	Get(namespace, name string) (*api_v1.Secret, error)
}

SecretAccessor contains methods to access k8s secrets

type StoreToConfigMapLister

type StoreToConfigMapLister struct {
	cache.Store
}

StoreToConfigMapLister makes a Store that lists ConfigMaps

func (*StoreToConfigMapLister) List

func (s *StoreToConfigMapLister) List() (cfgm api_v1.ConfigMapList, err error)

List lists all Ingress' in the store.

type StoreToEndpointLister

type StoreToEndpointLister struct {
	cache.Store
}

StoreToEndpointLister makes a Store that lists Endponts

func (*StoreToEndpointLister) GetServiceEndpoints

func (s *StoreToEndpointLister) GetServiceEndpoints(svc *api_v1.Service) (ep api_v1.Endpoints, err error)

GetServiceEndpoints returns the endpoints of a service, matched on service name.

type StoreToIngressLister

type StoreToIngressLister struct {
	cache.Store
}

StoreToIngressLister makes a Store that lists Ingress. TODO: Move this to cache/listers post 1.1.

func (*StoreToIngressLister) GetServiceIngress

func (s *StoreToIngressLister) GetServiceIngress(svc *api_v1.Service) (ings []extensions.Ingress, err error)

GetServiceIngress gets all the Ingress' that have rules pointing to a service. Note that this ignores services without the right nodePorts.

func (*StoreToIngressLister) List

func (s *StoreToIngressLister) List() (ing extensions.IngressList, err error)

List lists all Ingress' in the store.

type TaskQueue

type TaskQueue interface {
	Run(period time.Duration, stopCh <-chan struct{})
	// Enqueue enqueues ns/name of the given api object in the task queue.
	Enqueue(obj interface{})
	EnqueueKey(key string)
	Requeue(key string, err error)
	RequeueAfter(key string, err error, after time.Duration)
	// Shutdown shuts down the work queue and waits for the worker to ACK
	Shutdown()
}

TaskQueue manages a work queue through an independent worker that invokes the given sync function for every work item inserted.

func NewTaskQueue

func NewTaskQueue(syncFn func(string), log *log.Entry) TaskQueue

NewTaskQueue creates a new task queue with the given sync function. The sync function is called for every element inserted into the queue.

type Watchlist

type Watchlist interface {
	Add(key string, watcher string)
	Remove(watcher string)
	Watchers(key string) []string
}

The Watchlist coordinates watch requests of multiple watchers items are discarded when there are no more watchers

func NewWatchlist

func NewWatchlist() Watchlist

NewWatchlist creates a new watchlist

Jump to

Keyboard shortcuts

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