controller

package
v0.0.0-...-ca852fc Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2017 License: Apache-2.0 Imports: 33 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 = ""
)

Functions

func NewFakeClusterManager

func NewFakeClusterManager(clusterName 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(
	configFilePath string,
	namer *utils.Namer,
	defaultBackendNodePort int64,
	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, nodePorts []int64) error

Checkpoint performs a checkpoint with the cloud.

  • lbNames are the names of 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.
  • nodePorts are the ports for which we require BackendServices. Each of these ports must also be opened on the corresponding Instance Group.

If in performing the checkpoint the cluster manager runs out of quota, a googleapi 403 is returned.

func (*ClusterManager) GC

func (c *ClusterManager) GC(lbNames []string, nodePorts []int64) 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 GCETranslator

type GCETranslator struct {
	*LoadBalancerController
}

GCETranslator helps with kubernetes -> gce api conversion.

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

func (t *GCETranslator) HealthCheck(port int64) (*compute.HttpHealthCheck, error)

HealthCheck returns the http readiness probe for the endpoint backing the given nodePort. If no probe is found it returns a health check with "" as the request path, callers are responsible for swapping this out for the appropriate default.

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 *client.Client, clusterManager *ClusterManager, resyncPeriod time.Duration, namespace string) (*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) ListRuntimeInfo

func (lbc *LoadBalancerController) ListRuntimeInfo() (lbs []*loadbalancers.L7RuntimeInfo, err error)

ListRuntimeInfo lists L7RuntimeInfo as understood by the loadbalancer module.

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.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.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.

Jump to

Keyboard shortcuts

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