Skip to content

feat: glob ignores for workload checks#160

Merged
bryantbiggs merged 16 commits into
mainfrom
feat/glob-ignores
May 25, 2026
Merged

feat: glob ignores for workload checks#160
bryantbiggs merged 16 commits into
mainfrom
feat/glob-ignores

Conversation

@bryantbiggs
Copy link
Copy Markdown
Member

Summary

Expands the .eksup.yaml ignore mechanism in two ways: glob patterns on name/namespace selectors, and coverage of all 8 workload-level checks (was 2). Resolves #157.

  • Globs everywhere: name: "foo-*", namespace: "*-dev*", brace expansion ({a,b}), character classes ([abc]) — anywhere a name+namespace selector is accepted. Backward-compatible: literal strings still work as exact-match.
  • 8 workload checks support ignore (was 2): K8S002, K8S003, K8S004, K8S005, K8S006, K8S007, K8S008, K8S013. Cluster-level checks (AWS001-005, EKS001-010, K8S001, K8S009, K8S010, K8S011, K8S012) deliberately don't support name/namespace ignore — their findings flag the cluster as a whole.
  • checks.all block for cross-cutting rules (e.g., suppress everything in *-dev* namespaces).
  • --show-suppressed CLI flag exposes what config has hidden — addresses the silent-suppression risk that scales badly with glob ignores. Tabular output shows a footer count by default; the flag renders the full table inline.
  • JSON output always includes a suppressed: top-level key for machine introspection (#[serde(rename = "suppressed")] on Results.kubernetes_suppressed).
  • K8S002 refactored to use a single ignore pipeline: was pre-construction filter on ignore + per-resource override threshold; now threshold_for returns just the threshold and the post-construction filter handles ignore.
  • K8s004Config removed — collapsed into shared WorkloadCheckConfig.

Out of scope (called out in issue reply): regex, label selectors, severity overrides, cluster-level check disable. No version bump (per project convention).

Test plan

  • cargo +nightly fmt --all --check passes
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • cargo test --all passes — 241 tests including ~20 new (8 filter tests, glob compile tests, threshold_for tests, k8s012 rejection test, suppressed total test)
  • cargo xtask generate-all --check passes
  • Backward-compat: existing literal-only .eksup.yaml configs parse and behave identically
  • --show-suppressed flag visible in eksup analyze --help and eksup create playbook --help
  • Runtime output of eksup completion <shell> matches committed completions/* byte-for-byte (verified via diff)
  • Invalid glob in config rejected at load with file-path-aware error message
  • Smoke test: fixture .eksup.yaml with checks.all + per-check globs parses cleanly (failure is at AWS auth, not at config)
  • CI green on this PR

🤖 Generated with Claude Code

bryantbiggs and others added 16 commits May 24, 2026 21:04
Two small follow-ups from code review on Batch A:
- Doc comment on ChecksConfig listing the four places a new workload check
  must be added (struct, Clone impl, build_compiled tuple, WorkloadFinding
  impl). Compiler doesn't catch missing Clone or build_compiled additions.
- Rename validate_compiles_globs_lazily_and_errors_on_invalid →
  validate_rejects_invalid_globs. validate() eagerly calls compiled(); the
  "lazily" in the old name actively misleads readers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…t test

Two follow-ups from Batch B code review:
- integration.rs: post-Task-6, ignored K8S002 findings are constructed then
  dropped to the suppressed bucket. Tighten the assertion from `let _ = ...`
  to assert_eq!(suppressed.min_replicas.len(), 1).
- findings.rs: trivial default-state test for KubernetesSuppressed::total()
  — load-bearing in Batch D's output gating.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…essed

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…with --show-suppressed

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The hand-copied --help blocks at the top of analyze and create playbook
sections didn't list the new flag. Updated to match runtime output.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bryantbiggs bryantbiggs merged commit f94d64d into main May 25, 2026
7 checks passed
@bryantbiggs bryantbiggs deleted the feat/glob-ignores branch May 25, 2026 13:14
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.

Feature request: Flexible .eksup.yaml ignores (globs + all checks)

1 participant