{"modulePath":"github.com/dockerstack/kubernetes","version":"v0.20.1-0.20150627061651-1c0b765df6da","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package scheduler\n\n## Variables\n\n```go\nvar ErrNoNodesAvailable = fmt.Errorf(\"no nodes available to schedule pods\")\n```\n\n## Functions\n\n```go\nfunc EqualPriority(_ *api.Pod, podLister algorithm.PodLister, minionLister algorithm.MinionLister) (algorithm.HostPriorityList, error)\n```\nEqualPriority is a prioritizer function that gives an equal weight of one to all nodes\n\n```go\nfunc NewGenericScheduler(predicates map[string]algorithm.FitPredicate, prioritizers []algorithm.PriorityConfig, pods algorithm.PodLister, random *rand.Rand) algorithm.ScheduleAlgorithm\n```\n\n## Types\n\n```go\ntype Binder interface {\n\tBind(binding *api.Binding) error\n}\n```\nBinder knows how to write a binding.\n\n```go\ntype Config struct {\n\t// It is expected that changes made via modeler will be observed\n\t// by MinionLister and Algorithm.\n\tModeler      SystemModeler\n\tMinionLister algorithm.MinionLister\n\tAlgorithm    algorithm.ScheduleAlgorithm\n\tBinder       Binder\n\n\t// Rate at which we can create pods\n\tBindPodsRateLimiter util.RateLimiter\n\n\t// NextPod should be a function that blocks until the next pod\n\t// is available. We don't use a channel for this, because scheduling\n\t// a pod may take some amount of time and we don't want pods to get\n\t// stale while they sit in a channel.\n\tNextPod func() *api.Pod\n\n\t// Error is called if there is an error. It is passed the pod in\n\t// question, and the error\n\tError func(*api.Pod, error)\n\n\t// Recorder is the EventRecorder to use\n\tRecorder record.EventRecorder\n\n\t// Close this to shut down the scheduler.\n\tStopEverything chan struct{}\n}\n```\n\n```go\ntype ExtendedPodLister interface {\n\talgorithm.PodLister\n\tExists(pod *api.Pod) (bool, error)\n}\n```\nExtendedPodLister: SimpleModeler needs to be able to check for a pod's existance in addition to listing the pods.\n\n```go\ntype FailedPredicateMap map[string]util.StringSet\n```\n\n```go\ntype FakeModeler struct {\n\tAssumePodFunc      func(pod *api.Pod)\n\tForgetPodFunc      func(pod *api.Pod)\n\tForgetPodByKeyFunc func(key string)\n\t// contains filtered or unexported fields\n}\n```\nFakeModeler implements the SystemModeler interface.\n\n```go\nfunc (f *FakeModeler) AssumePod(pod *api.Pod)\n```\nAssumePod calls the function variable if it is not nil.\n\n```go\nfunc (f *FakeModeler) ForgetPod(pod *api.Pod)\n```\nForgetPod calls the function variable if it is not nil.\n\n```go\nfunc (f *FakeModeler) ForgetPodByKey(key string)\n```\nForgetPodByKey calls the function variable if it is not nil.\n\n```go\nfunc (a *FakeModeler) LockedAction(do func())\n```\nLockedAction serializes calls of whatever is passed as 'do'.\n\n```go\ntype FitError struct {\n\tPod              *api.Pod\n\tFailedPredicates FailedPredicateMap\n}\n```\n\n```go\nfunc (f *FitError) Error() string\n```\nimplementation of the error interface\n\n```go\ntype Scheduler struct {\n\t// contains filtered or unexported fields\n}\n```\nScheduler watches for new unscheduled pods. It attempts to find minions that they fit on and writes bindings back to the api server.\n\n```go\nfunc New(c *Config) *Scheduler\n```\nNew returns a new scheduler.\n\n```go\nfunc (s *Scheduler) Run()\n```\nRun begins watching and scheduling. It starts a goroutine and returns immediately.\n\n```go\ntype SimpleModeler struct {\n\t// contains filtered or unexported fields\n}\n```\nSimpleModeler implements the SystemModeler interface with a timed pod cache.\n\n```go\nfunc NewSimpleModeler(queuedPods, scheduledPods ExtendedPodLister) *SimpleModeler\n```\nNewSimpleModeler returns a new SimpleModeler.\n\n\tqueuedPods: a PodLister that will return pods that have not been scheduled yet.\n\tscheduledPods: a PodLister that will return pods that we know for sure have been scheduled.\n\n```go\nfunc (s *SimpleModeler) AssumePod(pod *api.Pod)\n```\n\n```go\nfunc (s *SimpleModeler) ForgetPod(pod *api.Pod)\n```\n\n```go\nfunc (s *SimpleModeler) ForgetPodByKey(key string)\n```\n\n```go\nfunc (a *SimpleModeler) LockedAction(do func())\n```\nLockedAction serializes calls of whatever is passed as 'do'.\n\n```go\nfunc (s *SimpleModeler) PodLister() algorithm.PodLister\n```\nPodLister returns a PodLister that will list pods that we think we have scheduled in addition to pods that we know have been scheduled.\n\n```go\ntype SystemModeler interface {\n\t// AssumePod assumes that the given pod exists in the system.\n\t// The assumtion should last until the system confirms the\n\t// assumtion or disconfirms it.\n\tAssumePod(pod *api.Pod)\n\t// ForgetPod removes a pod assumtion. (It won't make the model\n\t// show the absence of the given pod if the pod is in the scheduled\n\t// pods list!)\n\tForgetPod(pod *api.Pod)\n\tForgetPodByKey(key string)\n\n\t// For serializing calls to Assume/ForgetPod: imagine you want to add\n\t// a pod iff a bind succeeds, but also remove a pod if it is deleted.\n\t// TODO: if SystemModeler begins modeling things other than pods, this\n\t// should probably be parameterized or specialized for pods.\n\tLockedAction(f func())\n}\n```\nSystemModeler can help scheduler produce a model of the system that anticipates reality. For example, if scheduler has pods A and B both using hostPort 80, when it binds A to machine M it should not bind B to machine M in the time when it hasn't observed the binding of A take effect yet.\n\nSince the model is only an optimization, it's expected to handle any errors itself without sending them back to the scheduler.\n\n","path":"github.com/dockerstack/kubernetes/plugin/pkg/scheduler","name":"scheduler","synopsis":"","isRedistributable":true}
