Repository navigation
Conversation
sanitise() kept a leading or trailing '-', '.' or '_', so DMI product names such as "ThinkSystem SR650 -[7X06CTO1WW]-" and "To Be Filled By O.E.M." produced nvidia.com/gpu.machine values that are not valid Kubernetes label values and are dropped by NFD. Trim those characters after joining the words. Values that were already valid are unchanged. Signed-off-by: Dezhen Lu <dezhen.lu@student.uni-tuebingen.de>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Fixes #2172
Description
sanitise()ininternal/lm/resource.goturns the DMI product name into thenvidia.com/gpu.machinelabel value (and is also used for the*.productvalues). It removes invalid characters and joins words with-, but it keeps a leading or trailing-,.or_. Kubernetes label values must start and end with an alphanumeric character, so product names such asThinkSystem SR650 -[7X06CTO1WW]-(first-generation Lenovo ThinkSystem servers) andTo Be Filled By O.E.M.(common AMI BIOS default) produceThinkSystem-SR650--7X06CTO1WW-andTo-Be-Filled-By-O.E.M., which NFD rejects, leaving the node without annvidia.com/gpu.machinelabel.This change trims
-,_and.from both ends of the sanitised value. Values that were already valid are unchanged. The 63-character limit for product labels (#1876) is out of scope.Checklist
make lint)make test)make check-modules)make check-third-party-notices)Testing
TestSanitise.TestMachineTypeLabeler, which writes a product name to a temp file, builds the labeler withnewMachineTypeLabelerand checks the value withk8s.io/apimachinery/pkg/util/validation.IsValidLabelValue(PowerEdge XE9680is the control case).go test ./internal/lm/ -run 'TestSanitise|TestMachineTypeLabeler': fails on main (3TestSanitisecases, 2TestMachineTypeLabelercases), passes with this change.go test ./internal/... ./api/... ./cmd/gpu-feature-discovery/...passes.This change was drafted with Claude Code (claude-opus-5-5); the test results above are from the runs described.