filter

package
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2016 License: Apache-2.0, CC-BY-SA-4.0 Imports: 9 Imported by: 0

README

Filters README

The Docker Swarm scheduler comes with multiple filters. To read the end-user filters documentation, visit the Swarm API documentation on docs.docker.com. If you want to modify the filter documentation, start with the docs/scheduler directory in this project.

Documentation

Index

Constants

View Source
const (
	// EQ is exported
	EQ = iota
	// NOTEQ is exported
	NOTEQ
)

Variables

View Source
var (
	// ErrNoHealthyNodeAvailable is exported
	ErrNoHealthyNodeAvailable = errors.New("No healthy node available in the cluster")
)
View Source
var (
	// ErrNoNodeWithFreeSlotsAvailable is exported
	ErrNoNodeWithFreeSlotsAvailable = errors.New("No node with enough open slots available in the cluster")
)
View Source
var (

	// ErrNotSupported is exported
	ErrNotSupported = errors.New("filter not supported")
)
View Source
var OPERATORS = []string{"==", "!="}

OPERATORS is exported

Functions

func ApplyFilters

func ApplyFilters(filters []Filter, config *cluster.ContainerConfig, nodes []*node.Node, soft bool) ([]*node.Node, error)

ApplyFilters applies a set of filters in batch.

func List added in v0.2.0

func List() []string

List returns the names of all the available filters

Types

type AffinityFilter

type AffinityFilter struct {
}

AffinityFilter selects only nodes based on other containers on the node.

func (*AffinityFilter) Filter

func (f *AffinityFilter) Filter(config *cluster.ContainerConfig, nodes []*node.Node, soft bool) ([]*node.Node, error)

Filter is exported

func (*AffinityFilter) GetFilters added in v1.2.0

func (f *AffinityFilter) GetFilters(config *cluster.ContainerConfig) ([]string, error)

GetFilters returns a list of the affinities found in the container config.

func (*AffinityFilter) Name added in v0.2.0

func (f *AffinityFilter) Name() string

Name returns the name of the filter

type ConstraintFilter

type ConstraintFilter struct {
}

ConstraintFilter selects only nodes that match certain labels.

func (*ConstraintFilter) Filter

func (f *ConstraintFilter) Filter(config *cluster.ContainerConfig, nodes []*node.Node, soft bool) ([]*node.Node, error)

Filter is exported

func (*ConstraintFilter) GetFilters added in v1.2.0

func (f *ConstraintFilter) GetFilters(config *cluster.ContainerConfig) ([]string, error)

GetFilters returns a list of the constraints found in the container config.

func (*ConstraintFilter) Name added in v0.2.0

func (f *ConstraintFilter) Name() string

Name returns the name of the filter

type DependencyFilter

type DependencyFilter struct {
}

DependencyFilter co-schedules dependent containers on the same node.

func (*DependencyFilter) Filter

func (f *DependencyFilter) Filter(config *cluster.ContainerConfig, nodes []*node.Node, _ bool) ([]*node.Node, error)

Filter is exported

func (*DependencyFilter) GetFilters added in v1.2.0

func (f *DependencyFilter) GetFilters(config *cluster.ContainerConfig) ([]string, error)

GetFilters returns a list of the dependencies found in the container config.

func (*DependencyFilter) Name added in v0.2.0

func (f *DependencyFilter) Name() string

Name returns the name of the filter

func (*DependencyFilter) String

func (f *DependencyFilter) String(config *cluster.ContainerConfig) string

Get a string representation of the dependencies found in the container config.

type Filter

type Filter interface {
	Name() string

	// Return a subset of nodes that were accepted by the filtering policy.
	Filter(*cluster.ContainerConfig, []*node.Node, bool) ([]*node.Node, error)

	// Return a list of constraints/filters provided
	GetFilters(*cluster.ContainerConfig) ([]string, error)
}

Filter is exported

func New

func New(names []string) ([]Filter, error)

New is exported

type HealthFilter

type HealthFilter struct {
}

HealthFilter only schedules containers on healthy nodes.

func (*HealthFilter) Filter

func (f *HealthFilter) Filter(_ *cluster.ContainerConfig, nodes []*node.Node, _ bool) ([]*node.Node, error)

Filter is exported

func (*HealthFilter) GetFilters added in v1.2.0

func (f *HealthFilter) GetFilters(config *cluster.ContainerConfig) ([]string, error)

GetFilters returns

func (*HealthFilter) Name added in v0.2.0

func (f *HealthFilter) Name() string

Name returns the name of the filter

type PortFilter

type PortFilter struct {
}

PortFilter guarantees that, when scheduling a container binding a public port, only nodes that have not already allocated that same port will be considered.

func (*PortFilter) Filter

func (p *PortFilter) Filter(config *cluster.ContainerConfig, nodes []*node.Node, _ bool) ([]*node.Node, error)

Filter is exported

func (*PortFilter) GetFilters added in v1.2.0

func (p *PortFilter) GetFilters(config *cluster.ContainerConfig) ([]string, error)

GetFilters returns a list of the port constraints found in the container config.

func (*PortFilter) Name added in v0.2.0

func (p *PortFilter) Name() string

Name returns the name of the filter

type SlotsFilter added in v1.2.1

type SlotsFilter struct {
}

SlotsFilter only schedules containers with open slots.

func (*SlotsFilter) Filter added in v1.2.1

func (f *SlotsFilter) Filter(_ *cluster.ContainerConfig, nodes []*node.Node, _ bool) ([]*node.Node, error)

Filter is exported

func (*SlotsFilter) GetFilters added in v1.2.1

func (f *SlotsFilter) GetFilters(config *cluster.ContainerConfig) ([]string, error)

GetFilters returns just the info that this node failed, because there where no free slots

func (*SlotsFilter) Name added in v1.2.1

func (f *SlotsFilter) Name() string

Name returns the name of the filter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL