{"modulePath":"github.com/dockerstack/kubernetes","version":"v0.20.1-0.20150627061651-1c0b765df6da","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package factory\n\nPackage factory can set up a scheduler. This code is here instead of plugin/cmd/scheduler for both testability and reuse.\n\n## Constants\n\n```go\nconst (\n\tBindPodsQps   = 15\n\tBindPodsBurst = 20\n)\n```\nRate limitations for binding pods to hosts. TODO: expose these as cmd line flags.\n\n```go\nconst (\n\tDefaultProvider = \"DefaultProvider\"\n)\n```\n\n## Functions\n\n```go\nfunc IsFitPredicateRegistered(name string) bool\n```\nThis check is useful for testing providers.\n\n```go\nfunc IsPriorityFunctionRegistered(name string) bool\n```\nThis check is useful for testing providers.\n\n```go\nfunc ListAlgorithmProviders() string\n```\nListAlgorithmProviders is called when listing all available algortihm providers in \\`kube-scheduler --help\\`\n\n```go\nfunc RegisterAlgorithmProvider(name string, predicateKeys, priorityKeys util.StringSet) string\n```\nRegisters a new algorithm provider with the algorithm registry. This should be called from the init function in a provider plugin.\n\n```go\nfunc RegisterCustomFitPredicate(policy schedulerapi.PredicatePolicy) string\n```\nRegisters a custom fit predicate with the algorithm registry. Returns the name, with which the predicate was registered.\n\n```go\nfunc RegisterCustomPriorityFunction(policy schedulerapi.PriorityPolicy) string\n```\nRegisters a custom priority function with the algorithm registry. Returns the name, with which the priority function was registered.\n\n```go\nfunc RegisterFitPredicate(name string, predicate algorithm.FitPredicate) string\n```\nRegisterFitPredicate registers a fit predicate with the algorithm registry. Returns the name with which the predicate was registered.\n\n```go\nfunc RegisterFitPredicateFactory(name string, predicateFactory FitPredicateFactory) string\n```\nRegisterFitPredicateFactory registers a fit predicate factory with the algorithm registry. Returns the name with which the predicate was registered.\n\n```go\nfunc RegisterPriorityConfigFactory(name string, pcf PriorityConfigFactory) string\n```\n\n```go\nfunc RegisterPriorityFunction(name string, function algorithm.PriorityFunction, weight int) string\n```\nRegisters a priority function with the algorithm registry. Returns the name, with which the function was registered.\n\n## Types\n\n```go\ntype AlgorithmProviderConfig struct {\n\tFitPredicateKeys     util.StringSet\n\tPriorityFunctionKeys util.StringSet\n}\n```\n\n```go\nfunc GetAlgorithmProvider(name string) (*AlgorithmProviderConfig, error)\n```\nThis function should not be used to modify providers. It is publicly visible for testing.\n\n```go\ntype ConfigFactory struct {\n\tClient *client.Client\n\t// queue for pods that need scheduling\n\tPodQueue *cache.FIFO\n\t// a means to list all known scheduled pods.\n\tScheduledPodLister *cache.StoreToPodLister\n\t// a means to list all known scheduled pods and pods assumed to have been scheduled.\n\tPodLister algorithm.PodLister\n\t// a means to list all minions\n\tNodeLister *cache.StoreToNodeLister\n\t// a means to list all services\n\tServiceLister *cache.StoreToServiceLister\n\n\t// Close this to stop all reflectors\n\tStopEverything chan struct{}\n\t// Rate limiter for binding pods\n\tBindPodsRateLimiter util.RateLimiter\n\t// contains filtered or unexported fields\n}\n```\nConfigFactory knows how to fill out a scheduler config with its support functions.\n\n```go\nfunc NewConfigFactory(client *client.Client) *ConfigFactory\n```\nInitializes the factory.\n\n```go\nfunc (f *ConfigFactory) Create() (*scheduler.Config, error)\n```\nCreate creates a scheduler with the default algorithm provider.\n\n```go\nfunc (f *ConfigFactory) CreateFromConfig(policy schedulerapi.Policy) (*scheduler.Config, error)\n```\nCreates a scheduler from the configuration file\n\n```go\nfunc (f *ConfigFactory) CreateFromKeys(predicateKeys, priorityKeys util.StringSet) (*scheduler.Config, error)\n```\nCreates a scheduler from a set of registered fit predicate keys and priority keys.\n\n```go\nfunc (f *ConfigFactory) CreateFromProvider(providerName string) (*scheduler.Config, error)\n```\nCreates a scheduler from the name of a registered algorithm provider.\n\n```go\ntype FitPredicateFactory func(PluginFactoryArgs) algorithm.FitPredicate\n```\nA FitPredicateFactory produces a FitPredicate from the given args.\n\n```go\ntype PluginFactoryArgs struct {\n\talgorithm.PodLister\n\talgorithm.ServiceLister\n\tNodeLister algorithm.MinionLister\n\tNodeInfo   predicates.NodeInfo\n}\n```\nPluginFactoryArgs are passed to all plugin factory functions.\n\n```go\ntype PriorityConfigFactory struct {\n\tFunction PriorityFunctionFactory\n\tWeight   int\n}\n```\nA PriorityConfigFactory produces a PriorityConfig from the given function and weight\n\n```go\ntype PriorityFunctionFactory func(PluginFactoryArgs) algorithm.PriorityFunction\n```\nA PriorityFunctionFactory produces a PriorityConfig from the given args.\n\n","path":"github.com/dockerstack/kubernetes/plugin/pkg/scheduler/factory","name":"factory","synopsis":"Package factory can set up a scheduler.","isRedistributable":true}
