mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-04-07 17:43:59 +00:00
Merge pull request #402 from marquiz/fixes/kernel-version-sanitize
kernel: more agressively sanitize full kernel version
This commit is contained in:
commit
9b8451209c
1 changed files with 3 additions and 0 deletions
|
@ -19,6 +19,7 @@ package kernel
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"sigs.k8s.io/node-feature-discovery/source"
|
"sigs.k8s.io/node-feature-discovery/source"
|
||||||
"sigs.k8s.io/node-feature-discovery/source/internal/kernelutils"
|
"sigs.k8s.io/node-feature-discovery/source/internal/kernelutils"
|
||||||
|
@ -114,6 +115,8 @@ func parseVersion() (map[string]string, error) {
|
||||||
// Replace forbidden symbols
|
// Replace forbidden symbols
|
||||||
fullRegex := regexp.MustCompile("[^-A-Za-z0-9_.]")
|
fullRegex := regexp.MustCompile("[^-A-Za-z0-9_.]")
|
||||||
full = fullRegex.ReplaceAllString(full, "_")
|
full = fullRegex.ReplaceAllString(full, "_")
|
||||||
|
// Label values must start and end with an alphanumeric
|
||||||
|
full = strings.Trim(full, "-_.")
|
||||||
|
|
||||||
version["full"] = full
|
version["full"] = full
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue