Documentation ¶
Overview ¶
Package controller contains logic for watching and synchronizing replicationControllers.
Index ¶
- Constants
- type Expectations
- type PodControlInterface
- type PodExpectations
- type RCExpectations
- func (r *RCExpectations) CreationObserved(rc *api.ReplicationController)
- func (r *RCExpectations) DeletionObserved(rc *api.ReplicationController)
- func (r *RCExpectations) ExpectCreations(rc *api.ReplicationController, adds int) error
- func (r *RCExpectations) ExpectDeletions(rc *api.ReplicationController, dels int) error
- func (r *RCExpectations) GetExpectations(rc *api.ReplicationController) (*PodExpectations, bool, error)
- func (r *RCExpectations) SatisfiedExpectations(rc *api.ReplicationController) bool
- type RealPodControl
- type ReplicationManager
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 )
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
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) 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 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.