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.
Fix NodeSelector kubernetes.io/hostname Reliability Issue
Summary
Fixes #173 - Replaces unreliable
kubernetes.io/hostnamelabel-based node selection with directmetadata.namefield selector to ensure trace jobs are always scheduled on the correct node, particularly important for AWS and other cloud providers where NodeName may be fully qualified while hostname label is not.Problem
The kubectl-trace tool was using the
kubernetes.io/hostnamelabel for node selection in trace jobs. This approach is unreliable because:ip-10-0-1-123.ec2.internal) while thekubernetes.io/hostnamelabel contains only the short hostname (e.g.,ip-10-0-1-123)This results in trace jobs failing to schedule because the NodeSelector doesn't match any available nodes.
Solution
The fix replaces the unreliable
kubernetes.io/hostnamelabel-based node selection with direct node name matching usingmetadata.namefield selector. This ensures that trace jobs are always scheduled on the correct node regardless of hostname label configuration.Key Changes
MatchFieldswithmetadata.nameinstead ofMatchExpressionswithkubernetes.io/hostnamenode.Namedirectly instead of looking up hostname labeljobHostnamefunction to support both new and old approaches