Labels and label selectors
Assign labels to Red Hat Edge Manager resources, including devices and fleets, to record location, hardware type, or purpose. Red Hat Edge Manager labels follow the same syntax, principles, and operators as Kubernetes labels and label selectors.
You can select devices with labels when viewing the device inventory or applying operations to the devices.
Labels follow the key=value format, where you want to use the key to group devices. For example, if your labels follow the site=<location> naming convention, you can group your devices by site.
You can also use labels that only consist of keys.
Labels must adhere to the following rules to be valid:
- Keys and value must each be 63 characters or less.
- Keys and values can consist of alphanumeric characters (
a-z,A-Z,0-9). - Keys and values can also contain dashes (
-), underscores (_), dots (.) but not as the first or last character. - Value can be omitted.
You can apply labels to resources in the following ways:
- Define a set of default labels during image building that are automatically applied to all devices during deployment.
- Assign initial labels during enrollment, including the device
aliaslabel. For more information, see Device alias and enrollment labels in the Additional resources section. - Assign labels post-enrollment.
The device alias label
The alias label provides a human-readable name for a device.
The Flight Control CLI and web console display this value in the ALIAS column.
The alias is distinct from the device name (metadata.name), which the agent generates and cannot be changed.
By default, the agent sets alias from the device hostname at enrollment unless you map alias from another system information field in the agent configuration. For system information collection and label mapping, see Reporting system information from the agent and Device alias and enrollment labels in the Additional resources section.
You can change the alias label after enrollment by using the same procedures as other device labels.
The alias value must follow the Kubernetes label rules described in the following sections.
When resources are labeled, you can select a subset of resources by writing a label selector. A label selector is a comma-separated list of labels for selecting resources that have the same set of labels.
See the following examples:
| Example label selector | Selected devices |
|---|---|
|
|
All devices with a |
|
|
All devices with a |
|
|
All devices with a |
For more information, see Labels and Selectors in the Additional resources section.