node

package
v1.0.7 Latest Latest
Warning

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

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

Documentation

Overview

Package node contains code for syncing cloud instances with node registry

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCloudInstance = errors.New("cloud provider doesn't support instances.")
)

Functions

This section is empty.

Types

type ActionFunc added in v1.0.7

type ActionFunc func(TimedValue) (bool, time.Duration)

ActionFunc takes a timed value and returns false if the item must be retried, with an optional time.Duration if some minimum wait interval should be used.

type NodeController

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

func NewNodeController

func NewNodeController(
	cloud cloudprovider.Interface,
	kubeClient client.Interface,
	podEvictionTimeout time.Duration,
	deletionEvictionLimiter util.RateLimiter,
	terminationEvictionLimiter util.RateLimiter,
	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 RateLimitedTimedQueue added in v1.0.7

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

RateLimitedTimedQueue is a unique item priority queue ordered by the expected next time of execution. It is also rate limited.

func NewRateLimitedTimedQueue added in v1.0.7

func NewRateLimitedTimedQueue(limiter util.RateLimiter) *RateLimitedTimedQueue

Creates new queue which will use given RateLimiter to oversee execution.

func (*RateLimitedTimedQueue) Add added in v1.0.7

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

Adds value to the queue to be processed. Won't add the same value a second time if it was already added and not removed.

func (*RateLimitedTimedQueue) Remove added in v1.0.7

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

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

func (*RateLimitedTimedQueue) Try added in v1.0.7

func (q *RateLimitedTimedQueue) Try(fn ActionFunc)

Try processes the queue. Ends prematurely if RateLimiter forbids an action and leak is true. Otherwise, requeues the item to be processed. Each value is processed once if fn returns true, otherwise it is added back to the queue. The returned remaining is used to identify the minimum time to execute the next item in the queue.

type TimedQueue added in v1.0.7

type TimedQueue []*TimedValue

TimedQueue is a priority heap where the lowest ProcessAt is at the front of the queue

func (TimedQueue) Len added in v1.0.7

func (h TimedQueue) Len() int

func (TimedQueue) Less added in v1.0.7

func (h TimedQueue) Less(i, j int) bool

func (*TimedQueue) Pop added in v1.0.7

func (h *TimedQueue) Pop() interface{}

func (*TimedQueue) Push added in v1.0.7

func (h *TimedQueue) Push(x interface{})

func (TimedQueue) Swap added in v1.0.7

func (h TimedQueue) Swap(i, j int)

type TimedValue added in v1.0.7

type TimedValue struct {
	Value     string
	AddedAt   time.Time
	ProcessAt time.Time
}

TimedValue is a value that should be processed at a designated time.

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 TimedValue) 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() (TimedValue, bool)

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

func (*UniqueQueue) Head added in v1.0.7

func (q *UniqueQueue) Head() (TimedValue, bool)

Head returns the oldest added value that wasn't returned yet without removing it.

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.

func (*UniqueQueue) Replace added in v1.0.7

func (q *UniqueQueue) Replace(value TimedValue) bool

Replace replaces an existing value in the queue if it already exists, otherwise it does nothing. Returns true if the item was found.

Jump to

Keyboard shortcuts

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