spread

package
v0.0.0-...-a355528 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPlugin

func NewPlugin(plugins func() discovery.Plugins, choices selector.Options) instance.Plugin

NewPlugin returns an instance plugin that implements this algorithm

func SelectOne

func SelectOne(spec instance.Spec, choices []selector.Choice,
	lookup func(selector.Choice) instance.Plugin) (match selector.Choice, err error)

SelectOne selects one of the choices given choices and a context (the spec). It can optionally use the lookup to perform queries on the instance plugin to arrive at a decision. In the case of spread affinity, we pick the instance plugin that reports the least number of instances.

Types

type AffinityArgs

type AffinityArgs struct {
	// Labels are the labels to use to filter the query to the instance plugin associated with this Choice.
	Labels map[string]string
}

AffinityArgs is the struct that contains parameters that are important for this algorithm to work. Because this algorithm dependes on querying the plugins for the instances, we need to know what labels to use for filtering. The labels should match those that are generated by the group controller so that we can at least have the same representation in this as how the group controller sees the world. TODO - we can reference the group this plugin is to be used with. However, we'd have to introduce a query mechanism for this plugin to query for information about the group. Alternatively, we can also have the labels be dynamically populated by the launcher of the plugin, which would at that time have information on the labels to use.

Jump to

Keyboard shortcuts

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