fix: use grep -w for exact IP matching in cluster node configuration#757
Merged
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom Mar 30, 2026
Merged
Conversation
When configuring cluster nodes, the grep command used to find node names by private IP would match IP prefixes as substrings (e.g., 10.0.1.8 matching 10.0.1.81), concatenating multiple node names with a newline. This caused kubectl to fail with "nodes not found" for the combined string. Add -w flag to grep for word-boundary matching, ensuring each IP matches only its exact occurrence in kubectl output. Fixes NVIDIA#756 Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Closed
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.
Summary
configureNodes()wheregrep '10.0.1.8'would match both10.0.1.8and10.0.1.81, concatenating two node names with a newline-wflag to grep for word-boundary matching on both control-plane and worker node lookupsRoot Cause
When a cluster has nodes with similar IP prefixes (e.g.,
10.0.1.8and10.0.1.81), the grep pattern matches both lines. The variable assignment captures both results with an embedded newline, causingkubectl label nodeto fail with:Test plan
cluster && dedicatedlabel)go test ./pkg/provisioner/...)Fixes #756