nodecontroller

package
v1.1.0-alpha.0....-d04fce0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2015 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package nodecontroller contains code for syncing cloud instances with minion registry

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRegistration   = errors.New("unable to register all nodes.")
	ErrQueryIPAddress = errors.New("unable to query IP address.")
	ErrCloudInstance  = errors.New("cloud provider doesn't support instances.")
)

Functions

This section is empty.

Types

type NodeController

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

func NewNodeController

func NewNodeController(
	cloud cloudprovider.Interface,
	kubeClient client.Interface,
	podEvictionTimeout time.Duration,
	podEvictor *PodEvictor,
	nodeMonitorGracePeriod time.Duration,
	nodeStartupGracePeriod time.Duration,
	nodeMonitorPeriod time.Duration,
	clusterCIDR *net.IPNet,
	allocateNodeCIDRs bool) *NodeController

NewNodeController returns a new node controller to sync instances from cloudprovider.

func (*NodeController) Run

func (nc *NodeController) Run(period time.Duration)

Run starts an asynchronous loop that monitors the status of cluster nodes.

type PodEvictor

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

Entity responsible for evicting Pods from inserted Nodes. It uses RateLimiter to avoid evicting everything at once. Note that we rate limit eviction of Nodes not individual Pods.

func NewPodEvictor

func NewPodEvictor(deletingPodsRateLimiter util.RateLimiter) *PodEvictor

Creates new PodEvictor which will use given RateLimiter to oversee eviction.

func (*PodEvictor) AddNodeToEvict

func (pe *PodEvictor) AddNodeToEvict(nodeName string) bool

Adds Node to the Evictor to be processed later. Won't add the same Node second time if it was already added and not removed.

func (*PodEvictor) RemoveNodeToEvict

func (pe *PodEvictor) RemoveNodeToEvict(nodeName string) bool

Removes Node from the Evictor. The Node won't be processed until added again.

func (*PodEvictor) TryEvict

func (pe *PodEvictor) TryEvict(delFunc func(string))

Tries to evict all Pods from previously inserted Nodes. Ends prematurely if RateLimiter forbids any eviction. Each Node is processed only once, as long as it's not Removed, i.e. calling multiple AddNodeToEvict does not result with multiple evictions as long as RemoveNodeToEvict is not called.

type UniqueQueue

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

A FIFO queue which additionally guarantees that any element can be added only once until it is removed.

func (*UniqueQueue) Add

func (q *UniqueQueue) Add(value string) bool

Adds a new value to the queue if it wasn't added before, or was explicitly removed by the Remove call. Returns true if new value was added.

func (*UniqueQueue) Get

func (q *UniqueQueue) Get() (string, bool)

Returns the oldest added value that wasn't returned yet.

func (*UniqueQueue) Remove

func (q *UniqueQueue) Remove(value string) bool

Removes the value from the queue, so Get() call won't return it, and allow subsequent addition of the given value. If the value is not present does nothing and returns false.

Jump to

Keyboard shortcuts

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