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 #402 from marquiz/fixes/kernel-version-sanitize

kernel: more agressively sanitize full kernel version
This commit is contained in:
Kubernetes Prow Robot 2020-11-23 09:57:34 -08:00 committed by GitHub
commit 9b8451209c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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