kubernetes.v0: gopkg.in/kubernetes/kubernetes.v0/pkg/controller Index | Files | Directories

package controller

import "gopkg.in/kubernetes/kubernetes.v0/pkg/controller"

Package controller contains logic for watching and synchronizing replicationControllers.

Index

Package Files

controller_utils.go doc.go replication_controller.go

Constants

const (
    // We'll attempt to recompute the required replicas of all replication controllers
    // the have fulfilled their expectations at least this often. This recomputation
    // happens based on contents in local pod storage.
    FullControllerResyncPeriod = 30 * time.Second

    // If a watch misdelivers info about a pod, it'll take at least this long
    // to rectify the number of replicas. Note that dropped deletes are only
    // rectified after the expectation times out because we don't know the
    // final resting state of the pod.
    PodRelistPeriod = 5 * time.Minute

    // If a watch drops a delete event for a pod, it'll take this long
    // before a dormant rc waiting for those packets is woken up anyway. It is
    // specifically targeted at the case where some problem prevents an update
    // of expectations, without it the RC could stay asleep forever. This should
    // be set based on the expected latency of watch events.
    //
    // Currently an rc can service (create *and* observe the watch events for said
    // creation) about 10-20 pods a second, so it takes about 1 min to service
    // 500 pods. Just creation is limited to 20qps, and watching happens with ~10-30s
    // latency/pod at the scale of 3000 pods over 100 nodes.
    ExpectationsTimeout = 3 * time.Minute

    // Realistic value of the burstReplica field for the replication manager based off
    // performance requirements for kubernetes 1.0.
    BurstReplicas = 500

    // We must avoid counting pods until the pod store has synced. If it hasn't synced, to
    // avoid a hot loop, we'll wait this long between checks.
    PodStoreSyncedPollPeriod = 100 * time.Millisecond
)
const (
    CreatedByAnnotation = "kubernetes.io/created-by"
)

type Expectations Uses

type Expectations interface {
    Fulfilled() bool
}

Expectations are either fulfilled, or expire naturally.

type PodControlInterface Uses

type PodControlInterface interface {
    // contains filtered or unexported methods
}

PodControlInterface is an interface that knows how to add or delete pods created as an interface to allow testing.

type PodExpectations Uses

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

PodExpectations track pod creates/deletes.

func (*PodExpectations) Fulfilled Uses

func (e *PodExpectations) Fulfilled() bool

Fulfilled returns true if this expectation has been fulfilled.

func (*PodExpectations) Seen Uses

func (e *PodExpectations) Seen(add, del int64)

Seen decrements the add and del counters.

type RCExpectations Uses

type RCExpectations struct {
    cache.Store
}

RCExpectations is a ttl cache mapping rcs to what they expect to see before being woken up for a sync.

func NewRCExpectations Uses

func NewRCExpectations() *RCExpectations

NewRCExpectations returns a store for PodExpectations.

func (*RCExpectations) CreationObserved Uses

func (r *RCExpectations) CreationObserved(rc *api.ReplicationController)

CreationObserved atomically decrements the `add` expecation count of the given replication controller.

func (*RCExpectations) DeleteExpectations Uses

func (r *RCExpectations) DeleteExpectations(rcKey string)

DeleteExpectations deletes the expectations of the given RC from the TTLStore.

func (*RCExpectations) DeletionObserved Uses

func (r *RCExpectations) DeletionObserved(rc *api.ReplicationController)

DeletionObserved atomically decrements the `del` expectation count of the given replication controller.

func (*RCExpectations) ExpectCreations Uses

func (r *RCExpectations) ExpectCreations(rc *api.ReplicationController, adds int) error

func (*RCExpectations) ExpectDeletions Uses

func (r *RCExpectations) ExpectDeletions(rc *api.ReplicationController, dels int) error

func (*RCExpectations) GetExpectations Uses

func (r *RCExpectations) GetExpectations(rc *api.ReplicationController) (*PodExpectations, bool, error)

GetExpectations returns the PodExpectations of the given rc.

func (*RCExpectations) SatisfiedExpectations Uses

func (r *RCExpectations) SatisfiedExpectations(rc *api.ReplicationController) bool

SatisfiedExpectations returns true if the replication manager has observed the required adds/dels for the given rc. Add/del counts are established by the rc at sync time, and updated as pods are observed by the replication manager's podController.

type RCExpectationsManager Uses

type RCExpectationsManager interface {
    GetExpectations(rc *api.ReplicationController) (*PodExpectations, bool, error)
    SatisfiedExpectations(rc *api.ReplicationController) bool
    DeleteExpectations(rcKey string)
    ExpectCreations(rc *api.ReplicationController, adds int) error
    ExpectDeletions(rc *api.ReplicationController, dels int) error
    CreationObserved(rc *api.ReplicationController)
    DeletionObserved(rc *api.ReplicationController)
}

RCExpectationsManager is an interface that allows users to set and wait on expectations. Only abstracted out for testing.

type RealPodControl Uses

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

RealPodControl is the default implementation of PodControllerInterface.

type ReplicationManager Uses

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

ReplicationManager is responsible for synchronizing ReplicationController objects stored in the system with actual running pods.

func NewReplicationManager Uses

func NewReplicationManager(kubeClient client.Interface, burstReplicas int) *ReplicationManager

NewReplicationManager creates a new ReplicationManager.

func (*ReplicationManager) Run Uses

func (rm *ReplicationManager) Run(workers int, stopCh <-chan struct{})

Run begins watching and syncing.

func (*ReplicationManager) SetEventRecorder Uses

func (rm *ReplicationManager) SetEventRecorder(recorder record.EventRecorder)

SetEventRecorder replaces the event recorder used by the replication manager with the given recorder. Only used for testing.

Directories

PathSynopsis
frameworkPackage framework implements all the grunt work involved in running a simple controller.

Package controller imports 20 packages (graph). Updated 2018-02-25. Refresh now. Tools for package owners.