controllers

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	KUBE_DUMMY_IF      = "kube-dummy-if"
	KUBE_TUNNEL_IF     = "kube-tunnel-if"
	IFACE_NOT_FOUND    = "Link not found"
	IFACE_HAS_ADDR     = "file exists"
	IFACE_HAS_NO_ADDR  = "cannot assign requested address"
	IPVS_SERVER_EXISTS = "file exists"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerHeartbeat added in v0.1.0

type ControllerHeartbeat struct {
	Component     string
	LastHeartBeat time.Time
}

ControllerHeartbeat is the structure to hold the heartbeats sent by controllers

type HealthController added in v0.1.0

type HealthController struct {
	HealthPort  uint16
	HTTPEnabled bool
	Status      HealthStats
	Config      *options.KubeRouterConfig
}

HealthController reports the health of the controller loops as a http endpoint

func NewHealthController added in v0.1.0

func NewHealthController(config *options.KubeRouterConfig) (*HealthController, error)

NewHealthController creates a new health controller and returns a reference to it

func (*HealthController) CheckHealth added in v0.1.0

func (hc *HealthController) CheckHealth() bool

CheckHealth evaluates the time since last heartbeat to decide if the controller is running or not

func (*HealthController) HandleHeartbeat added in v0.1.0

func (hc *HealthController) HandleHeartbeat(beat *ControllerHeartbeat)

HandleHeartbeat handles received heartbeats on the health channel

func (*HealthController) Handler added in v0.1.0

func (hc *HealthController) Handler(w http.ResponseWriter, req *http.Request)

Handler writes HTTP responses to the health path

func (*HealthController) Run added in v0.1.0

func (hc *HealthController) Run(healthChan <-chan *ControllerHeartbeat, stopCh <-chan struct{}, wg *sync.WaitGroup) error

Run starts the HealthController

type HealthStats added in v0.1.0

type HealthStats struct {
	sync.Mutex
	Healthy                        bool
	MetricsControllerAlive         time.Time
	NetworkPolicyControllerAlive   time.Time
	NetworkRoutingControllerAlive  time.Time
	NetworkServicesControllerAlive time.Time
}

HealthStats is holds the latest heartbeats

type MetricsController added in v0.1.0

type MetricsController struct {
	MetricsPath string
	MetricsPort uint16
	// contains filtered or unexported fields
}

MetricsController Holds settings for the metrics controller

func NewMetricsController added in v0.1.0

func NewMetricsController(clientset *kubernetes.Clientset, config *options.KubeRouterConfig) (*MetricsController, error)

NewMetricsController returns new MetricController object

func (*MetricsController) Run added in v0.1.0

func (mc *MetricsController) Run(healthChan chan<- *ControllerHeartbeat, stopCh <-chan struct{}, wg *sync.WaitGroup) error

Run prometheus metrics controller

type NetworkPolicyController

type NetworkPolicyController struct {
	MetricsEnabled bool
	// contains filtered or unexported fields
}

NetworkPolicyController strcut to hold information required by NetworkPolicyController

func NewNetworkPolicyController

func NewNetworkPolicyController(clientset *kubernetes.Clientset, config *options.KubeRouterConfig) (*NetworkPolicyController, error)

NewNetworkPolicyController returns new NetworkPolicyController object

func (*NetworkPolicyController) Cleanup

func (npc *NetworkPolicyController) Cleanup()

Cleanup cleanup configurations done

func (*NetworkPolicyController) OnNamespaceUpdate

func (npc *NetworkPolicyController) OnNamespaceUpdate(namespaceUpdate *watchers.NamespaceUpdate)

OnNamespaceUpdate handles updates to namespace from kubernetes api server

func (*NetworkPolicyController) OnNetworkPolicyUpdate

func (npc *NetworkPolicyController) OnNetworkPolicyUpdate(networkPolicyUpdate *watchers.NetworkPolicyUpdate)

OnNetworkPolicyUpdate handles updates to network policy from the kubernetes api server

func (*NetworkPolicyController) OnPodUpdate

func (npc *NetworkPolicyController) OnPodUpdate(podUpdate *watchers.PodUpdate)

OnPodUpdate handles updates to pods from the Kubernetes api server

func (*NetworkPolicyController) Run

func (npc *NetworkPolicyController) Run(healthChan chan<- *ControllerHeartbeat, stopCh <-chan struct{}, wg *sync.WaitGroup)

Run runs forver till we receive notification on stopCh

func (*NetworkPolicyController) Sync

func (npc *NetworkPolicyController) Sync() error

Sync synchronizes iptables to desired state of network policies

type NetworkRoutingController

type NetworkRoutingController struct {
	MetricsEnabled bool
	// contains filtered or unexported fields
}

NetworkRoutingController is struct to hold necessary information required by controller

func NewNetworkRoutingController

func NewNetworkRoutingController(clientset *kubernetes.Clientset,
	kubeRouterConfig *options.KubeRouterConfig) (*NetworkRoutingController, error)

NewNetworkRoutingController returns new NetworkRoutingController object

func (*NetworkRoutingController) AdvertiseClusterIp added in v0.0.5

func (nrc *NetworkRoutingController) AdvertiseClusterIp(clusterIp string) error

AdvertiseClusterIp advertises the service cluster ip the configured peers

func (*NetworkRoutingController) Cleanup

func (nrc *NetworkRoutingController) Cleanup()

Cleanup performs the cleanup of configurations done

func (*NetworkRoutingController) OnNodeUpdate added in v0.0.5

func (nrc *NetworkRoutingController) OnNodeUpdate(nodeUpdate *watchers.NodeUpdate)

OnNodeUpdate Handle updates from Node watcher. Node watcher calls this method whenever there is new node is added or old node is deleted. So peer up with new node and drop peering from old node

func (*NetworkRoutingController) Run

func (nrc *NetworkRoutingController) Run(healthChan chan<- *ControllerHeartbeat, stopCh <-chan struct{}, wg *sync.WaitGroup)

Run runs forever until we are notified on stop channel

type NetworkServicesController

type NetworkServicesController struct {
	MetricsEnabled bool
	// contains filtered or unexported fields
}

NetworkServicesController struct stores information needed by the controller

func NewNetworkServicesController

func NewNetworkServicesController(clientset *kubernetes.Clientset, config *options.KubeRouterConfig) (*NetworkServicesController, error)

NewNetworkServicesController returns NetworkServicesController object

func (*NetworkServicesController) Cleanup

func (nsc *NetworkServicesController) Cleanup()

Cleanup cleans all the configurations (IPVS, iptables, links) done

func (*NetworkServicesController) OnEndpointsUpdate

func (nsc *NetworkServicesController) OnEndpointsUpdate(endpointsUpdate *watchers.EndpointsUpdate)

OnEndpointsUpdate handle change in endpoints update from the API server

func (*NetworkServicesController) OnServiceUpdate

func (nsc *NetworkServicesController) OnServiceUpdate(serviceUpdate *watchers.ServiceUpdate)

OnServiceUpdate handle change in service update from the API server

func (*NetworkServicesController) Run

func (nsc *NetworkServicesController) Run(healthChan chan<- *ControllerHeartbeat, stopCh <-chan struct{}, wg *sync.WaitGroup) error

Run periodically sync ipvs configuration to reflect desired state of services and endpoints

Jump to

Keyboard shortcuts

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