Skip to content

NE-2488: Add OpenShift router tools to NetworkEdge toolset#98

Merged
openshift-merge-bot[bot] merged 3 commits intoopenshift:mainfrom
alebedev87:router-toolset
Apr 23, 2026
Merged

NE-2488: Add OpenShift router tools to NetworkEdge toolset#98
openshift-merge-bot[bot] merged 3 commits intoopenshift:mainfrom
alebedev87:router-toolset

Conversation

@alebedev87
Copy link
Copy Markdown

@alebedev87 alebedev87 commented Jan 9, 2026

This PR introduces new tools for inspecting OpenShift router pods through the Kubernetes MCP Server.

Added tools:

  • get_router_config: View the router's configuration
  • get_router_info: Get router runtime information and statistics
  • get_router_sessions: View all active sessions in the router

Documentation: Added NETEDGE.md covering the NetworkEdge toolset, including both router and CoreDNS tools.

Tests: Added evaluation tasks for the added tools.

Summary by CodeRabbit

  • New Features

    • Added a Network Ingress & DNS (netedge) toolset with three OpenShift router inspection tools to retrieve HAProxy config, runtime info, and active sessions; each accepts an optional pod parameter and auto-selects a running router pod when omitted.
  • Documentation

    • New guide describing the netedge toolset, parameters, behavior, usage examples, and CoreDNS retrieval.
  • Tests

    • Added evaluation tasks validating each router inspection tool and adjusted a prometheus query task assertion.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jan 9, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 9, 2026
@swghosh
Copy link
Copy Markdown
Member

swghosh commented Jan 12, 2026

#51 (comment)

Should we consider having this as a part of the "openshift" toolgroup?

@alebedev87 alebedev87 marked this pull request as ready for review January 12, 2026 22:39
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 12, 2026
@openshift-ci openshift-ci Bot requested review from ardaguclu and matzew January 12, 2026 22:40
@alebedev87
Copy link
Copy Markdown
Author

Should we consider having this as a part of the "openshift" toolgroup?

@swghosh : That crossed my mind too. In my case "router" doesn't make much sense in Kubernetes context. However I didn't want to complicate things at this stage either.

@bentito
Copy link
Copy Markdown

bentito commented Jan 20, 2026

Wherever this ends up we'll likely end up using it as part of our NIDS MCP tooling. https://issues.redhat.com/browse/NE-2278 inspect_route likely can just call one of these or be replaced by one or more of these. Also we might want to support all of these such that we have richer router data. cc @rikatz @Thealisyed

@matzew
Copy link
Copy Markdown
Member

matzew commented Feb 10, 2026

can just call one of these or be replaced by one or more of these

@bentito @alebedev87 any updates on this? or still on discussion.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 10, 2026
@bentito
Copy link
Copy Markdown

bentito commented Feb 10, 2026

@bentito @alebedev87 any updates on this? or still on discussion.
@alebedev87 When you can, please rebase and move to the ./pkg/toolsets/netedge dir

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 12, 2026
@alebedev87 alebedev87 changed the title Add toolset for OpenShift router NE-2488: Add OpenShift router tools to NetworkEdge toolset Feb 12, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Feb 12, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Feb 12, 2026

@alebedev87: This pull request references NE-2488 which is a valid jira issue.

Details

In response to this:

This PR introduces new tools for inspecting OpenShift router pods through the Kubernetes MCP Server.

Added tools:

  • get_router_config: View the router's configuration
  • get_router_info: Get router runtime information and statistics
  • get_router_sessions: View all active sessions in the router

Documentation: Added NETEDGE.md covering the NetworkEdge toolset, including both router and CoreDNS tools.

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
Copy link
Copy Markdown

openshift-ci-robot commented Feb 12, 2026

@alebedev87: This pull request references NE-2488 which is a valid jira issue.

Details

In response to this:

This PR introduces new tools for inspecting OpenShift router pods through the Kubernetes MCP Server.

Added tools:

  • get_router_config: View the router's configuration
  • get_router_info: Get router runtime information and statistics
  • get_router_sessions: View all active sessions in the router

Documentation: Added NETEDGE.md covering the NetworkEdge toolset, including both router and CoreDNS tools.

Tests: Added evaluation tasks for the added tools.

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.

Title: "Get Router Config",
ReadOnlyHint: ptr.To(true),
DestructiveHint: ptr.To(false),
OpenWorldHint: ptr.To(true),
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@bentito : I used false here before but then I copied true as in get_coredns_config tool. I'm not quite sure whether it's a good decision for router configs/sessions/info. Can you please advice?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes true is correct for all three tools, since all three router tools exec into a live, running router pod on the cluster. False would be for a tool that had all the data locally already, not the case here.

(Sorry I missed this comment for quite awhile)

@bentito
Copy link
Copy Markdown

bentito commented Feb 12, 2026

I've reviewed this PR in the context of the NIDS MCP strategy and found a few critical areas for improvement, particularly regarding offline analysis.

Review Summary: Router Tools vs Offline Strategy

Context:

1. Critical Refactoring Required: Offline Compatibility

The current implementation of get_router_config relies on PodsExec (effectively oc exec), which will not work with offline must-gather archives.
Refactoring Recommendation:
Adopt the Client Abstraction Pattern demonstrated in ovn-kubernetes-mcp.

  • Abstract the Data Source: Use a helper that switches behavior based on the context (live cluster vs. file dump).
  • Implementation for get_router_config:
    • Live Mode: Continue using exec cat /var/lib/haproxy/conf/haproxy.config.
    • Offline Mode: Read the file directly from the filesystem. I confirmed that standard must-gather archives do contain this file at paths like .../ingress_controllers/default/router-*/haproxy.config.

2. Scope Clarification: "Live Only" Tools

The tools get_router_info and get_router_sessions rely on active HAProxy socket commands (show info, show sess).

  • Finding: These outputs are not present in standard must-gather dumps.
  • Action: These must be explicitly documented and marked as Live Only to set correct expectations for the agent and users, as they will fail in offline triage scenarios.

3. Consistency: Client Usage

PR #98 uses kubernetes.NewCore(params).PodsExec. For consistency with PR #115, request that the author switch to the controller-runtime client pattern where applicable (e.g., for listing pods), as it simplifies testing and mocking.

@alebedev87
Copy link
Copy Markdown
Author

Regarding the first 2 points (Critical Refactoring Required: Offline Compatibility, Scope Clarification: "Live Only" Tools). As discussed in Slack, currently the router tools cannot work in "offline mode" because must-gather doesn't have HAProxy specific data. I added a comment about "live only" nature of the tools.

@alebedev87
Copy link
Copy Markdown
Author

/assign @bentito

@bentito
Copy link
Copy Markdown

bentito commented Mar 4, 2026

I

Regarding the first 2 points (Critical Refactoring Required: Offline Compatibility, Scope Clarification: "Live Only" Tools). As discussed in Slack, currently the router tools cannot work in "offline mode" because must-gather doesn't have HAProxy specific data. I added a comment about "live only" nature of the tools.

I've added haproxy-gather to the list of offline artifacts. So then it might make sense, right?

@bentito
Copy link
Copy Markdown

bentito commented Mar 10, 2026

/assign @matzew

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 3, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cd425031-5199-4489-adcb-bb3ba3e8780c

📥 Commits

Reviewing files that changed from the base of the PR and between 676825b and cb633e4.

📒 Files selected for processing (6)
  • 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/query_prometheus/task.yaml
  • pkg/toolsets/netedge/router.go
  • pkg/toolsets/netedge/toolset.go
✅ Files skipped from review due to trivial changes (5)
  • evals/tasks/netedge/query_prometheus/task.yaml
  • evals/tasks/netedge/get-router-info/task.yaml
  • evals/tasks/netedge/get-router-config/task.yaml
  • pkg/toolsets/netedge/toolset.go
  • evals/tasks/netedge/get-router-sessions/task.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/toolsets/netedge/router.go

📝 Walkthrough

Walkthrough

Adds NetEdge docs, three new netedge router tools that locate OpenShift router pods and exec into the router container to retrieve HAProxy config, runtime info, and sessions, registers those tools in the netedge toolset, and adds four evaluation tasks (three router tasks + one Prometheus toolPattern tweak).

Changes

Cohort / File(s) Summary
Documentation
docs/openshift/NETEDGE.md
New documentation describing Network Ingress & DNS (netedge) tools, router vs DNS tools, optional pod parameter, default ingress controller name hard-coded as default, behavior when pod omitted, and example interactions/outputs.
Router Tools Implementation
pkg/toolsets/netedge/router.go
New file registering three read-only server tools: get_router_config, get_router_info, get_router_sessions. Each accepts optional pod; if omitted, lists pods in openshift-ingress using label selector deployment-ingresscontroller=<icName> (default default) and field status.phase=Running, selects the first running pod, then PodsExec into the router container to run HAProxy commands (cat config, show info, show sess all). Outputs formatted with a section header and fenced code block; discovery/exec errors included in the returned message.
Toolset Integration
pkg/toolsets/netedge/toolset.go
Adds initRouter() to Toolset.GetTools() so the new router tools are included in the netedge toolset.
Evaluation Tasks — NetEdge Router
evals/tasks/netedge/get-router-config/task.yaml, evals/tasks/netedge/get-router-info/task.yaml, evals/tasks/netedge/get-router-sessions/task.yaml
Adds three eval tasks that prompt retrieval of router config, runtime info, and active sessions, each verifying a specific substring ("frontend public", "Name: HAProxy", frontend=GLOBAL) and asserting the corresponding Kubernetes tool usage (toolPattern values: get_router_config, get_router_info, get_router_sessions).
Evaluation Tasks — Prometheus tweak
evals/tasks/netedge/query_prometheus/task.yaml
Minor change: toolsUsed assertion updated to match toolPattern: "query_prometheus" (replacing netedge__query_prometheus).

Sequence Diagram(s)

sequenceDiagram
    participant Client as MCP Client
    participant Server as MCP Server
    participant K8sAPI as Kubernetes API
    participant RouterPod as OpenShift Router Pod

    Client->>Server: Invoke router tool (optional `pod` param)
    alt pod provided
        Server->>RouterPod: Exec command in specified pod's `router` container
    else pod omitted
        Server->>K8sAPI: List pods in `openshift-ingress` with label=`deployment-ingresscontroller=default` and field=`status.phase=Running`
        K8sAPI-->>Server: Return pod list
        Server->>Server: Select first running router pod
        Server->>RouterPod: Exec command in selected pod's `router` container
    end
    RouterPod-->>Server: Command output
    Server->>Server: Format output (section header + fenced code block, include errors inline)
    Server-->>Client: Return tool result with formatted output
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through pods beneath the net,
I peeked where HAProxy keeps its set,
Configs, stats, and sessions in a line,
NetEdge sings — the ingress is fine,
A happy rabbit nibbles a carrot, "All in time!" 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% 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 and concisely summarizes the main change: adding OpenShift router tools to the NetworkEdge toolset, which is the primary focus of all changes across documentation, implementation, and tests.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 3, 2026

@alebedev87: This pull request references NE-2488 which is a valid jira issue.

Details

In response to this:

This PR introduces new tools for inspecting OpenShift router pods through the Kubernetes MCP Server.

Added tools:

  • get_router_config: View the router's configuration
  • get_router_info: Get router runtime information and statistics
  • get_router_sessions: View all active sessions in the router

Documentation: Added NETEDGE.md covering the NetworkEdge toolset, including both router and CoreDNS tools.

Tests: Added evaluation tasks for the added tools.

Summary by CodeRabbit

  • New Features

  • Added Network Ingress & DNS (netedge) toolset for Kubernetes MCP Server with three new tools for OpenShift router inspection: retrieve HAProxy configuration, runtime information, and active sessions.

  • Documentation

  • New comprehensive guide documenting netedge toolset capabilities, tool parameters, and end-to-end usage examples.

  • Tests

  • Added evaluation tasks validating the three new router inspection tools.

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/openshift/NETEDGE.md`:
- Line 37: The code fences in NETEDGE.md are missing language identifiers
causing markdownlint warnings; update each opening triple-backtick fence at the
four example blocks to include the "text" language tag (i.e., change ``` to
```text) so the blocks at the mentioned example locations render and lint
cleanly.
- Around line 27-29: The note claiming "All tools have an optional `pod`
parameter" is too broad; update the text to state that the optional `pod`
parameter applies only to the router-related tools (e.g., the router command
group / functions) and not to DNS commands like get_coredns_config which have no
parameters; revise the sentence to explicitly mention "router tools" (or list
the router commands) and remove or clarify the implication that
get_coredns_config accepts a `pod` argument so readers won't expect `pod` on DNS
commands.

In `@evals/tasks/netedge/get-router-info/task.yaml`:
- Around line 5-6: The verify step asserts the prose string "HAProxy Version"
but pkg/toolsets/netedge/router.go returns raw "show info" output (fields like
"Name: HAProxy" and "Version:"), so update the task verification to match the
tool contract—replace or broaden the contains check to assert for the raw fields
such as "Name: HAProxy" and/or "Version:" (or a regex that matches
"Name:\s*HAProxy" and "Version:") so valid raw responses are accepted.
🪄 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

Run ID: 368622e6-27f5-4fde-ac33-c34624214f7c

📥 Commits

Reviewing files that changed from the base of the PR and between 46c45a9 and f62a70b.

📒 Files selected for processing (6)
  • docs/openshift/NETEDGE.md
  • evals/tasks/netedge/get-router-config/task.yaml
  • evals/tasks/netedge/get-router-info/task.yaml
  • evals/tasks/netedge/get-router-sessions/task.yaml
  • pkg/toolsets/netedge/router.go
  • pkg/toolsets/netedge/toolset.go

Comment thread docs/openshift/NETEDGE.md
Comment thread docs/openshift/NETEDGE.md Outdated
Comment thread evals/tasks/netedge/get-router-info/task.yaml Outdated
Comment thread pkg/toolsets/netedge/router.go
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 3, 2026

@alebedev87: This pull request references NE-2488 which is a valid jira issue.

Details

In response to this:

This PR introduces new tools for inspecting OpenShift router pods through the Kubernetes MCP Server.

Added tools:

  • get_router_config: View the router's configuration
  • get_router_info: Get router runtime information and statistics
  • get_router_sessions: View all active sessions in the router

Documentation: Added NETEDGE.md covering the NetworkEdge toolset, including both router and CoreDNS tools.

Tests: Added evaluation tasks for the added tools.

Summary by CodeRabbit

  • New Features

  • Added Network Ingress & DNS (netedge) toolset with three OpenShift router inspection tools to retrieve HAProxy config, runtime info, and active sessions; each tool accepts an optional pod parameter and will auto-select a running router pod if none is provided.

  • Documentation

  • New guide describing the netedge toolset, parameters, and end-to-end usage examples (includes a CoreDNS fetch example).

  • Tests

  • Added evaluation tasks validating the three router inspection tools.

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

104-129: Consider extracting common handler logic.

All three handlers share an identical pattern: extract pod argument → resolve pod → exec command → format result. A helper function could reduce duplication:

func execRouterCommand(params api.ToolHandlerParams, header string, command []string) (*api.ToolCallResult, error) {
    pod, ok := params.GetArguments()["pod"].(string)
    if !ok || pod == "" {
        p, err := getAnyRouterPod(params, defaultIngressControllerName)
        if err != nil {
            return api.NewToolCallResult(fmt.Sprintf("# %s\nError getting router pod: %v", header, err), nil), nil
        }
        pod = p
    }
    out, err := kubernetes.NewCore(params).PodsExec(params.Context, ingressNamespace, pod, routerContainerName, command)
    if err != nil {
        return api.NewToolCallResult(fmt.Sprintf("# %s (pod: %s)\nError: %v", header, pod, err), nil), nil
    }
    return api.NewToolCallResult(fmt.Sprintf("# %s (pod: %s)\n```\n%s\n```", header, pod, out), nil), nil
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/toolsets/netedge/router.go` around lines 104 - 129, The getRouterConfig
handler duplicates the common pattern of resolving a pod arg, falling back to
getAnyRouterPod, running kubernetes.NewCore(...).PodsExec and formatting the
output; extract that shared logic into a helper (e.g., execRouterCommand) that
accepts params, a header string and command []string, calls
params.GetArguments() to resolve "pod" (using
getAnyRouterPod(defaultIngressControllerName) when empty), executes the command
via kubernetes.NewCore(params).PodsExec(params.Context, ingressNamespace, pod,
routerContainerName, command), and returns an api.ToolCallResult with either an
error block or a fenced output block; then simplify getRouterConfig to call this
helper with the header "Router configuration" and the command ["cat",
"/var/lib/haproxy/conf/haproxy.config"].
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/toolsets/netedge/router.go`:
- Around line 104-129: The getRouterConfig handler duplicates the common pattern
of resolving a pod arg, falling back to getAnyRouterPod, running
kubernetes.NewCore(...).PodsExec and formatting the output; extract that shared
logic into a helper (e.g., execRouterCommand) that accepts params, a header
string and command []string, calls params.GetArguments() to resolve "pod" (using
getAnyRouterPod(defaultIngressControllerName) when empty), executes the command
via kubernetes.NewCore(params).PodsExec(params.Context, ingressNamespace, pod,
routerContainerName, command), and returns an api.ToolCallResult with either an
error block or a fenced output block; then simplify getRouterConfig to call this
helper with the header "Router configuration" and the command ["cat",
"/var/lib/haproxy/conf/haproxy.config"].

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3a50b86a-a3bc-40ee-b1b7-965ea2a701c9

📥 Commits

Reviewing files that changed from the base of the PR and between f62a70b and eb2e6d7.

📒 Files selected for processing (6)
  • docs/openshift/NETEDGE.md
  • evals/tasks/netedge/get-router-config/task.yaml
  • evals/tasks/netedge/get-router-info/task.yaml
  • evals/tasks/netedge/get-router-sessions/task.yaml
  • pkg/toolsets/netedge/router.go
  • pkg/toolsets/netedge/toolset.go
✅ Files skipped from review due to trivial changes (4)
  • evals/tasks/netedge/get-router-sessions/task.yaml
  • evals/tasks/netedge/get-router-config/task.yaml
  • docs/openshift/NETEDGE.md
  • evals/tasks/netedge/get-router-info/task.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/toolsets/netedge/toolset.go

@alebedev87
Copy link
Copy Markdown
Author

/retest

Add three new MCP tools for inspecting OpenShift router pods (HAProxy):
- get_router_config: retrieves the HAProxy configuration file
- get_router_info: retrieves HAProxy runtime information via admin socket
- get_router_sessions: retrieves all active HAProxy sessions

Each tool accepts an optional pod parameter. When omitted, a Running
router pod is automatically selected from the default ingress controller.

Also includes evaluation tasks and documentation for the new tools.
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 21, 2026

@alebedev87: This pull request references NE-2488 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 either version "5.0." or "openshift-5.0.", but it targets "openshift-4.22" instead.

Details

In response to this:

This PR introduces new tools for inspecting OpenShift router pods through the Kubernetes MCP Server.

Added tools:

  • get_router_config: View the router's configuration
  • get_router_info: Get router runtime information and statistics
  • get_router_sessions: View all active sessions in the router

Documentation: Added NETEDGE.md covering the NetworkEdge toolset, including both router and CoreDNS tools.

Tests: Added evaluation tasks for the added tools.

Summary by CodeRabbit

  • New Features

  • Added a Network Ingress & DNS (netedge) toolset with three OpenShift router inspection tools to retrieve HAProxy config, runtime info, and active sessions; each accepts an optional pod parameter and auto-selects a running router pod when omitted.

  • Documentation

  • New guide describing the netedge toolset, parameters, behavior, and usage examples (including CoreDNS retrieval).

  • Tests

  • Added evaluation tasks validating each router inspection tool.

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

104-190: Extract shared router-tool flow to reduce drift and keep behavior consistent.

getRouterConfig, getRouterInfo, and getRouterSessions duplicate pod resolution, error/result formatting, and exec flow. A small shared helper would reduce copy/paste bugs and keep future changes (like error propagation or formatting) aligned.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pkg/toolsets/netedge/router.go`:
- Around line 110-113: The code currently appends error text to results and
returns api.NewToolCallResult(strings.Join(results, "\n"), nil) which hides
execution failures; update each failure path (where you currently append error
lines and then return a ToolCallResult with nil error) to return
api.NewToolCallResult(strings.Join(results, "\n"), err), nil so the
ToolCallResult.Error carries the real error, and for successful exec paths
follow the suggested pattern: immediately return on exec errors with the error
populated, otherwise append headers like fmt.Sprintf("# Router configuration
(pod: %s)", pod), wrap the command output between "```" markers into results,
and finally return api.NewToolCallResult(strings.Join(results, "\n"), nil), nil;
apply this change to all occurrences that build results and call
api.NewToolCallResult (the failing pod discovery/exec branches referenced around
the current calls to api.NewToolCallResult).
🪄 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: b1afd9ee-4834-491c-b997-63f104299910

📥 Commits

Reviewing files that changed from the base of the PR and between eb2e6d7 and 9a47ce8.

📒 Files selected for processing (6)
  • docs/openshift/NETEDGE.md
  • evals/tasks/netedge/get-router-config/task.yaml
  • evals/tasks/netedge/get-router-info/task.yaml
  • evals/tasks/netedge/get-router-sessions/task.yaml
  • pkg/toolsets/netedge/router.go
  • pkg/toolsets/netedge/toolset.go
✅ Files skipped from review due to trivial changes (4)
  • evals/tasks/netedge/get-router-info/task.yaml
  • docs/openshift/NETEDGE.md
  • evals/tasks/netedge/get-router-sessions/task.yaml
  • evals/tasks/netedge/get-router-config/task.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/toolsets/netedge/toolset.go

Comment thread pkg/toolsets/netedge/router.go Outdated
Comment thread pkg/toolsets/netedge/toolset.go Outdated
Comment on lines +32 to +34
initExecDNSInPod(),
initRouter(),
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

mixed indentation

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fixed in cb633e4

@@ -0,0 +1,204 @@
package netedge
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The initRouter() function and getAnyRouterPod() use tabs (matching the project style), but all three handler functions (getRouterConfig, getRouterInfo and getRouterSessions) use spaces. This is in a single file. The linter passed, so Go doesn't care, but it's inconsistent and will produce noisy diffs if someone later reformats.

IMO aA quick gofmt should fix it?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fixed in cb633e4

Comment thread docs/openshift/NETEDGE.md
Comment on lines +15 to +17
| `get_router_config` | Retrieve the current router's HAProxy configuration | `pod` (optional) - Router pod name |
| `get_router_info` | Retrieve HAProxy runtime information from the router | `pod` (optional) - Router pod name |
| `get_router_sessions` | Retrieve all active sessions from the router | `pod` (optional) - Router pod name |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

get_router_config dumps the full HAProxy config and get_router_sessions dumps all sessions. On a busy cluster these could be very large. No truncation or pagination.

This could hit MCP response size limits or flood the AI context window. Not a blocker for initial merge but worth a follow-up?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good point! I'll add a story to follow up on this. Thanks.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Follow-up story created: NE-2636

assertions:
toolsUsed:
- server: kubernetes
toolPattern: "netedge__get_router_sessions"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The toolPattern uses a netedge prefix, but tool names are registered in MCP without toolset prefixes - the actual tool name is just get_router_config. Since toolPattern is a regex match against the raw tool name, netedge__get_router_config will never match. Same issue the other filez. All three should drop the netedge__ prefix.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fixed in cb633e4

@matzew
Copy link
Copy Markdown
Member

matzew commented Apr 23, 2026

/override "Konflux kflux-prd-rh02 / openshift-mcp-server-on-pull-request"

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 23, 2026

@matzew: Overrode contexts on behalf of matzew: Konflux kflux-prd-rh02 / openshift-mcp-server-on-pull-request

Details

In response to this:

/override "Konflux kflux-prd-rh02 / openshift-mcp-server-on-pull-request"

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.

@matzew
Copy link
Copy Markdown
Member

matzew commented Apr 23, 2026

@bentito I am not seeing cb633e4 ?

@bentito
Copy link
Copy Markdown

bentito commented Apr 23, 2026

@bentito I am not seeing cb633e4 ?

Sorry pushed to the wrong remote. It's here now.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 23, 2026

@alebedev87: 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.

Copy link
Copy Markdown
Member

@matzew matzew left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@matzew
Copy link
Copy Markdown
Member

matzew commented Apr 23, 2026

/override "Konflux kflux-prd-rh02 / openshift-mcp-server-on-pull-request"

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 23, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 23, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alebedev87, matzew

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

The pull request process is described 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 23, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 23, 2026

@matzew: Overrode contexts on behalf of matzew: Konflux kflux-prd-rh02 / openshift-mcp-server-on-pull-request

Details

In response to this:

/override "Konflux kflux-prd-rh02 / openshift-mcp-server-on-pull-request"

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.

@openshift-merge-bot openshift-merge-bot Bot merged commit 0286feb into openshift:main Apr 23, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants