Skip to content

Commit 4baf48d

Browse files
committed
Draft README-extensions.md
1 parent 158b02a commit 4baf48d

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

README-extensions.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# reclass-rs Extensions
2+
3+
Initially, reclass-rs only implemented features present in [kapicorp-reclass], including extensions introduced by kapicorp-reclass.
4+
This document covers extensions that are currently unique to reclass-rs.
5+
6+
## Non-compatible `compose_node_name` option
7+
8+
Reclass-rs supports the `compose_node_name` option.
9+
By default, in contrast to kapicorp-reclass, reclass-rs preserves literal dots in composed node names.
10+
For example, given the following inventory, the node's internal path is parsed as `['path', 'to', 'the.node']`:
11+
12+
```
13+
.
14+
├── classes
15+
│   ├── cls1.yml
16+
│   └── cls2.yml
17+
└── nodes
18+
└── path
19+
└── to
20+
└── the.node.yml
21+
```
22+
23+
However, optionally, reclass-rs can be configured to handle `compose_node_name` the same way that kapicorp-reclass does, by naively splitting node names on each dot.
24+
To enable this compatibility mode, set `compat_flags: ['ComposeNodeNameLiteralDots']` in your inventory's `reclass-config.yml`.
25+
In compatibility mode, the node's internal path for the previous inventory is `['path', 'to', 'the', 'node']`.
26+
27+
## Default values for references
28+
29+
> [!INFO]
30+
> This feature is currently experimental and may change at any time.
31+
32+
Reclass-rs supports specifying default (fallback) values for references.
33+
The format for specifying a default value is `${some:reference:path::the_default_value}`.
34+
We chose `::` as the separator between the reference path and the default value, because `::` can't appear in references in valid kapicorp-reclass inventories (due to [kapicorp/kapitan#1171](https://github.com/kapicorp/kapitan/issues/1171)).
35+
Reclass-rs first resolves nested references in the reference path and default value and then splits the reference contents into the path and default value.
36+
References with default values can be used everywhere that references are supported, including class includes.
37+
38+
> [!NOTE]
39+
> Currently, default values are only applied once all nested references have been successfully resolved.
40+
> A missing nested reference without its own default value will result in an error even if the top-level reference specifies a default value.
41+
42+
For further processing, the default value is parsed as YAML.
43+
Incomplete YAML flow values will be raised as errors.
44+
45+
> [!NOTE]
46+
> While it's generally possible to specify arbitrarily complex YAML default values inline, we recommend specifying complex default values through a nested reference.
47+
> When providing complex default values inline, it may be necessary to carefully escape characters of the YAML value in order to ensure the reference parser keeps the YAML value intact.
48+
49+
[kapicorp-reclass]: https://github.com/kapicorp/reclass

0 commit comments

Comments
 (0)