Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.