{"modulePath":"github.com/dockerstack/kubernetes","version":"v0.20.1-0.20150627061651-1c0b765df6da","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package controller\n\nPackage controller contains logic for watching and synchronizing replicationControllers.\n\n## Constants\n\n```go\nconst (\n\t// We'll attempt to recompute the required replicas of all replication controllers\n\t// the have fulfilled their expectations at least this often. This recomputation\n\t// happens based on contents in local pod storage.\n\tFullControllerResyncPeriod = 30 * time.Second\n\n\t// If a watch misdelivers info about a pod, it'll take at least this long\n\t// to rectify the number of replicas. Note that dropped deletes are only\n\t// rectified after the expectation times out because we don't know the\n\t// final resting state of the pod.\n\tPodRelistPeriod = 5 * time.Minute\n\n\t// If a watch drops a delete event for a pod, it'll take this long\n\t// before a dormant rc waiting for those packets is woken up anyway. It is\n\t// specifically targeted at the case where some problem prevents an update\n\t// of expectations, without it the RC could stay asleep forever. This should\n\t// be set based on the expected latency of watch events.\n\t//\n\t// Currently an rc can service (create *and* observe the watch events for said\n\t// creation) about 10-20 pods a second, so it takes about 1 min to service\n\t// 500 pods. Just creation is limited to 20qps, and watching happens with ~10-30s\n\t// latency/pod at the scale of 3000 pods over 100 nodes.\n\tExpectationsTimeout = 3 * time.Minute\n\n\t// Realistic value of the burstReplica field for the replication manager based off\n\t// performance requirements for kubernetes 1.0.\n\tBurstReplicas = 500\n\n\t// We must avoid counting pods until the pod store has synced. If it hasn't synced, to\n\t// avoid a hot loop, we'll wait this long between checks.\n\tPodStoreSyncedPollPeriod = 100 * time.Millisecond\n)\n```\n\n```go\nconst (\n\tCreatedByAnnotation = \"kubernetes.io/created-by\"\n)\n```\n\n## Types\n\n```go\ntype Expectations interface {\n\tFulfilled() bool\n}\n```\nExpectations are either fulfilled, or expire naturally.\n\n```go\ntype PodControlInterface interface {\n\t// contains filtered or unexported methods\n}\n```\nPodControlInterface is an interface that knows how to add or delete pods created as an interface to allow testing.\n\n```go\ntype PodExpectations struct {\n\t// contains filtered or unexported fields\n}\n```\nPodExpectations track pod creates/deletes.\n\n```go\nfunc (e *PodExpectations) Fulfilled() bool\n```\nFulfilled returns true if this expectation has been fulfilled.\n\n```go\nfunc (e *PodExpectations) Seen(add, del int64)\n```\nSeen decrements the add and del counters.\n\n```go\ntype RCExpectations struct {\n\tcache.Store\n}\n```\nRCExpectations is a ttl cache mapping rcs to what they expect to see before being woken up for a sync.\n\n```go\nfunc NewRCExpectations() *RCExpectations\n```\nNewRCExpectations returns a store for PodExpectations.\n\n```go\nfunc (r *RCExpectations) CreationObserved(rc *api.ReplicationController)\n```\nCreationObserved atomically decrements the \\`add\\` expecation count of the given replication controller.\n\n```go\nfunc (r *RCExpectations) DeleteExpectations(rcKey string)\n```\nDeleteExpectations deletes the expectations of the given RC from the TTLStore.\n\n```go\nfunc (r *RCExpectations) DeletionObserved(rc *api.ReplicationController)\n```\nDeletionObserved atomically decrements the \\`del\\` expectation count of the given replication controller.\n\n```go\nfunc (r *RCExpectations) ExpectCreations(rc *api.ReplicationController, adds int) error\n```\n\n```go\nfunc (r *RCExpectations) ExpectDeletions(rc *api.ReplicationController, dels int) error\n```\n\n```go\nfunc (r *RCExpectations) GetExpectations(rc *api.ReplicationController) (*PodExpectations, bool, error)\n```\nGetExpectations returns the PodExpectations of the given rc.\n\n```go\nfunc (r *RCExpectations) SatisfiedExpectations(rc *api.ReplicationController) bool\n```\nSatisfiedExpectations 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.\n\n```go\ntype RCExpectationsManager interface {\n\tGetExpectations(rc *api.ReplicationController) (*PodExpectations, bool, error)\n\tSatisfiedExpectations(rc *api.ReplicationController) bool\n\tDeleteExpectations(rcKey string)\n\tExpectCreations(rc *api.ReplicationController, adds int) error\n\tExpectDeletions(rc *api.ReplicationController, dels int) error\n\tCreationObserved(rc *api.ReplicationController)\n\tDeletionObserved(rc *api.ReplicationController)\n}\n```\nRCExpectationsManager is an interface that allows users to set and wait on expectations. Only abstracted out for testing.\n\n```go\ntype RealPodControl struct {\n\t// contains filtered or unexported fields\n}\n```\nRealPodControl is the default implementation of PodControllerInterface.\n\n```go\ntype ReplicationManager struct {\n\t// contains filtered or unexported fields\n}\n```\nReplicationManager is responsible for synchronizing ReplicationController objects stored in the system with actual running pods.\n\n```go\nfunc NewReplicationManager(kubeClient client.Interface, burstReplicas int) *ReplicationManager\n```\nNewReplicationManager creates a new ReplicationManager.\n\n```go\nfunc (rm *ReplicationManager) Run(workers int, stopCh \u003c-chan struct{})\n```\nRun begins watching and syncing.\n\n```go\nfunc (rm *ReplicationManager) SetEventRecorder(recorder record.EventRecorder)\n```\nSetEventRecorder replaces the event recorder used by the replication manager with the given recorder. Only used for testing.\n\n","path":"github.com/dockerstack/kubernetes/pkg/controller","name":"controller","synopsis":"Package controller contains logic for watching and synchronizing replicationControllers.","isRedistributable":true}
