controller

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultFirewallName is the default firewall name.
	DefaultFirewallName = ""
)

Variables

This section is empty.

Functions

func NewFakeClusterManager

func NewFakeClusterManager(clusterName, firewallName string) *fakeClusterManager

NewFakeClusterManager creates a new fake ClusterManager.

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

func (c *ClusterManager) BackendServiceForPort(port int64) (*compute.BackendService, error)

func (*ClusterManager) DefaultBackendNodePort

func (c *ClusterManager) DefaultBackendNodePort() *backends.ServicePort

func (*ClusterManager) EnsureFirewall added in v1.0.1

func (c *ClusterManager) EnsureFirewall(nodeNames []string, endpointPorts []string) error

func (*ClusterManager) EnsureInstanceGroupsAndPorts

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

func (*ClusterManager) EnsureLoadBalancer added in v1.0.1

func (c *ClusterManager) EnsureLoadBalancer(lb *loadbalancers.L7RuntimeInfo, lbServicePorts []backends.ServicePort, instanceGroups []*compute.InstanceGroup) error

EnsureLoadBalancer creates the backend services and higher-level LB resources.

  • lb is 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.
  • lbServicePorts are the ports for which we require Backend Services.
  • instanceGroups are the groups to be referenced by the Backend Services..

If GCE runs out of quota, a googleapi 403 is returned.

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

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 LoadBalancerController

type LoadBalancerController struct {

	// TODO: Watch secrets
	CloudClusterManager *ClusterManager

	Translator *translator.GCE
	// 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, stopCh chan struct{}, ctx *context.ControllerContext, clusterManager *ClusterManager, negEnabled bool) (*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 NodeController

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

NodeController synchronizes the state of the nodes to the unmanaged instance groups.

func NewNodeController

func NewNodeController(ctx *context.ControllerContext, cm *ClusterManager) *NodeController

NewNodeController returns a new node update controller.

func (*NodeController) Run

func (c *NodeController) Run(stopCh chan struct{})

Run a go routine to process updates for the controller.

func (*NodeController) Shutdown

func (c *NodeController) Shutdown()

Run a go routine to process updates for the controller.

type StoreToEndpointLister

type StoreToEndpointLister struct {
	cache.Indexer
}

StoreToEndpointLister makes a Store that lists Endpoints.

func (*StoreToEndpointLister) ListEndpointTargetPorts

func (s *StoreToEndpointLister) ListEndpointTargetPorts(namespace, name, targetPort string) []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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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