Skip to content

Comments

Add OpenShift router inspection commands and shared skills#269

Closed
alebedev87 wants to merge 1 commit intoopenshift-eng:mainfrom
alebedev87:add-router-show-commands
Closed

Add OpenShift router inspection commands and shared skills#269
alebedev87 wants to merge 1 commit intoopenshift-eng:mainfrom
alebedev87:add-router-show-commands

Conversation

@alebedev87
Copy link

@alebedev87 alebedev87 commented Jan 6, 2026

This commit adds three new commands to the OpenShift plugin for inspecting router configuration and runtime data from router pods:

  • /openshift:router-show-config - Display router configuration
  • /openshift:router-show-sessions - Display active sessions
  • /openshift:router-show-info - Display process information

To eliminate code duplication, two shared skills were created:

  • oc-prereqs - Generic OpenShift CLI and cluster connectivity checks
  • router-pod-helper - Router-specific pod discovery and validation

All three commands reference these skills for common prerequisites and pod discovery logic, making the implementation maintainable and reusable for future router-related commands.

🤖 Generated with Claude Code

What this PR does / why we need it:

Which issue(s) this PR fixes:

N/A

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • [] Relevant issues have been referenced.
  • This change includes docs.

Summary by CodeRabbit

  • New Features

    • Added three OpenShift router diagnostic commands: /openshift:router-show-config, /openshift:router-show-info, /openshift:router-show-sessions.
  • Documentation

    • Added user docs for the three commands and two reusable utilities: an OpenShift CLI prerequisites checker and a router pod discovery/validation helper.

✏️ Tip: You can customize this high-level summary in your review settings.

@openshift-ci openshift-ci bot requested review from brandisher and dgoodwin January 6, 2026 20:49
@openshift-ci
Copy link

openshift-ci bot commented Jan 6, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: alebedev87
Once this PR has been reviewed and has the lgtm label, please assign bryan-cox 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
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

Walkthrough

Adds three OpenShift router inspection commands (router-show-config, router-show-info, router-show-sessions), their command docs and plugin metadata updates, plus two reusable skill docs for oc prerequisites and router pod discovery/validation. Commands query router pods (HAProxy) and save outputs to .work.

Changes

Cohort / File(s) Summary
Plugin Registry
PLUGINS.md
Appends three new OpenShift router command entries: /openshift:router-show-config, /openshift:router-show-info, /openshift:router-show-sessions.
Plugin Data
docs/data.json
Adds the three commands to the openshift plugin and registers two new public skills: oc-prereqs and router-pod-helper.
Router Command Docs
plugins/openshift/commands/router-show-config.md, plugins/openshift/commands/router-show-info.md, plugins/openshift/commands/router-show-sessions.md
New documentation files for each command: synopsis, description, prerequisites, args, implementation outline (oc prereqs, pod discovery, HAProxy socket queries / config retrieval), outputs, examples, related commands.
Reusable Skills
plugins/openshift/skills/oc-prereqs/SKILL.md, plugins/openshift/skills/router-pod-helper/SKILL.md
New skill docs describing oc CLI & cluster connectivity checks and router pod discovery/validation (discovery label, Running state, usage patterns, error handling).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Plugin as "Openshift Plugin"
    participant OC as "`oc` CLI"
    participant API as "OpenShift API"
    participant Pod as "Router Pod"
    participant HA as "HAProxy (admin socket)"

    Note over User,Plugin: User invokes one of the new commands
    User->>Plugin: /openshift:router-show-*
    Plugin->>OC: run oc-prereqs (check oc, cluster)
    alt oc present & cluster reachable
        OC->>API: query/list router pods (router-pod-helper)
        API-->>OC: pod list
        OC->>Pod: exec socat / oc exec to HAProxy admin socket
        Pod->>HA: admin socket request (e.g., "show sess all" / "show stat" / cat config)
        HA-->>Pod: admin socket response
        Pod-->>OC: command output
        OC-->>Plugin: output + saved file path (.work/openshift/...)
        Plugin-->>User: display output and file location
    else failure
        OC-->>Plugin: error
        Plugin-->>User: error message
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Pre-merge checks

✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main changes: adding three new OpenShift router inspection commands and two shared skills to support them.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
No Real People Names In Style References ✅ Passed The pull request contains no references to real people's names used as style references or examples.
No Assumed Git Remote Names ✅ Passed The pull request adds OpenShift router inspection commands and shared skills with no git operations or hardcoded remote name assumptions.
Git Push Safety Rules ✅ Passed PR contains no git push operations, force push commands, or git-related commands violating Git Push Safety Rules; exclusively adds OpenShift router inspection commands and shared skills using oc CLI and HAProxy socket queries.
No Untrusted Mcp Servers ✅ Passed PR introduces only documentation and metadata updates for OpenShift router commands with no untrusted MCP server installations, npm packages, or external dependencies.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between b5b8c93 and 5802cc1.

📒 Files selected for processing (7)
  • PLUGINS.md
  • docs/data.json
  • plugins/openshift/commands/router-show-config.md
  • plugins/openshift/commands/router-show-info.md
  • plugins/openshift/commands/router-show-sessions.md
  • plugins/openshift/skills/oc-prereqs/SKILL.md
  • plugins/openshift/skills/router-pod-helper/SKILL.md
✅ Files skipped from review due to trivial changes (1)
  • plugins/openshift/skills/router-pod-helper/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • PLUGINS.md
  • plugins/openshift/commands/router-show-info.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
plugins/openshift/commands/router-show-config.md

10-10: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

plugins/openshift/commands/router-show-sessions.md

10-10: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (4)
plugins/openshift/skills/oc-prereqs/SKILL.md (1)

1-136: Well-structured reusable skill documentation.

This skill effectively documents the OpenShift CLI prerequisite checks in a clear, modular way. All code blocks are properly formatted with language specifiers, and the documentation provides good examples for both basic and context-aware usage patterns. This serves as a solid foundation for the new router inspection commands.

docs/data.json (3)

742-742: Valid JSON structural change.

The comma addition on this line is necessary to maintain valid JSON syntax when adding the subsequent skill entries to the array.


708-725: Well-structured command definitions.

The three router inspection commands follow consistent patterns:

  • Proper JSON structure with all required fields (argument_hint, description, name, synopsis)
  • Synopsis format matches the convention used by other OpenShift plugin commands
  • Optional [router-pod-name] argument aligns with the router-pod-helper skill for automatic pod discovery
  • Clear, concise descriptions that indicate the purpose of each command

The commands logically group HAProxy router inspection functionality (config, sessions, process info) and align with the PR objectives.


743-752: Well-designed reusable skills.

The two new skills provide clear separation of concerns:

  • oc-prereqs: Generic prerequisite validation (oc CLI and cluster connectivity) that can be reused across OpenShift commands
  • router-pod-helper: Router-specific pod discovery and validation logic shared by the three inspection commands

Both skills have:

  • Clear, descriptive names and IDs following the project's conventions
  • Concise descriptions that indicate their purpose and scope
  • Appropriate level of abstraction for reducing code duplication

This design aligns with the PR's objective to eliminate code duplication across the three router commands.


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

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 6, 2026
@openshift-ci
Copy link

openshift-ci bot commented Jan 6, 2026

Hi @alebedev87. Thanks for your PR.

I'm waiting for a openshift-eng member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

Copy link
Contributor

@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: 3

🤖 Fix all issues with AI Agents
In @plugins/openshift/commands/router-show-info.md:
- Line 10: Several fenced code blocks in the router-show-info docs are missing
language specifiers; update the command synopsis fence that contains
"/openshift:router-show-info [router-pod-name]" to use ```bash and update the
example output fences that contain "/openshift:router-show-info" to use ```text
so they render with proper syntax highlighting and readability; locate these
fences around the command synopsis (the block with the router-show-info
invocation) and the example output blocks (the example output occurrences) and
add the appropriate language identifiers.
- Line 30: Replace the bare OpenShift mirror URL in the "OpenShift CLI (oc):
Required to access router pods" list item with a proper Markdown link by
wrapping the URL in [link text](https://...) syntax; use descriptive link text
like "OpenShift mirror" or "OpenShift CLI download" and ensure the URL is the
actual mirror address so the item becomes something like: OpenShift CLI (oc):
Required to access router pods — OpenShift mirror (https://...).
- Line 81: The example command using socat to query HAProxy ("oc exec -n
$NAMESPACE $ROUTER_POD -- socat stdio /var/lib/haproxy/run/haproxy.sock <<<
\"show info\"") assumes socat exists in the router pod; update the documentation
to state that socat is not present by default and provide alternatives: instruct
to install socat into a UBI-based debug pod (e.g., use dnf install -y socat)
before running the command, or recommend running the command from a
network-debug image that includes socat, or suggest using oc port-forward to
access /var/lib/haproxy/run/haproxy.sock externally; mention the exact HAProxy
socket path (/var/lib/haproxy/run/haproxy.sock) and the oc exec example so
readers know where to apply the alternative.
🧹 Nitpick comments (5)
plugins/openshift/commands/router-show-config.md (1)

26-40: Consider referencing the oc-prereqs skill instead of duplicating prerequisites.

The Prerequisites section duplicates content from the oc-prereqs skill. Since this PR introduces that skill specifically for reusability, consider replacing this section with a brief reference like:

"This command requires OpenShift CLI prerequisites. See the oc-prereqs skill for details on oc CLI installation and cluster connectivity requirements."

This maintains DRY principles and reduces maintenance burden if prerequisites change.

plugins/openshift/commands/router-show-info.md (1)

27-41: Consider referencing the oc-prereqs skill instead of duplicating prerequisites.

Similar to router-show-config.md, this Prerequisites section duplicates content from the oc-prereqs skill. Consider replacing with a brief reference to maintain consistency and reduce duplication.

plugins/openshift/skills/oc-prereqs/SKILL.md (1)

1-136: LGTM! Well-structured reusable skill.

The oc-prereqs skill is well-documented with clear examples and proper error handling. The progressive check pattern (CLI availability → connectivity → optional context) is logical and reusable.

Minor suggestion: Consider adding a "Commands Using This Skill" section at the end that lists the router commands (router-show-config, router-show-info, router-show-sessions) to help users understand where this skill is applied.

plugins/openshift/commands/router-show-sessions.md (1)

47-99: Document socat as a required dependency and add error handling.

The approach using socat with the HAProxy Unix socket is standard Red Hat practice, but the documentation doesn't explicitly mention that socat must be available in the router pod. If it's absent, the command fails with an unclear error message.

Consider:

  • Adding socat to the Prerequisites section
  • Adding error handling for the case when socat is unavailable
  • Suggesting fallback approaches (e.g., if socat is missing, check /var/lib/haproxy/conf/haproxy.config instead)
plugins/openshift/skills/router-pod-helper/SKILL.md (1)

33-53: Document the input parameter $router_pod_name explicitly.

The conditional logic references $router_pod_name to optionally accept a specific pod name, but the documentation never states that this is an input parameter or how it should be provided. The "Environment Variables" section only documents outputs, not inputs.

Add a new "Input Parameters" or "Configuration" section clarifying that $router_pod_name is an optional input variable. Specify that if provided, it will be used directly; otherwise, the skill auto-discovers the first available router pod. This is crucial for downstream commands that want to leverage this skill.

🔎 Suggested addition to the Environment Variables section

Add this before or after the existing "Environment Variables" section (around line 156):

## Input Parameters

This skill accepts one optional parameter:

- `$router_pod_name` - (Optional) Name of a specific router pod to use. If not provided, the skill will auto-discover and use the first available router pod in the `openshift-ingress` namespace.

## Environment Variables

Or integrate into existing variable documentation:

## Input and Output Variables

**Input Parameters:**
- `$router_pod_name` - (Optional) Name of a specific router pod; if empty, auto-discover the first available pod

**Output Variables (set by this skill):**
- `$NAMESPACE` - Always `openshift-ingress`
- `$ROUTER_POD` - Name of the selected router pod
- `$POD_STATUS` - Status of the pod (should be "Running")
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 984814a and 646bb17.

📒 Files selected for processing (7)
  • PLUGINS.md
  • docs/data.json
  • plugins/openshift/commands/router-show-config.md
  • plugins/openshift/commands/router-show-info.md
  • plugins/openshift/commands/router-show-sessions.md
  • plugins/openshift/skills/oc-prereqs/SKILL.md
  • plugins/openshift/skills/router-pod-helper/SKILL.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
plugins/openshift/commands/router-show-info.md

10-10: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


30-30: Bare URL used

(MD034, no-bare-urls)


138-138: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


142-142: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


160-160: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


164-164: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (7)
docs/data.json (2)

708-725: LGTM! Router command entries are well-structured.

The three new router inspection commands follow the established patterns and include consistent metadata. The optional router-pod-name argument design provides good flexibility.


742-752: Skill entries are properly structured and documented.

The two new skill entries (oc-prereqs and router-pod-helper) follow existing conventions with clear descriptions and correct IDs. The router-pod-helper skill documentation exists and is properly placed.

PLUGINS.md (1)

247-249: LGTM! Command entries properly documented.

The three new router commands are correctly added to the OpenShift plugin documentation with consistent formatting and proper placement.

plugins/openshift/commands/router-show-config.md (1)

72-80: No changes needed. The HAProxy configuration file path /var/lib/haproxy/conf/haproxy.config is the correct standard location specified in official OpenShift/OKD documentation for accessing the HAProxy configuration inside OpenShift router pods.

plugins/openshift/skills/router-pod-helper/SKILL.md (3)

107-154: Complete example properly demonstrates the integrated workflow.

The example integrates prerequisites (oc-prereqs checks) with pod discovery and validation in a logical sequence. The code is syntactically correct and shows the full flow that consuming commands should follow.


29-79: Pod discovery and validation logic is sound.

The bash code for discovering router pods using label selectors, extracting the first pod via awk, and validating Running status is correct. Error handling (lines 41–45, 73–76) provides clear feedback for failure scenarios.


173-182: References to consuming commands are accurate per PR objectives.

The three router inspection commands (router-show-config, router-show-sessions, router-show-info) are correctly listed as commands that depend on this skill, aligning with the PR's goal of reusable infrastructure.

@alebedev87
Copy link
Author

https://issues.redhat.com/browse/DPP-18905 is closed but it may take time to take effect. So, I'll have to recreate the PR to get ok-to-test.

@alebedev87 alebedev87 force-pushed the add-router-show-commands branch from 646bb17 to 123ef94 Compare January 6, 2026 21:16
Copy link
Contributor

@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

🤖 Fix all issues with AI Agents
In @plugins/openshift/commands/router-show-config.md:
- Around line 9-12: The Markdown file
plugins/openshift/commands/router-show-config.md has multiple fenced code blocks
without language specifiers and a capitalization fix for the "Return Value"
heading; update the fenced blocks so command snippets (e.g., the Synopsis block
and usage examples like "/openshift:router-show-config") use ```bash and the
displayed output blocks in Examples and content-display sections use ```text,
ensuring each opening fence matches its closing fence, and also correct the
"Return Value" heading capitalization under the Return Value section.
- Around line 29-31: Replace the bare URL on the "Install from:" line under
"OpenShift CLI (oc)" with a markdown link; edit the text that currently reads
"Install from: https://mirror.openshift.com/pub/openshift-v4/clients/ocp/" to
use link syntax, e.g. "Install from: [OpenShift CLI
download](https://mirror.openshift.com/pub/openshift-v4/clients/ocp/)" so the
URL is not bare and matches the document's markdown link style.

In @plugins/openshift/commands/router-show-sessions.md:
- Around line 29-31: Replace the bare URL
"https://mirror.openshift.com/pub/openshift-v4/clients/ocp/" on the Install line
with a proper Markdown link; for example change the line that currently reads
"Install from: https://mirror.openshift.com/pub/openshift-v4/clients/ocp/" to
use link syntax such as "Install from: [OpenShift CLI (oc)
downloads](https://mirror.openshift.com/pub/openshift-v4/clients/ocp/)" so the
URL is not bare and is consistent with the rest of the document.
- Around line 138-147: In the example blocks in router-show-sessions.md, the
fenced code blocks following the "Output:" lines are missing language
specifiers; update each of those triple-backtick fences that wrap the example
output (the blocks showing "Finding router pods..." and "Using specified router
pod...") from ``` to ```text so the output is explicitly marked as plain text.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 646bb17 and 123ef94.

📒 Files selected for processing (7)
  • PLUGINS.md
  • docs/data.json
  • plugins/openshift/commands/router-show-config.md
  • plugins/openshift/commands/router-show-info.md
  • plugins/openshift/commands/router-show-sessions.md
  • plugins/openshift/skills/oc-prereqs/SKILL.md
  • plugins/openshift/skills/router-pod-helper/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (5)
  • plugins/openshift/skills/router-pod-helper/SKILL.md
  • plugins/openshift/skills/oc-prereqs/SKILL.md
  • PLUGINS.md
  • plugins/openshift/commands/router-show-info.md
  • docs/data.json
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
plugins/openshift/commands/router-show-sessions.md

10-10: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


30-30: Bare URL used

(MD034, no-bare-urls)


138-138: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


142-142: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

plugins/openshift/commands/router-show-config.md

31-31: Bare URL used

(MD034, no-bare-urls)


122-122: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


126-126: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


151-151: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


155-155: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

@alebedev87 alebedev87 force-pushed the add-router-show-commands branch from 123ef94 to b5b8c93 Compare January 6, 2026 21:24
This commit adds three new commands to the OpenShift plugin for inspecting
router configuration and runtime data from router pods:

- /openshift:router-show-config - Display router configuration
- /openshift:router-show-sessions - Display active sessions
- /openshift:router-show-info - Display process information

To eliminate code duplication, two shared skills were created:

- oc-prereqs - Generic OpenShift CLI and cluster connectivity checks
- router-pod-helper - Router-specific pod discovery and validation

All three commands reference these skills for common prerequisites and
pod discovery logic, making the implementation maintainable and reusable
for future router-related commands.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@alebedev87 alebedev87 force-pushed the add-router-show-commands branch from b5b8c93 to 5802cc1 Compare January 6, 2026 21:33
@alebedev87 alebedev87 closed this Jan 7, 2026
@alebedev87
Copy link
Author

alebedev87 commented Jan 7, 2026

New PR after I was added to openshift-eng org: #274.

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

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant