Version: v1.0.7 Latest Latest

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

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



Package nodecontroller contains code for syncing cloud instances with minion registry



This section is empty.


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


This section is empty.


type NodeController

type NodeController struct {
	// contains filtered or unexported fields

func NewNodeController

func NewNodeController(
	cloud cloudprovider.Interface,
	kubeClient client.Interface,
	registerRetryCount int,
	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 added in v0.19.0

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 added in v0.19.0

func NewPodEvictor(deletingPodsRateLimiter util.RateLimiter) *PodEvictor

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

func (*PodEvictor) AddNodeToEvict added in v0.19.0

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 added in v0.19.0

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

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

func (*PodEvictor) TryEvict added in v0.19.0

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 added in v0.19.0

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 added in v0.19.0

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 added in v0.19.0

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

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

func (*UniqueQueue) Remove added in v0.19.0

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