kubernetes: github.com/erimatnor/kubernetes/pkg/controller Index | Files | Directories

package controller

import "github.com/erimatnor/kubernetes/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.
    //
    // TODO: Set this per expectation, based on its size.
    // Currently an rc can service (create *and* observe the watch events for said
    // creation) about 10-20 pods a second, so it takes about 3.5 min to service
    // 3000 pods. Just creation is limited to 30qps, and watching happens with
    // ~10-30s latency/pod at scale.
    ExpectationsTimeout = 6 * time.Minute
)
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) 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 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) *ReplicationManager

NewReplicationManager creates a new ReplicationManager.

func (*ReplicationManager) Run Uses

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

Run begins watching and syncing.

Directories

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

Package controller imports 20 packages (graph). Updated 2017-05-11. Refresh now. Tools for package owners.