// SelectNodeForContainer will find a nice home for our container.
func (s *Scheduler) SelectNodeForContainer(nodes []*node.Node, config *cluster.ContainerConfig) (*node.Node, error) {
	accepted, err := filter.ApplyFilters(s.filters, config, nodes)
	if err != nil {
		return nil, err
	}

	return s.strategy.PlaceContainer(config, accepted)
}
Beispiel #2
0
// Find a nice home for our container.
func (s *Scheduler) selectNodeForContainer(config *dockerclient.ContainerConfig) (*cluster.Node, error) {
	candidates := s.cluster.Nodes()

	accepted, err := filter.ApplyFilters(s.filters, config, candidates)
	if err != nil {
		return nil, err
	}

	return s.strategy.PlaceContainer(config, accepted)
}
Beispiel #3
0
// SelectNodesForContainer will return a list of nodes where the container can
// be scheduled, sorted by order or preference.
func (s *Scheduler) SelectNodesForContainer(nodes []*node.Node, config *cluster.ContainerConfig) ([]*node.Node, error) {
	accepted, err := filter.ApplyFilters(s.filters, config, nodes)
	if err != nil {
		return nil, err
	}

	if len(accepted) == 0 {
		return nil, errNoNodeAvailable
	}

	return s.strategy.RankAndSort(config, accepted)
}