mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-28 02:37:11 +00:00
Merge pull request #1294 from marquiz/devel/feature-file-comments
source/local: support comments in input
This commit is contained in:
commit
35fbbaae99
2 changed files with 8 additions and 0 deletions
|
@ -306,6 +306,7 @@ The hook stdout and feature files are expected to contain features in simple
|
|||
key-value pairs, separated by newlines:
|
||||
|
||||
```plaintext
|
||||
# This is a comment
|
||||
<name>[=<value>]
|
||||
```
|
||||
|
||||
|
@ -313,6 +314,8 @@ The label value defaults to `true`, if not specified.
|
|||
|
||||
Label namespace may be specified with `<namespace>/<name>[=<value>]`.
|
||||
|
||||
Comment lines (starting with `#`) are ignored.
|
||||
|
||||
### Mounts
|
||||
|
||||
The standard NFD deployments contain `hostPath` mounts for
|
||||
|
|
|
@ -150,6 +150,11 @@ func parseFeatures(lines [][]byte) map[string]string {
|
|||
for _, l := range lines {
|
||||
line := strings.TrimSpace(string(l))
|
||||
if len(line) > 0 {
|
||||
// Skip comment lines
|
||||
if strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
|
||||
lineSplit := strings.SplitN(line, "=", 2)
|
||||
|
||||
key := lineSplit[0]
|
||||
|
|
Loading…
Add table
Reference in a new issue