kubernetes: k8s.io/kubernetes/pkg/controller/nodelifecycle/scheduler Index | Files

package scheduler

import "k8s.io/kubernetes/pkg/controller/nodelifecycle/scheduler"

Index

Package Files

rate_limited_queue.go taint_manager.go timed_workers.go

Constants

const (
    // NodeHealthUpdateRetry controls the number of retries of writing
    // node health update.
    NodeHealthUpdateRetry = 5
    // NodeEvictionPeriod controls how often NodeController will try to
    // evict Pods from non-responsive Nodes.
    NodeEvictionPeriod = 100 * time.Millisecond
    // EvictionRateLimiterBurst is the burst value for all eviction rate
    // limiters
    EvictionRateLimiterBurst = 1
)
const (

    // NodeUpdateChannelSize defines the size of channel for node update events.
    NodeUpdateChannelSize = 10
    // UpdateWorkerSize defines the size of workers for node update or/and pod update.
    UpdateWorkerSize = 8
)

type ActionFunc Uses

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 GetNodeFunc Uses

type GetNodeFunc func(name string) (*v1.Node, error)

GetNodeFunc returns the node for the specified name, or a NotFound error if missing.

type GetPodFunc Uses

type GetPodFunc func(name, namespace string) (*v1.Pod, error)

GetPodFunc returns the pod for the specified name/namespace, or a NotFound error if missing.

type GetPodsByNodeNameFunc Uses

type GetPodsByNodeNameFunc func(nodeName string) ([]v1.Pod, error)

GetPodsByNodeNameFunc returns the list of pods assigned to the specified node.

type NoExecuteTaintManager Uses

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

NoExecuteTaintManager listens to Taint/Toleration changes and is responsible for removing Pods from Nodes tainted with NoExecute Taints.

func NewNoExecuteTaintManager Uses

func NewNoExecuteTaintManager(c clientset.Interface, getPod GetPodFunc, getNode GetNodeFunc, getPodsAssignedToNode GetPodsByNodeNameFunc) *NoExecuteTaintManager

NewNoExecuteTaintManager creates a new NoExecuteTaintManager that will use passed clientset to communicate with the API server.

func (*NoExecuteTaintManager) NodeUpdated Uses

func (tc *NoExecuteTaintManager) NodeUpdated(oldNode *v1.Node, newNode *v1.Node)

NodeUpdated is used to notify NoExecuteTaintManager about Node changes.

func (*NoExecuteTaintManager) PodUpdated Uses

func (tc *NoExecuteTaintManager) PodUpdated(oldPod *v1.Pod, newPod *v1.Pod)

PodUpdated is used to notify NoExecuteTaintManager about Pod changes.

func (*NoExecuteTaintManager) Run Uses

func (tc *NoExecuteTaintManager) Run(stopCh <-chan struct{})

Run starts NoExecuteTaintManager which will run in loop until `stopCh` is closed.

type RateLimitedTimedQueue Uses

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 Uses

func NewRateLimitedTimedQueue(limiter flowcontrol.RateLimiter) *RateLimitedTimedQueue

NewRateLimitedTimedQueue creates new queue which will use given RateLimiter to oversee execution.

func (*RateLimitedTimedQueue) Add Uses

func (q *RateLimitedTimedQueue) Add(value string, uid interface{}) bool

Add value to the queue to be processed. Won't add the same value(comparison by value) a second time if it was already added and not removed.

func (*RateLimitedTimedQueue) Clear Uses

func (q *RateLimitedTimedQueue) Clear()

Clear removes all items from the queue

func (*RateLimitedTimedQueue) Remove Uses

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

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

func (*RateLimitedTimedQueue) SwapLimiter Uses

func (q *RateLimitedTimedQueue) SwapLimiter(newQPS float32)

SwapLimiter safely swaps current limiter for this queue with the passed one if capacities or qps's differ.

func (*RateLimitedTimedQueue) Try Uses

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. The same value is processed only once unless Remove is explicitly called on it (it's done by the cancelPodEviction function in NodeController when Node becomes Ready again) TODO: figure out a good way to do garbage collection for all Nodes that were removed from the cluster.

type TimedQueue Uses

type TimedQueue []*TimedValue

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

func (TimedQueue) Len Uses

func (h TimedQueue) Len() int

Len is the length of the queue.

func (TimedQueue) Less Uses

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

Less returns true if queue[i] < queue[j].

func (*TimedQueue) Pop Uses

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

Pop the lowest ProcessAt item.

func (*TimedQueue) Push Uses

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

Push a new TimedValue on to the queue.

func (TimedQueue) Swap Uses

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

Swap swaps index i and j.

type TimedValue Uses

type TimedValue struct {
    Value string
    // UID could be anything that helps identify the value
    UID       interface{}
    AddedAt   time.Time
    ProcessAt time.Time
}

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

type TimedWorker Uses

type TimedWorker struct {
    WorkItem  *WorkArgs
    CreatedAt time.Time
    FireAt    time.Time
    Timer     *time.Timer
}

TimedWorker is a responsible for executing a function no earlier than at FireAt time.

func CreateWorker Uses

func CreateWorker(args *WorkArgs, createdAt time.Time, fireAt time.Time, f func(args *WorkArgs) error) *TimedWorker

CreateWorker creates a TimedWorker that will execute `f` not earlier than `fireAt`.

func (*TimedWorker) Cancel Uses

func (w *TimedWorker) Cancel()

Cancel cancels the execution of function by the `TimedWorker`

type TimedWorkerQueue Uses

type TimedWorkerQueue struct {
    sync.Mutex
    // contains filtered or unexported fields
}

TimedWorkerQueue keeps a set of TimedWorkers that are still wait for execution.

func CreateWorkerQueue Uses

func CreateWorkerQueue(f func(args *WorkArgs) error) *TimedWorkerQueue

CreateWorkerQueue creates a new TimedWorkerQueue for workers that will execute given function `f`.

func (*TimedWorkerQueue) AddWork Uses

func (q *TimedWorkerQueue) AddWork(args *WorkArgs, createdAt time.Time, fireAt time.Time)

AddWork adds a work to the WorkerQueue which will be executed not earlier than `fireAt`.

func (*TimedWorkerQueue) CancelWork Uses

func (q *TimedWorkerQueue) CancelWork(key string) bool

CancelWork removes scheduled function execution from the queue. Returns true if work was cancelled.

func (*TimedWorkerQueue) GetWorkerUnsafe Uses

func (q *TimedWorkerQueue) GetWorkerUnsafe(key string) *TimedWorker

GetWorkerUnsafe returns a TimedWorker corresponding to the given key. Unsafe method - workers have attached goroutines which can fire afater this function is called.

type UniqueQueue Uses

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

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

func (*UniqueQueue) Add Uses

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

Add 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) Clear Uses

func (q *UniqueQueue) Clear()

Clear removes all items from the queue and duplication preventing set.

func (*UniqueQueue) Get Uses

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

Get returns the oldest added value that wasn't returned yet.

func (*UniqueQueue) Head Uses

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

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

func (*UniqueQueue) Remove Uses

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

Remove 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) RemoveFromQueue Uses

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

RemoveFromQueue the value from the queue, but keeps it in the set, so it won't be added second time. Returns true if something was removed.

func (*UniqueQueue) Replace Uses

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.

type WorkArgs Uses

type WorkArgs struct {
    NamespacedName types.NamespacedName
}

WorkArgs keeps arguments that will be passed to the function executed by the worker.

func NewWorkArgs Uses

func NewWorkArgs(name, namespace string) *WorkArgs

NewWorkArgs is a helper function to create new `WorkArgs`

func (*WorkArgs) KeyFromWorkArgs Uses

func (w *WorkArgs) KeyFromWorkArgs() string

KeyFromWorkArgs creates a key for the given `WorkArgs`

Package scheduler imports 22 packages (graph) and is imported by 1 packages. Updated 2019-08-09. Refresh now. Tools for package owners.