config

package
v1.11.5 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package config provides decoupling between various configuration sources (etcd, files,...) and the pieces that actually care about them (loadbalancer, proxy). Config takes 1 or more configuration sources and allows for incremental (add/remove) and full replace (set) changes from each of the sources, then creates a union of the configuration and provides a unified view for both service handlers as well as endpoint handlers. There is no attempt to resolve conflicts of any sort. Basic idea is that each configuration source gets a channel from the Config service and pushes updates to it via that channel. Config then keeps track of incremental & replace changes and distributes them to listeners as appropriate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointsConfig

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

EndpointsConfig tracks a set of endpoints configurations. It accepts "set", "add" and "remove" operations of endpoints via channels, and invokes registered handlers on change.

func NewEndpointsConfig

func NewEndpointsConfig(endpointsInformer coreinformers.EndpointsInformer, resyncPeriod time.Duration) *EndpointsConfig

NewEndpointsConfig creates a new EndpointsConfig.

func (*EndpointsConfig) RegisterEventHandler added in v1.7.0

func (c *EndpointsConfig) RegisterEventHandler(handler EndpointsHandler)

RegisterEventHandler registers a handler which is called on every endpoints change.

func (*EndpointsConfig) Run added in v1.7.0

func (c *EndpointsConfig) Run(stopCh <-chan struct{})

Run starts the goroutine responsible for calling registered handlers.

type EndpointsHandler added in v1.7.0

type EndpointsHandler interface {
	// OnEndpointsAdd is called whenever creation of new endpoints object
	// is observed.
	OnEndpointsAdd(endpoints *api.Endpoints)
	// OnEndpointsUpdate is called whenever modification of an existing
	// endpoints object is observed.
	OnEndpointsUpdate(oldEndpoints, endpoints *api.Endpoints)
	// OnEndpointsDelete is called whever deletion of an existing endpoints
	// object is observed.
	OnEndpointsDelete(endpoints *api.Endpoints)
	// OnEndpointsSynced is called once all the initial event handlers were
	// called and the state is fully propagated to local cache.
	OnEndpointsSynced()
}

EndpointsHandler is an abstract interface of objects which receive notifications about endpoints object changes.

type ServiceConfig

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

ServiceConfig tracks a set of service configurations. It accepts "set", "add" and "remove" operations of services via channels, and invokes registered handlers on change.

func NewServiceConfig

func NewServiceConfig(serviceInformer coreinformers.ServiceInformer, resyncPeriod time.Duration) *ServiceConfig

NewServiceConfig creates a new ServiceConfig.

func (*ServiceConfig) RegisterEventHandler added in v1.7.0

func (c *ServiceConfig) RegisterEventHandler(handler ServiceHandler)

RegisterEventHandler registers a handler which is called on every service change.

func (*ServiceConfig) Run added in v1.7.0

func (c *ServiceConfig) Run(stopCh <-chan struct{})

Run starts the goroutine responsible for calling registered handlers.

type ServiceHandler added in v1.7.0

type ServiceHandler interface {
	// OnServiceAdd is called whenever creation of new service object
	// is observed.
	OnServiceAdd(service *api.Service)
	// OnServiceUpdate is called whenever modification of an existing
	// service object is observed.
	OnServiceUpdate(oldService, service *api.Service)
	// OnServiceDelete is called whenever deletion of an existing service
	// object is observed.
	OnServiceDelete(service *api.Service)
	// OnServiceSynced is called once all the initial even handlers were
	// called and the state is fully propagated to local cache.
	OnServiceSynced()
}

ServiceHandler is an abstract interface of objects which receive notifications about service object changes.

Jump to

Keyboard shortcuts

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