Skip to content

fix: use grep -w for exact IP matching in cluster node configuration#757

Merged
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom
ArangoGutierrez:fix/cluster-node-name-grep
Mar 30, 2026
Merged

fix: use grep -w for exact IP matching in cluster node configuration#757
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom
ArangoGutierrez:fix/cluster-node-name-grep

Conversation

@ArangoGutierrez
Copy link
Copy Markdown
Collaborator

Summary

  • Fix partial IP matching bug in configureNodes() where grep '10.0.1.8' would match both 10.0.1.8 and 10.0.1.81, concatenating two node names with a newline
  • Add -w flag to grep for word-boundary matching on both control-plane and worker node lookups

Root Cause

When a cluster has nodes with similar IP prefixes (e.g., 10.0.1.8 and 10.0.1.81), the grep pattern matches both lines. The variable assignment captures both results with an embedded newline, causing kubectl label node to fail with:

Error from server (NotFound): nodes "ip-10-0-1-8\nip-10-0-1-81" not found

Test plan

  • Cluster E2E test passes (cluster && dedicated label)
  • Existing unit tests pass (go test ./pkg/provisioner/...)

Fixes #756

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>
@ArangoGutierrez ArangoGutierrez merged commit 177a186 into NVIDIA:main Mar 30, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: kubeadm join fails with newline-concatenated node names in cluster mode

1 participant