1
0
Fork 0
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:
Kubernetes Prow Robot 2023-08-04 07:58:21 -07:00 committed by GitHub
commit 35fbbaae99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -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]