Feature/taint improvements - #309
Merged
davidB merged 11 commits intoFeb 2, 2026
Merged
Conversation
- Add --exclude-taints CLI parameter to filter nodes by taints - Support comma-separated taint patterns - Add should_exclude_node_by_taint() function for taint matching - Update collect_from_nodes() to apply taint filtering - Support 'any' keyword to exclude all nodes with taints - Update documentation with usage examples 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Change --exclude-taints to accept no values for excluding all nodes with any taints - Remove 'any' special keyword to avoid conflicts with real taint names - Update CLI argument to use num_args = 0.. for optional values - Improve help text to clarify new behavior - Update documentation with new usage examples - Now supports filtering taints named 'any' without conflicts 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…taints - Change exclude_taints parameter from Vec<String> to Option<Vec<String>> - Fix logic to properly distinguish between: unused flag, flag without values, and flag with specific values - When --exclude-taints is used without values, now correctly excludes all nodes with any taints - Update should_exclude_node_by_taint() function to handle Option type correctly - Update collect_from_nodes() function signature to match new parameter type This resolves the issue where --exclude-taints (without values) was not filtering out nodes with taints. 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add 9 new test cases covering all taint filtering scenarios - Test parameter states: unused flag, flag without values, flag with specific values - Test filtering by taint key, key-value pairs, and multiple patterns - Include real-world examples: control-plane taints, dedicated database nodes - Cover edge cases: key-only taints, empty keys, taints named 'any' - Add test helper functions for creating test nodes and taints - All 16 tests pass successfully with full coverage Test scenarios: - should_exclude_node_by_taint_no_flag - should_exclude_node_by_taint_flag_without_values - should_exclude_node_by_taint_specific_key - should_exclude_node_by_taint_key_value_pair - should_exclude_node_by_taint_multiple_patterns - should_exclude_node_by_taint_real_world_examples - should_exclude_node_by_taint_edge_cases - should_exclude_node_by_taint_any_taint_name 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace --exclude-taints with --include-taints parameter - Change default behavior to only show nodes without taints - Update function name from should_exclude_node_by_taint to should_include_node_by_taint - Modify filtering logic to include nodes matching specified taint patterns - When --include-taints is not specified, only untainted nodes are displayed - Update all 9 test cases to reflect new behavior and expectations - Add test cases to verify default behavior (only untainted nodes) - Support multiple taint patterns with comma-separated list Behavior changes: - Default: Show only untainted nodes - --include-taints key: Show nodes with specific taint key - --include-taints key=value: Show nodes with specific taint key-value pair - --include-taints pattern1,pattern2: Show nodes matching any pattern This makes the tool more user-friendly by defaulting to showing only usable nodes. 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…emantics - Rename parameter from --include-taints to --ignore-taints for clearer semantics - Update logic to include nodes without taints + nodes with ignored taints (exclude others) - Fix three-state behavior: * No flag: only show nodes without taints * --ignore-taints (no values): show all nodes (ignore all taints) * --ignore-taints taint1,taint2: show untainted nodes + nodes with specified taints - Update function signature and all 9 test cases to match new behavior - This resolves semantic conflict with --selector and provides more intuitive filtering Behavior changes: - Default: Only untainted nodes (workload nodes) - --ignore-taints: All nodes (including control-plane) - --ignore-taints pattern: Untainted + nodes with ignored taints Examples: - kubectl-view-allocations # Show only workload nodes - kubectl-view-allocations --ignore-taints # Show all nodes - kubectl-view-allocations --ignore-taints node-role.kubernetes.io/control-plane # Show workload + control-plane nodes 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…avior - Replace all --exclude-taints examples with --ignore-taints - Update examples to show three-state behavior (no flag/no values/with values) - Add common use cases section with practical examples - Clarify that default behavior shows only workload nodes (no taints) - Explain semantic differences from --selector parameter - Include real-world scenarios like workload + control-plane combinations Documentation now matches the implemented behavior: - Default: Show only untainted nodes (workload nodes) - --ignore-taints: Show all nodes - --ignore-taints taint1,taint2: Show untainted + nodes with ignored taints 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Owner
|
Good idea, thanks for the PR. Can you also update the README? |
Contributor
Author
Sure I will. I've been using this modified version locally to see if there is any bug. I will check the ci and undraft this pr later when I am ready. Thanks! |
lwabish
marked this pull request as ready for review
January 30, 2026 10:04
Contributor
Author
|
@davidB Hi, readme updated, PTAL, thanks |
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.
This PR adds a new
--ignore-taintsparameter with improved default behavior that shows only untainted nodes, making the tool more user-friendly for resource monitoring.Current Behavior Issues:
Key Improvement:
New Functionality:
kubectl-view-allocations- Default: Show only untainted nodes (workload nodes) ⭐ NEWkubectl-view-allocations --ignore-taints- Show all nodes (ignore all taints)kubectl-view-allocations --ignore-taints taint1,taint2- Show untainted nodes + nodes with specific ignored taintsUse Cases:
Benefits:
--selectorThe implementation includes comprehensive unit tests and maintains backward compatibility with existing functionality.