Skip to main content
Version: 1.4

MachineInventorySelectorTemplate reference

The MachineInventorySelectorTemplate is the resource responsible of defining the matching criteria to pair an inventoried machine with a Cluster resource.

The relevant key is the selector which includes label selector expressions.

MachineInventorySelectorTemplate
apiVersion: elemental.cattle.io/v1beta1
kind: MachineInventorySelectorTemplate
metadata:
name: my-machine-selector
namespace: fleet-default
spec:
template:
spec:
selector:
...

template.spec.selector can include matchLabels and or matchExpressions keys.

template.spec.selector.matchLabels​

It is a map of {key,value} pairs (map[string]string). When multiple labels are provided all labels must match.

Example
...
spec:
template:
spec:
selector:
matchLabels:
element: fire
manufacturer: somevalue

A Cluster defined with the above selector will only attempt to provision nodes inventoried including these two labels.

template.spec.selector.matchExpressions​

It is a list of label selectors, each label selectors can be defined as:

KeyTypeDescription
keystringThis is the label key the selector applies on
operatorstringRepresents the relationship of the key to a set of values. Valid operators are 'In', 'NotIn', 'Exists' and 'DoesNotExist'
values[]stringValues is an array of string values. If the operator is 'In' or 'NotIn', the values array must be non-empty. If the operator is 'Exists' or 'DoesNotExist', the values array must be empty
Example
...
spec:
template:
spec:
selector:
matchExpressions:
- key: element
operator: In
values: [ 'fire' ]
- key: manufacturer
operator: Exists

A Cluster defined with the above selector will only attempt to provision nodes inventoried with the element=fire label and including a manufacturer label defined with any value.