controller

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2017 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultClusterUID is the uid to use for clusters resources created by an
	// L7 controller created without specifying the --cluster-uid flag.
	DefaultClusterUID = ""

	// DefaultFirewallName is the name to user for firewall rules created
	// by an L7 controller when the --fireall-rule is not used.
	DefaultFirewallName = ""
)

Functions

func ListAll

func ListAll(store cache.Store, selector labels.Selector, appendFn cache.AppendFunc) error

ListAll iterates a store and passes selected item to a func

func NewFakeClusterManager

func NewFakeClusterManager(clusterName, firewallName string) *fakeClusterManager

NewFakeClusterManager creates a new fake ClusterManager.

func NewTaskQueue

func NewTaskQueue(syncFn func(string) error) *taskQueue

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

Types

type ClusterManager

type ClusterManager struct {
	ClusterNamer *utils.Namer
	// contains filtered or unexported fields
}

ClusterManager manages cluster resource pools.

func NewClusterManager

func NewClusterManager(
	cloud *gce.GCECloud,
	namer *utils.Namer,
	defaultBackendNodePort backends.ServicePort,
	defaultHealthCheckPath string) (*ClusterManager, error)

NewClusterManager creates a cluster manager for shared resources.

  • namer: is the namer used to tag cluster wide shared resources.
  • defaultBackendNodePort: is the node port of glbc's default backend. This is the kubernetes Service that serves the 404 page if no urls match.
  • defaultHealthCheckPath: is the default path used for L7 health checks, eg: "/healthz".

func (*ClusterManager) Checkpoint

func (c *ClusterManager) Checkpoint(lbs []*loadbalancers.L7RuntimeInfo, nodeNames []string, backendServicePorts []backends.ServicePort, namedPorts []backends.ServicePort) ([]*compute.InstanceGroup, error)

Checkpoint performs a checkpoint with the cloud.

  • lbs are the single cluster L7 loadbalancers we wish to exist. If they already exist, they should not have any broken links between say, a UrlMap and TargetHttpProxy.
  • nodeNames are the names of nodes we wish to add to all loadbalancer instance groups.
  • backendServicePorts are the ports for which we require BackendServices.
  • namedPorts are the ports which must be opened on instance groups.

Returns the list of all instance groups corresponding to the given loadbalancers. If in performing the checkpoint the cluster manager runs out of quota, a googleapi 403 is returned.

func (*ClusterManager) EnsureInstanceGroupsAndPorts

func (c *ClusterManager) EnsureInstanceGroupsAndPorts(servicePorts []backends.ServicePort) ([]*compute.InstanceGroup, error)

func (*ClusterManager) GC

func (c *ClusterManager) GC(lbNames []string, nodePorts []backends.ServicePort) error

GC garbage collects unused resources.

  • lbNames are the names of L7 loadbalancers we wish to exist. Those not in this list are removed from the cloud.
  • nodePorts are the ports for which we want BackendServies. BackendServices for ports not in this list are deleted.

This method ignores googleapi 404 errors (StatusNotFound).

func (*ClusterManager) Init

func (c *ClusterManager) Init(tr *GCETranslator)

Init initializes the cluster manager.

func (*ClusterManager) IsHealthy

func (c *ClusterManager) IsHealthy() (err error)

IsHealthy returns an error if the cluster manager is unhealthy.

type ControllerContext

type ControllerContext struct {
	IngressInformer cache.SharedIndexInformer
	ServiceInformer cache.SharedIndexInformer
	PodInformer     cache.SharedIndexInformer
	NodeInformer    cache.SharedIndexInformer
	// Stop is the stop channel shared among controllers
	StopCh chan struct{}
}

ControllerContext holds

func NewControllerContext

func NewControllerContext(kubeClient kubernetes.Interface, namespace string, resyncPeriod time.Duration) *ControllerContext

func (*ControllerContext) Start

func (ctx *ControllerContext) Start()

type GCETranslator

type GCETranslator struct {
	*LoadBalancerController
}

GCETranslator helps with kubernetes -> gce api conversion.

func (*GCETranslator) GetProbe

func (t *GCETranslator) GetProbe(port backends.ServicePort) (*api_v1.Probe, error)

GetProbe returns a probe that's used for the given nodeport

func (*GCETranslator) GetZoneForNode

func (t *GCETranslator) GetZoneForNode(name string) (string, error)

GetZoneForNode returns the zone for a given node by looking up its zone label.

func (*GCETranslator) ListZones

func (t *GCETranslator) ListZones() ([]string, error)

ListZones returns a list of zones this Kubernetes cluster spans.

type LoadBalancerController

type LoadBalancerController struct {

	// TODO: Watch secrets
	CloudClusterManager *ClusterManager
	// contains filtered or unexported fields
}

LoadBalancerController watches the kubernetes api and adds/removes services from the loadbalancer, via loadBalancerConfig.

func NewLoadBalancerController

func NewLoadBalancerController(kubeClient kubernetes.Interface, ctx *ControllerContext, clusterManager *ClusterManager) (*LoadBalancerController, error)

NewLoadBalancerController creates a controller for gce loadbalancers.

  • kubeClient: A kubernetes REST client.
  • clusterManager: A ClusterManager capable of creating all cloud resources required for L7 loadbalancing.
  • resyncPeriod: Watchers relist from the Kubernetes API server this often.

func (*LoadBalancerController) Run

func (lbc *LoadBalancerController) Run()

Run starts the loadbalancer controller.

func (*LoadBalancerController) Stop

func (lbc *LoadBalancerController) Stop(deleteAll bool) error

Stop stops the loadbalancer controller. It also deletes cluster resources if deleteAll is true.

type PodsByCreationTimestamp

type PodsByCreationTimestamp []*api_v1.Pod

PodsByCreationTimestamp sorts a list of Pods by creation timestamp, using their names as a tie breaker.

func (PodsByCreationTimestamp) Len

func (o PodsByCreationTimestamp) Len() int

func (PodsByCreationTimestamp) Less

func (o PodsByCreationTimestamp) Less(i, j int) bool

func (PodsByCreationTimestamp) Swap

func (o PodsByCreationTimestamp) Swap(i, j int)

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) ListAll

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

List lists all Ingress' in the store (both single and multi cluster ingresses).

func (*StoreToIngressLister) ListGCEIngresses

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

ListGCEIngresses lists all GCE Ingress' in the store.

type StoreToNodeLister

type StoreToNodeLister struct {
	cache.Indexer
}

StoreToNodeLister makes a Store that lists Node.

type StoreToPodLister

type StoreToPodLister struct {
	cache.Indexer
}

StoreToPodLister makes a Store that lists Pods.

func (*StoreToPodLister) List

func (s *StoreToPodLister) List(selector labels.Selector) (ret []*api_v1.Pod, err error)

List returns a list of all pods based on selector

type StoreToServiceLister

type StoreToServiceLister struct {
	cache.Indexer
}

StoreToServiceLister makes a Store that lists Service.

Jump to

Keyboard shortcuts

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