mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-28 02:37:11 +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 (
|
||||
"log"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/node-feature-discovery/source"
|
||||
"sigs.k8s.io/node-feature-discovery/source/internal/kernelutils"
|
||||
|
@ -114,6 +115,8 @@ func parseVersion() (map[string]string, error) {
|
|||
// Replace forbidden symbols
|
||||
fullRegex := regexp.MustCompile("[^-A-Za-z0-9_.]")
|
||||
full = fullRegex.ReplaceAllString(full, "_")
|
||||
// Label values must start and end with an alphanumeric
|
||||
full = strings.Trim(full, "-_.")
|
||||
|
||||
version["full"] = full
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue