Skip to content

Commit

Permalink
label templates: document Random vars are rendered once (#370)
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Giudici <[email protected]>
  • Loading branch information
fgiudici authored Aug 30, 2024
1 parent 2721f2b commit b70d808
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/label-templates-random.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ They allow to include random `Int`, `Hex` or `UUID` values in custom [label temp

The values are computed on the fly during the `label template variables` rendering.

:::info Random label templates are rendered only once

A label template containing a Random variable is rendered only if the
[MachineInventory](machineinventory-reference) of the registering
host doesn't have a value for that label yet (a label with the same key is missing or its value is empty).

So, the three cases in which a label template with a Random variable is rendered are:
1. the host is registering for the first time and the [MachineInventory](machineinventory-reference) is created anew
2. the label template has been added to the MachineRegistration after the host (re-)registered last time
3. the [MachineInventory](machineinventory-reference) label matching the label template (same label key) has been manually removed
or its value has been cleared out
:::

| Variable | Description |
| ---------------------------------------- | --------------------------------------------------------------------- |
| `${Random/UUID}` | random UUID (e.g., fd95324a-c26b-4e28-8727-1dcec293a0ec) |
Expand Down

0 comments on commit b70d808

Please sign in to comment.