Skip to content

NE-2279: Add must-gather offline support for NIDS toolset - #362

Open
bentito wants to merge 8 commits into
openshift:mainfrom
bentito:feature/nids-must-gather-offline
Open

NE-2279: Add must-gather offline support for NIDS toolset#362
bentito wants to merge 8 commits into
openshift:mainfrom
bentito:feature/nids-must-gather-offline

Conversation

@bentito

@bentito bentito commented Jun 25, 2026

Copy link
Copy Markdown

Purpose

This PR adds offline must-gather support for the NIDS toolset. It enables users (like support and QE engineers) to perform static diagnostics against must-gather archives without requiring a live-cluster connection. Specifically, the following 3 tools have been modified to support must-gather offline mode:

  1. inspect_route
  2. get_coredns_config
  3. get_service_endpoints

Changes

  1. Export Must-Gather Provider: Changed package-private getProvider to exported GetProvider() in pkg/toolsets/mustgather/helpers.go so that other toolsets (e.g. netedge / NIDS) can access the loaded must-gather data structure.
  2. Offline Support for inspect_route: Updated inspectRoute in pkg/toolsets/netedge/routes.go to search for resources inside the must-gather provider first. Falls back to the dynamic client for live-cluster access only if no offline provider is active.
  3. Offline Support for get_coredns_config: Updated get_coredns_config in pkg/toolsets/netedge/coredns.go to support offline querying.
  4. Offline Support for get_service_endpoints: Updated get_service_endpoints in pkg/toolsets/netedge/endpoints.go to support offline querying.
  5. Offline Evals: Added offline-specific mcpchecker task definitions (inspect_route/offline.yaml, get-coredns-config/offline.yaml, and get_service_endpoints/offline.yaml) alongside their mock must-gather data structures.

Co-authored-by: gemini and bentito

Summary by CodeRabbit

  • New Features
    • Added offline evaluation tasks for inspecting routes, service endpoints, and CoreDNS config from must-gather archives.
    • Extended bundled must-gather sample data to cover routes, endpoint slices, DNS config, and supporting metadata for more realistic offline results.
  • Bug Fixes
    • Network-edge inspection now prefers archived data when available and falls back to live cluster lookups when not.
  • Chores
    • Updated the evaluation runner to support netedge suite selection and adjusted local server tooling (health check endpoint now uses /healthz).

@openshift-ci-robot

openshift-ci-robot commented Jun 25, 2026

Copy link
Copy Markdown

@bentito: This pull request references NE-2279 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Purpose

This PR adds offline must-gather support for the NIDS toolset, starting with inspect_route and get_coredns_config as part of the initial phase. It enables users (like support and QE engineers) to perform static diagnostics against must-gather archives without requiring a live-cluster connection.

Changes

  1. Export Must-Gather Provider: Changed package-private getProvider to exported GetProvider() in pkg/toolsets/mustgather/helpers.go so that other toolsets (e.g. netedge / NIDS) can access the loaded must-gather data structure.
  2. Offline Support for inspect_route: Updated inspectRoute in pkg/toolsets/netedge/routes.go to search for resources inside the must-gather provider first. Falls back to the dynamic client for live-cluster access only if no offline provider is active.
  3. Offline Support for get_coredns_config: Updated get_coredns_config in pkg/toolsets/netedge/coredns.go to support offline querying.
  4. Offline Evals: Added offline-specific mcpchecker task definitions (inspect_route/offline.yaml and get-coredns-config/offline.yaml) alongside their mock must-gather data structures.

Co-authored-by: gemini and bentito

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@bentito, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 25 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8ccadf4f-530d-491e-b114-075cceedb8f3

📥 Commits

Reviewing files that changed from the base of the PR and between a724046 and 4a17c89.

📒 Files selected for processing (27)
  • .github/workflows/mcpchecker.yaml
  • build/evals.mk
  • evals/claude-code/agent.yaml
  • evals/claude-code/eval.yaml
  • evals/core-eval-testing/acp-anthropic/eval-netedge.yaml
  • evals/core-eval-testing/acp-google/eval-netedge.yaml
  • evals/core-eval-testing/builtin-anthropic/eval-netedge.yaml
  • evals/core-eval-testing/builtin-google/eval-netedge.yaml
  • evals/core-eval-testing/builtin-openai/eval-netedge.yaml
  • evals/gemini-agent/agent.yaml
  • evals/gemini-agent/eval.yaml
  • evals/openai-agent/agent.yaml
  • evals/openai-agent/eval.yaml
  • evals/tasks/kubevirt/claude-code/eval.yaml
  • evals/tasks/kubevirt/openai-agent/eval.yaml
  • evals/tasks/netedge/get-coredns-config/offline.yaml
  • evals/tasks/netedge/get-coredns-config/task.yaml
  • evals/tasks/netedge/get-router-config/task.yaml
  • evals/tasks/netedge/get-router-info/task.yaml
  • evals/tasks/netedge/get-router-sessions/task.yaml
  • evals/tasks/netedge/get_service_endpoints/offline.yaml
  • evals/tasks/netedge/get_service_endpoints/task.yaml
  • evals/tasks/netedge/inspect_route/offline.yaml
  • evals/tasks/netedge/inspect_route/task.yaml
  • evals/tasks/netedge/probe_dns_local/task.yaml
  • evals/tasks/netedge/probe_http/task.yaml
  • evals/tasks/netedge/query_prometheus/task.yaml
📝 Walkthrough

Walkthrough

The PR adds netedge evaluation configurations, offline must-gather tasks and fixtures, exported provider access, and must-gather fallbacks for CoreDNS, EndpointSlice, and Route lookups.

Changes

Netedge evaluation selection and execution

Layer / File(s) Summary
Evaluation configurations and suite wiring
evals/core-eval-testing/*/eval-netedge.yaml, .github/workflows/mcpchecker.yaml, build/evals.mk, evals/gemini-agent/agent.yaml
Adds netedge eval configurations, dynamic suite selection, ACP setup, and updated evaluation/server wiring; removes the Gemini ACP stanza.
Offline tasks and fixtures
evals/tasks/netedge/*, evals/testdata/must-gather/*
Adds offline CoreDNS, service endpoint, and route tasks, labels netedge tasks, and supplies matching must-gather resources and metadata.
Must-gather provider access
pkg/toolsets/mustgather/helpers.go, pkg/toolsets/mustgather/{etcd,events,mcp_resources,monitoring,nodes,pod_logs,resources}.go
Exports GetProvider() and updates must-gather handlers to use it without changing their downstream processing.
Netedge archive lookups and validation
pkg/toolsets/netedge/{coredns,endpoints,routes}.go, pkg/toolsets/mustgather/eval_offline_test.go
Netedge handlers prefer must-gather resources and fall back to the dynamic client; the offline test loads an archive and invokes get_service_endpoints.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Task
  participant NetedgeTool
  participant MustGather
  participant Archive
  participant DynamicClient

  Task->>NetedgeTool: Invoke netedge lookup
  NetedgeTool->>MustGather: GetProvider()
  alt Provider available
    MustGather-->>NetedgeTool: Provider
    NetedgeTool->>Archive: Read or list resource
    Archive-->>NetedgeTool: Resource data
  else Provider unavailable
    MustGather-->>NetedgeTool: Error
    NetedgeTool->>DynamicClient: Get or list resource
    DynamicClient-->>NetedgeTool: Resource data
  end
  NetedgeTool-->>Task: Formatted result
Loading

Suggested reviewers: manusa, cali0707, kaustubh-pande, matzew

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.89% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main change: adding must-gather offline support for the NIDS/netedge toolset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from Kaustubh-pande and matzew June 25, 2026 20:52
@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bentito
Once this PR has been reviewed and has the lgtm label, please assign matzew for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
pkg/toolsets/netedge/coredns.go (1)

43-57: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Logic is correct; consider extracting the duplicated must-gather gating boilerplate.

The if p, mgErr := mustgather.GetProvider(); mgErr == nil && p != nil { ... } else { dynamic client } pattern is now repeated nearly verbatim in coredns.go, endpoints.go, and routes.go. A small helper (e.g. mustgather.LoadedProvider() (*mg.Provider, bool)) would centralize the gate and keep the three handlers consistent if the contract changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/toolsets/netedge/coredns.go` around lines 43 - 57, The must-gather
provider check is duplicated across CoreDNS-related handlers, so extract the
repeated gating logic into a shared helper to keep the behavior consistent. Add
a small helper around mustgather.GetProvider (for example in the netedge
package) that returns the loaded provider and a boolean, then update coredns.go
and the matching handlers in endpoints.go and routes.go to use it instead of
inlining the same if/else pattern. Keep the existing behavior in CoreDNSHandler
and related lookup paths unchanged while centralizing the must-gather fallback
decision.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@evals/tasks/netedge/inspect_route/offline.yaml`:
- Around line 7-10: The offline verification is too weak because contains:
"console" can be satisfied by the prompt itself instead of the must-gather data.
Update the verify section in the offline task to assert on a route-specific
value from the fixture, such as the OpenShift console route host or TLS
termination type like reencrypt, so the check proves the answer was derived from
the offline data. Keep the existing mustgather_use flow and target the route
fields referenced by the task description.

In `@pkg/toolsets/mustgather/eval_offline_test.go`:
- Around line 23-24: The test currently hard-codes a developer-specific archive
path, so it will fail outside one machine. Update the fixture setup in
eval_offline_test.go to resolve the must-gather archive relative to the test
file or testdata location before calling mg.NewProvider, so the same archivePath
works in CI and on any developer environment.
- Around line 1-11: Move the test to package mustgather_test to avoid the import
cycle created by importing netedge from mustgather, and update it to exercise
the public offline tool entrypoint instead of calling setProvider directly. Use
the exported mustgather flow from mg and the tool API in api to load the archive
through the same path users use. Also replace the hard-coded /Users/... testdata
path with a repository-relative lookup so the test is portable across
environments.

---

Nitpick comments:
In `@pkg/toolsets/netedge/coredns.go`:
- Around line 43-57: The must-gather provider check is duplicated across
CoreDNS-related handlers, so extract the repeated gating logic into a shared
helper to keep the behavior consistent. Add a small helper around
mustgather.GetProvider (for example in the netedge package) that returns the
loaded provider and a boolean, then update coredns.go and the matching handlers
in endpoints.go and routes.go to use it instead of inlining the same if/else
pattern. Keep the existing behavior in CoreDNSHandler and related lookup paths
unchanged while centralizing the must-gather fallback decision.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 14b9e86a-6641-4496-b1af-a328149b63a2

📥 Commits

Reviewing files that changed from the base of the PR and between dc9c67b and 0ea41bd.

📒 Files selected for processing (22)
  • evals/gemini-agent/agent.yaml
  • evals/gemini-agent/eval.yaml
  • evals/tasks/netedge/get-coredns-config/offline.yaml
  • evals/tasks/netedge/get_service_endpoints/offline.yaml
  • evals/tasks/netedge/inspect_route/offline.yaml
  • evals/testdata/must-gather/namespaces/openshift-console/routes.yaml
  • evals/testdata/must-gather/namespaces/openshift-dns/configmaps.yaml
  • evals/testdata/must-gather/namespaces/openshift-ingress/endpointslices.yaml
  • evals/testdata/must-gather/timestamp
  • evals/testdata/must-gather/version
  • pkg/toolsets/mustgather/etcd.go
  • pkg/toolsets/mustgather/eval_offline_test.go
  • pkg/toolsets/mustgather/events.go
  • pkg/toolsets/mustgather/helpers.go
  • pkg/toolsets/mustgather/mcp_resources.go
  • pkg/toolsets/mustgather/monitoring.go
  • pkg/toolsets/mustgather/nodes.go
  • pkg/toolsets/mustgather/pod_logs.go
  • pkg/toolsets/mustgather/resources.go
  • pkg/toolsets/netedge/coredns.go
  • pkg/toolsets/netedge/endpoints.go
  • pkg/toolsets/netedge/routes.go

Comment thread evals/tasks/netedge/inspect_route/offline.yaml
Comment thread pkg/toolsets/mustgather/eval_offline_test.go Outdated
Comment thread pkg/toolsets/mustgather/eval_offline_test.go Outdated
@bentito

bentito commented Jun 26, 2026

Copy link
Copy Markdown
Author

/assign @swghosh

Comment thread pkg/toolsets/netedge/endpoints.go
@gcs278

gcs278 commented Jul 8, 2026

Copy link
Copy Markdown

/assign @Thealisyed

@gcs278

gcs278 commented Jul 8, 2026

Copy link
Copy Markdown

/assign @candita

@bentito

bentito commented Jul 27, 2026

Copy link
Copy Markdown
Author

@Cali0707 This can merge please. I think we have all the feedback (and have answered) we're going to get.

@bentito

bentito commented Jul 27, 2026

Copy link
Copy Markdown
Author

@Cali0707 This can merge please. I think we have all the feedback (and have answered) we're going to get.

touching up evals as discussed

@bentito
bentito requested review from Cali0707 and manusa as code owners July 28, 2026 16:12
bentito added 6 commits July 28, 2026 12:13
This commit implements offline must-gather support for the get_service_endpoints tool, using mustgather.GetProvider() to query the offline index when available. It also includes the necessary mock must-gather data and mcpchecker tasks to validate the implementation.
This commit exports GetProvider as a public function in pkg/toolsets/mustgather/helpers.go so that other packages (like netedge) can access the offline provider when needed. It updates all existing internal references to match the new casing.
This commit implements offline must-gather support for the get_coredns_config tool, using mustgather.GetProvider() to query the offline index when available. It also includes the necessary mock must-gather data and mcpchecker tasks to validate the implementation.
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 28, 2026
bentito added 2 commits July 28, 2026 12:13
…ific configs

Refactor NIDS/netedge evaluations to adopt the new core-eval-testing
format. Standardize netedge task labels, remove deprecated global and
nested eval configs, and sync build/evals.mk to support per-suite execution.
…c configs

Update the mcpchecker.yaml workflow to run evaluations using the newly
introduced decentralized suite-specific configurations under core-eval-testing/
instead of the legacy global files. Add support for the netedge suite.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
build/evals.mk (1)

11-11: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Pin the ACP adapter version.

Defaulting to latest and installing without a committed lockfile makes evaluation behavior non-reproducible and allows an unreviewed CLI change to break ACP runs. Pin a tested version and install from a locked dependency set.

Also applies to: 48-49

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@build/evals.mk` at line 11, Update the CLAUDE_AGENT_ACP_VERSION configuration
and the associated ACP installation commands to use a specific tested version
instead of latest, and install from a committed lockfile or otherwise locked
dependency set. Apply the same pinned, reproducible setup to the additional
installation references noted in the diff.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/mcpchecker.yaml:
- Line 203: Add the missing evals/core-eval-testing/builtin-openai/eval-all.yaml
configuration for the supported all suite. Ensure it follows the schema and task
definitions expected by the existing suite eval files so the eval-config path
used by the workflow resolves for evaluation, baseline lookup, and result
publishing.

In `@build/evals.mk`:
- Around line 20-26: Update the EVAL_LABEL_SELECTOR assignment in the build
configuration so SUITE=all produces an empty selector, matching the behavior in
the CI workflow and allowing every suite to run; preserve suite=$(SUITE) for all
other suite values.

---

Nitpick comments:
In `@build/evals.mk`:
- Line 11: Update the CLAUDE_AGENT_ACP_VERSION configuration and the associated
ACP installation commands to use a specific tested version instead of latest,
and install from a committed lockfile or otherwise locked dependency set. Apply
the same pinned, reproducible setup to the additional installation references
noted in the diff.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d6ade37d-c062-4469-b0c2-2caff3ff216e

📥 Commits

Reviewing files that changed from the base of the PR and between def79e1 and a724046.

📒 Files selected for processing (27)
  • .github/workflows/mcpchecker.yaml
  • build/evals.mk
  • evals/claude-code/agent.yaml
  • evals/claude-code/eval.yaml
  • evals/core-eval-testing/acp-anthropic/eval-netedge.yaml
  • evals/core-eval-testing/acp-google/eval-netedge.yaml
  • evals/core-eval-testing/builtin-anthropic/eval-netedge.yaml
  • evals/core-eval-testing/builtin-google/eval-netedge.yaml
  • evals/core-eval-testing/builtin-openai/eval-netedge.yaml
  • evals/gemini-agent/agent.yaml
  • evals/gemini-agent/eval.yaml
  • evals/openai-agent/agent.yaml
  • evals/openai-agent/eval.yaml
  • evals/tasks/kubevirt/claude-code/eval.yaml
  • evals/tasks/kubevirt/openai-agent/eval.yaml
  • evals/tasks/netedge/get-coredns-config/offline.yaml
  • evals/tasks/netedge/get-coredns-config/task.yaml
  • evals/tasks/netedge/get-router-config/task.yaml
  • evals/tasks/netedge/get-router-info/task.yaml
  • evals/tasks/netedge/get-router-sessions/task.yaml
  • evals/tasks/netedge/get_service_endpoints/offline.yaml
  • evals/tasks/netedge/get_service_endpoints/task.yaml
  • evals/tasks/netedge/inspect_route/offline.yaml
  • evals/tasks/netedge/inspect_route/task.yaml
  • evals/tasks/netedge/probe_dns_local/task.yaml
  • evals/tasks/netedge/probe_http/task.yaml
  • evals/tasks/netedge/query_prometheus/task.yaml
💤 Files with no reviewable changes (8)
  • evals/tasks/kubevirt/openai-agent/eval.yaml
  • evals/openai-agent/eval.yaml
  • evals/claude-code/eval.yaml
  • evals/tasks/kubevirt/claude-code/eval.yaml
  • evals/openai-agent/agent.yaml
  • evals/claude-code/agent.yaml
  • evals/gemini-agent/eval.yaml
  • evals/gemini-agent/agent.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • evals/tasks/netedge/get-coredns-config/offline.yaml
  • evals/tasks/netedge/inspect_route/offline.yaml
  • evals/tasks/netedge/get_service_endpoints/offline.yaml

Comment thread .github/workflows/mcpchecker.yaml Outdated
Comment thread build/evals.mk
@bentito
bentito force-pushed the feature/nids-must-gather-offline branch from a724046 to 4a17c89 Compare July 28, 2026 16:46
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 28, 2026
@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown

@bentito: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@bentito

bentito commented Jul 28, 2026

Copy link
Copy Markdown
Author

@Cali0707 This can merge please. I think we have all the feedback (and have answered) we're going to get.

touching up evals as discussed

done. seeing if I can check them with
/run-mcpchecker netedge
or maybe only a maintainer can?

@bentito

bentito commented Jul 28, 2026

Copy link
Copy Markdown
Author

/run-mcpchecker netedge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants