controller

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2015 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package controller contains logic for watching and synchronizing replicationControllers.

Index

Constants

View Source
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
)
View Source
const (
	CreatedByAnnotation = "kubernetes.io/created-by"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Expectations added in v0.17.0

type Expectations interface {
	Fulfilled() bool
}

Expectations are either fulfilled, or expire naturally.

type PodControlInterface

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

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

PodExpectations track pod creates/deletes.

func (*PodExpectations) Fulfilled added in v0.17.0

func (e *PodExpectations) Fulfilled() bool

Fulfilled returns true if this expectation has been fulfilled.

func (*PodExpectations) Seen added in v0.17.0

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

Seen decrements the add and del counters.

type RCExpectations added in v0.17.0

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

func NewRCExpectations() *RCExpectations

NewRCExpectations returns a store for PodExpectations.

func (*RCExpectations) CreationObserved added in v0.17.0

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

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

func (*RCExpectations) DeleteExpectations added in v0.18.0

func (r *RCExpectations) DeleteExpectations(rcKey string)

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

func (*RCExpectations) DeletionObserved added in v0.17.0

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

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

func (*RCExpectations) ExpectCreations added in v0.17.0

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

func (*RCExpectations) ExpectDeletions added in v0.17.0

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

func (*RCExpectations) GetExpectations added in v0.17.0

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

GetExpectations returns the PodExpectations of the given rc.

func (*RCExpectations) SatisfiedExpectations added in v0.17.0

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

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

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

RealPodControl is the default implementation of PodControllerInterface.

type ReplicationManager

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

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

NewReplicationManager creates a new ReplicationManager.

func (*ReplicationManager) Run

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

Run begins watching and syncing.

func (*ReplicationManager) SetEventRecorder added in v0.18.0

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

Path Synopsis
Package framework implements all the grunt work involved in running a simple controller.
Package framework implements all the grunt work involved in running a simple controller.

Jump to

Keyboard shortcuts

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